| 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 cssInjection */ | 18 /** @module cssInjection */ | 
| 19 | 19 | 
| 20 "use strict"; | 20 "use strict"; | 
| 21 | 21 | 
| 22 const {RegExpFilter} = require("filterClasses"); | 22 const {RegExpFilter} = require("filterClasses"); | 
| 23 const {ElemHide} = require("elemHide"); | 23 const {ElemHide} = require("elemHide"); | 
| 24 const {ElemHideEmulation} = require("elemHideEmulation"); | 24 const {ElemHideEmulation} = require("elemHideEmulation"); | 
| 25 const {checkWhitelisted} = require("whitelisting"); | 25 const {checkWhitelisted} = require("whitelisting"); | 
| 26 const {extractHostFromFrame} = require("url"); | 26 const {extractHostFromFrame} = require("url"); | 
| 27 const {port} = require("messaging"); | 27 const {port} = require("messaging"); | 
| 28 const devtools = require("devtools"); | 28 const {DevLogger} = require("devLogger"); | 
| 29 const info = require("info"); | 29 const info = require("info"); | 
| 30 | 30 | 
| 31 // Chromium's support for tabs.removeCSS is still a work in progress and the | 31 // Chromium's support for tabs.removeCSS is still a work in progress and the | 
| 32 // API is likely to be different from Firefox's; for now we just don't use it | 32 // API is likely to be different from Firefox's; for now we just don't use it | 
| 33 // at all, even if it's available. | 33 // at all, even if it's available. | 
| 34 // See https://crbug.com/608854 | 34 // See https://crbug.com/608854 | 
| 35 const styleSheetRemovalSupported = info.platform == "gecko"; | 35 const styleSheetRemovalSupported = info.platform == "gecko"; | 
| 36 | 36 | 
| 37 const selectorGroupSize = 1024; | 37 const selectorGroupSize = 1024; | 
| 38 | 38 | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 131     removeStyleSheet(tabId, frameId, oldStyleSheet); | 131     removeStyleSheet(tabId, frameId, oldStyleSheet); | 
| 132 | 132 | 
| 133   frame.injectedStyleSheets.set(groupName, styleSheet); | 133   frame.injectedStyleSheets.set(groupName, styleSheet); | 
| 134   return true; | 134   return true; | 
| 135 } | 135 } | 
| 136 | 136 | 
| 137 port.on("elemhide.getSelectors", (message, sender) => | 137 port.on("elemhide.getSelectors", (message, sender) => | 
| 138 { | 138 { | 
| 139   let selectors = []; | 139   let selectors = []; | 
| 140   let emulatedPatterns = []; | 140   let emulatedPatterns = []; | 
| 141   let trace = devtools && devtools.hasPanel(sender.page); | 141   let trace = DevLogger.listening(sender.page.id); | 
| 142   let inline = !userStyleSheetsSupported; | 142   let inline = !userStyleSheetsSupported; | 
| 143 | 143 | 
| 144   if (!checkWhitelisted(sender.page, sender.frame, | 144   if (!checkWhitelisted(sender.page, sender.frame, | 
| 145                         RegExpFilter.typeMap.DOCUMENT | | 145                         RegExpFilter.typeMap.DOCUMENT | | 
| 146                         RegExpFilter.typeMap.ELEMHIDE)) | 146                         RegExpFilter.typeMap.ELEMHIDE)) | 
| 147   { | 147   { | 
| 148     let hostname = extractHostFromFrame(sender.frame); | 148     let hostname = extractHostFromFrame(sender.frame); | 
| 149     let specificOnly = checkWhitelisted(sender.page, sender.frame, | 149     let specificOnly = checkWhitelisted(sender.page, sender.frame, | 
| 150                                         RegExpFilter.typeMap.GENERICHIDE); | 150                                         RegExpFilter.typeMap.GENERICHIDE); | 
| 151 | 151 | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 176     response.inlineEmulated = true; | 176     response.inlineEmulated = true; | 
| 177 | 177 | 
| 178   return response; | 178   return response; | 
| 179 }); | 179 }); | 
| 180 | 180 | 
| 181 port.on("elemhide.injectSelectors", (message, sender) => | 181 port.on("elemhide.injectSelectors", (message, sender) => | 
| 182 { | 182 { | 
| 183   updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, | 183   updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, | 
| 184                     message.groupName); | 184                     message.groupName); | 
| 185 }); | 185 }); | 
| OLD | NEW | 
|---|