| 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("../adblockpluscore/lib/matcher"); | 22 const {defaultMatcher} = require("../adblockpluscore/lib/matcher"); | 
| 23 const {RegExpFilter} = require("../adblockpluscore/lib/filterClasses"); | 23 const {RegExpFilter} = require("../adblockpluscore/lib/filterClasses"); | 
| 24 const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier"); | 24 const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier"); | 
| 25 const {isThirdParty} = require("../adblockpluscore/lib/domain"); |  | 
| 26 const {Prefs} = require("./prefs"); | 25 const {Prefs} = require("./prefs"); | 
| 27 const {extractHostFromFrame} = require("./url"); | 26 const {extractHostFromFrame} = require("./url"); | 
| 28 const {getKey, checkWhitelisted} = require("./whitelisting"); | 27 const {getKey, checkWhitelisted} = require("./whitelisting"); | 
| 29 const {port} = require("./messaging"); | 28 const {port} = require("./messaging"); | 
| 30 const info = require("info"); | 29 const info = require("info"); | 
| 31 | 30 | 
| 32 function isValidString(s) | 31 function isValidString(s) | 
| 33 { | 32 { | 
| 34   return s && s.indexOf("\0") == -1; | 33   return s && s.indexOf("\0") == -1; | 
| 35 } | 34 } | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 86     let typeMask = RegExpFilter.typeMap[details.type]; | 85     let typeMask = RegExpFilter.typeMap[details.type]; | 
| 87     let docDomain = extractHostFromFrame(frame); | 86     let docDomain = extractHostFromFrame(frame); | 
| 88     let specificOnly = checkWhitelisted(page, frame, null, | 87     let specificOnly = checkWhitelisted(page, frame, null, | 
| 89                                         RegExpFilter.typeMap.GENERICBLOCK); | 88                                         RegExpFilter.typeMap.GENERICBLOCK); | 
| 90 | 89 | 
| 91     // Add a blocking filter for each URL of the element that can be blocked | 90     // Add a blocking filter for each URL of the element that can be blocked | 
| 92     for (let url of details.urls) | 91     for (let url of details.urls) | 
| 93     { | 92     { | 
| 94       let urlObj = new URL(url, details.baseURL); | 93       let urlObj = new URL(url, details.baseURL); | 
| 95       let whitelisted = defaultMatcher.isWhitelisted( | 94       let whitelisted = defaultMatcher.isWhitelisted( | 
| 96         urlObj.href, typeMask, docDomain, | 95         urlObj, typeMask, docDomain, | 
| 97         isThirdParty(urlObj, docDomain), |  | 
| 98         getKey(page, frame), specificOnly | 96         getKey(page, frame), specificOnly | 
| 99       ); | 97       ); | 
| 100 | 98 | 
| 101       if (!whitelisted) | 99       if (!whitelisted) | 
| 102       { | 100       { | 
| 103         let filterText = urlObj.href.replace(/^[\w-]+:\/+(?:www\.)?/, "||"); | 101         let filterText = urlObj.href.replace(/^[\w-]+:\/+(?:www\.)?/, "||"); | 
| 104 | 102 | 
| 105         if (specificOnly) | 103         if (specificOnly) | 
| 106           filterText += "$domain=" + docDomain; | 104           filterText += "$domain=" + docDomain; | 
| 107 | 105 | 
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 365 port.on("composer.isPageReady", (message, sender) => | 363 port.on("composer.isPageReady", (message, sender) => | 
| 366 { | 364 { | 
| 367   return readyActivePages.has(new ext.Page({id: message.pageId})); | 365   return readyActivePages.has(new ext.Page({id: message.pageId})); | 
| 368 }); | 366 }); | 
| 369 | 367 | 
| 370 port.on("composer.ready", (message, sender) => | 368 port.on("composer.ready", (message, sender) => | 
| 371 { | 369 { | 
| 372   readyActivePages.set(sender.page, !checkWhitelisted(sender.page)); | 370   readyActivePages.set(sender.page, !checkWhitelisted(sender.page)); | 
| 373   updateContextMenu(sender.page); | 371   updateContextMenu(sender.page); | 
| 374 }); | 372 }); | 
| OLD | NEW | 
|---|