| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 browser.tabs.sendMessage(popupPageId, { | 181 browser.tabs.sendMessage(popupPageId, { |
| 182 type: "composer.dialog.init", | 182 type: "composer.dialog.init", |
| 183 sender: sender.page.id, | 183 sender: sender.page.id, |
| 184 filters: message.filters | 184 filters: message.filters |
| 185 }).then(response => | 185 }).then(response => |
| 186 { | 186 { |
| 187 // Sometimes sendMessage incorrectly reports a success on Firefox, so | 187 // Sometimes sendMessage incorrectly reports a success on Firefox, so |
| 188 // we must check the response too. | 188 // we must check the response too. |
| 189 if (!response) | 189 if (!response) |
| 190 throw new Error(); | 190 throw new Error(); |
| 191 |
| 192 // Sometimes Firefox doesn't draw the window's contents initially, so we |
| 193 // resize the window slightly as a workaround. |
| 194 // https://issues.adblockplus.org/ticket/6493 |
| 195 if (info.application == "firefox") |
| 196 browser.windows.update(window.id, {width: window.width + 2}); |
| 191 }).catch(e => | 197 }).catch(e => |
| 192 { | 198 { |
| 193 // Firefox sometimes sets the status for a window to "complete" before | 199 // Firefox sometimes sets the status for a window to "complete" before |
| 194 // it is ready to receive messages[1]. As a workaround we'll try again a | 200 // it is ready to receive messages[1]. As a workaround we'll try again a |
| 195 // few times with a second delay. | 201 // few times with a second delay. |
| 196 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1418655 | 202 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1418655 |
| 197 setTimeout(doInit, 100); | 203 setTimeout(doInit, 100); |
| 198 }); | 204 }); |
| 199 }; | 205 }; |
| 200 if (window.tabs[0].status != "complete") | 206 if (window.tabs[0].status != "complete") |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 port.on("composer.isPageReady", (message, sender) => | 364 port.on("composer.isPageReady", (message, sender) => |
| 359 { | 365 { |
| 360 return readyActivePages.has(new ext.Page({id: message.pageId})); | 366 return readyActivePages.has(new ext.Page({id: message.pageId})); |
| 361 }); | 367 }); |
| 362 | 368 |
| 363 port.on("composer.ready", (message, sender) => | 369 port.on("composer.ready", (message, sender) => |
| 364 { | 370 { |
| 365 readyActivePages.set(sender.page, !checkWhitelisted(sender.page)); | 371 readyActivePages.set(sender.page, !checkWhitelisted(sender.page)); |
| 366 updateContextMenu(sender.page); | 372 updateContextMenu(sender.page); |
| 367 }); | 373 }); |
| OLD | NEW |