| 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 /** @module filterComposer */ | 18 /** @module filterComposer */ |
| 19 | 19 |
| 20 "use strict"; | 20 "use strict"; |
| 21 | 21 |
| 22 const {defaultMatcher} = require("matcher"); | 22 const {defaultMatcher} = require("../adblockpluscore/lib/matcher"); |
| 23 const {RegExpFilter} = require("filterClasses"); | 23 const {RegExpFilter} = require("../adblockpluscore/lib/filterClasses"); |
| 24 const {FilterNotifier} = require("filterNotifier"); | 24 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier"); |
| 25 const {Prefs} = require("prefs"); | 25 const {Prefs} = require("./prefs"); |
| 26 const {extractHostFromFrame, stringifyURL, isThirdParty} = require("url"); | 26 const {extractHostFromFrame, stringifyURL, isThirdParty} = require("./url"); |
| 27 const {getKey, checkWhitelisted} = require("whitelisting"); | 27 const {getKey, checkWhitelisted} = require("./whitelisting"); |
| 28 const {port} = require("messaging"); | 28 const {port} = require("./messaging"); |
| 29 const info = require("info"); | 29 const info = require("../buildtools/info"); |
| 30 | 30 |
| 31 let readyPages = new ext.PageMap(); | 31 let readyPages = new ext.PageMap(); |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Checks whether the given page is ready to use the filter composer | 34 * Checks whether the given page is ready to use the filter composer |
| 35 * | 35 * |
| 36 * @param {Page} page | 36 * @param {Page} page |
| 37 * @return {boolean} | 37 * @return {boolean} |
| 38 */ | 38 */ |
| 39 exports.isPageReady = page => | 39 exports.isPageReady = page => |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 { | 280 { |
| 281 sender.page.sendMessage({ | 281 sender.page.sendMessage({ |
| 282 type: "composer.content.dialogClosed", | 282 type: "composer.content.dialogClosed", |
| 283 popupId: popupPageId | 283 popupId: popupPageId |
| 284 }); | 284 }); |
| 285 browser.tabs.onRemoved.removeListener(onRemoved); | 285 browser.tabs.onRemoved.removeListener(onRemoved); |
| 286 } | 286 } |
| 287 }; | 287 }; |
| 288 browser.tabs.onRemoved.addListener(onRemoved); | 288 browser.tabs.onRemoved.addListener(onRemoved); |
| 289 | 289 |
| 290 if (require("info").application == "firefox" && | 290 if (info.application == "firefox" && navigator.oscpu.startsWith("Linux")) |
| 291 navigator.oscpu.startsWith("Linux")) | |
| 292 { | 291 { |
| 293 // Work around https://bugzil.la/1408446 | 292 // Work around https://bugzil.la/1408446 |
| 294 browser.windows.update(window.id, {width: window.width + 1}); | 293 browser.windows.update(window.id, {width: window.width + 1}); |
| 295 } | 294 } |
| 296 return popupPageId; | 295 return popupPageId; |
| 297 }); | 296 }); |
| 298 }); | 297 }); |
| 299 | 298 |
| 300 port.on("composer.getFilters", (message, sender) => | 299 port.on("composer.getFilters", (message, sender) => |
| 301 { | 300 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 318 // When tabs start loading we send them a message to ensure that the state | 317 // When tabs start loading we send them a message to ensure that the state |
| 319 // of the "block element" tool is reset. This is necessary since Firefox will | 318 // of the "block element" tool is reset. This is necessary since Firefox will |
| 320 // sometimes cache the state of a tab when the user navigates back / forward, | 319 // sometimes cache the state of a tab when the user navigates back / forward, |
| 321 // which includes the state of the "block element" tool. | 320 // which includes the state of the "block element" tool. |
| 322 // Since sending this message will often fail (e.g. for new tabs which have | 321 // Since sending this message will often fail (e.g. for new tabs which have |
| 323 // just been opened) we catch and ignore any exception thrown. | 322 // just been opened) we catch and ignore any exception thrown. |
| 324 browser.tabs.sendMessage( | 323 browser.tabs.sendMessage( |
| 325 page.id, {type: "composer.content.finished"} | 324 page.id, {type: "composer.content.finished"} |
| 326 ).catch(() => {}); | 325 ).catch(() => {}); |
| 327 }); | 326 }); |
| OLD | NEW |