| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 { | 217 { |
| 218 return browser.windows.create({ | 218 return browser.windows.create({ |
| 219 url: browser.extension.getURL("composer.html"), | 219 url: browser.extension.getURL("composer.html"), |
| 220 left: 50, | 220 left: 50, |
| 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 |
| 228 // populate the tabs property reliably. |
| 229 if ("tabs" in window) |
| 230 return window; |
| 231 else |
| 232 return browser.windows.get(window.id, {populate: true}); |
| 233 }).then(window => |
| 234 { |
| 227 let popupPageId = window.tabs[0].id; | 235 let popupPageId = window.tabs[0].id; |
| 228 | 236 |
| 229 let doInitAttempt = 0; | 237 let doInitAttempt = 0; |
| 230 let doInit = () => | 238 let doInit = () => |
| 231 { | 239 { |
| 232 doInitAttempt += 1; | 240 doInitAttempt += 1; |
| 233 if (doInitAttempt > 3) | 241 if (doInitAttempt > 3) |
| 234 return; | 242 return; |
| 235 | 243 |
| 236 browser.tabs.sendMessage(popupPageId, { | 244 browser.tabs.sendMessage(popupPageId, { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 { | 312 { |
| 305 return quoteCSS(message.CSS); | 313 return quoteCSS(message.CSS); |
| 306 }); | 314 }); |
| 307 | 315 |
| 308 ext.pages.onLoading.addListener(page => | 316 ext.pages.onLoading.addListener(page => |
| 309 { | 317 { |
| 310 // A newly opened tab that is still loading has its URL set to about:blank | 318 // A newly opened tab that is still loading has its URL set to about:blank |
| 311 if (/^https?:/.test(page.url.protocol)) | 319 if (/^https?:/.test(page.url.protocol)) |
| 312 page.sendMessage({type: "composer.content.finished"}); | 320 page.sendMessage({type: "composer.content.finished"}); |
| 313 }); | 321 }); |
| OLD | NEW |