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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 top: 50, | 221 top: 50, |
222 width: 420, | 222 width: 420, |
223 height: 200, | 223 height: 200, |
224 type: "popup" | 224 type: "popup" |
225 }).then(window => | 225 }).then(window => |
226 { | 226 { |
227 // The windows.create API with versions of Firefox < 52 doesn't seem to | 227 // The windows.create API with versions of Firefox < 52 doesn't seem to |
228 // populate the tabs property reliably. | 228 // populate the tabs property reliably. |
229 if ("tabs" in window) | 229 if ("tabs" in window) |
230 return window; | 230 return window; |
231 else | 231 return browser.windows.get(window.id, {populate: true}); |
232 return browser.windows.get(window.id, {populate: true}); | |
233 }).then(window => | 232 }).then(window => |
234 { | 233 { |
235 let popupPageId = window.tabs[0].id; | 234 let popupPageId = window.tabs[0].id; |
236 | 235 |
237 let doInitAttempt = 0; | 236 let doInitAttempt = 0; |
238 let doInit = () => | 237 let doInit = () => |
239 { | 238 { |
240 doInitAttempt += 1; | 239 doInitAttempt += 1; |
241 if (doInitAttempt > 30) | 240 if (doInitAttempt > 30) |
242 return; | 241 return; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // When tabs start loading we send them a message to ensure that the state | 323 // When tabs start loading we send them a message to ensure that the state |
325 // of the "block element" tool is reset. This is necessary since Firefox will | 324 // of the "block element" tool is reset. This is necessary since Firefox will |
326 // sometimes cache the state of a tab when the user navigates back / forward, | 325 // sometimes cache the state of a tab when the user navigates back / forward, |
327 // which includes the state of the "block element" tool. | 326 // which includes the state of the "block element" tool. |
328 // Since sending this message will often fail (e.g. for new tabs which have | 327 // Since sending this message will often fail (e.g. for new tabs which have |
329 // just been opened) we catch and ignore any exception thrown. | 328 // just been opened) we catch and ignore any exception thrown. |
330 browser.tabs.sendMessage( | 329 browser.tabs.sendMessage( |
331 page.id, {type: "composer.content.finished"} | 330 page.id, {type: "composer.content.finished"} |
332 ).catch(() => {}); | 331 ).catch(() => {}); |
333 }); | 332 }); |
OLD | NEW |