| LEFT | RIGHT |
| 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 18 matching lines...) Expand all Loading... |
| 29 const {port} = require("./messaging"); | 29 const {port} = require("./messaging"); |
| 30 const {HitLogger, logRequest} = require("./hitLogger"); | 30 const {HitLogger, logRequest} = require("./hitLogger"); |
| 31 const info = require("info"); | 31 const info = require("info"); |
| 32 | 32 |
| 33 // Chromium's support for tabs.removeCSS is still a work in progress and the | 33 // Chromium's support for tabs.removeCSS is still a work in progress and the |
| 34 // API is likely to be different from Firefox's; for now we just don't use it | 34 // API is likely to be different from Firefox's; for now we just don't use it |
| 35 // at all, even if it's available. | 35 // at all, even if it's available. |
| 36 // See https://crbug.com/608854 | 36 // See https://crbug.com/608854 |
| 37 const styleSheetRemovalSupported = info.platform == "gecko"; | 37 const styleSheetRemovalSupported = info.platform == "gecko"; |
| 38 | 38 |
| 39 const selectorGroupSize = 1024; | |
| 40 | |
| 41 let userStyleSheetsSupported = true; | 39 let userStyleSheetsSupported = true; |
| 42 | 40 |
| 43 let snippetsLibrarySource = ""; | 41 let snippetsLibrarySource = ""; |
| 44 let executableCode = new Map(); | 42 let executableCode = new Map(); |
| 45 | 43 |
| 46 function addStyleSheet(tabId, frameId, styleSheet) | 44 function addStyleSheet(tabId, frameId, styleSheet) |
| 47 { | 45 { |
| 48 try | 46 try |
| 49 { | 47 { |
| 50 let promise = browser.tabs.insertCSS(tabId, { | 48 let promise = browser.tabs.insertCSS(tabId, { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 inline = true; | 244 inline = true; |
| 247 } | 245 } |
| 248 | 246 |
| 249 let response = {trace, inline, emulatedPatterns}; | 247 let response = {trace, inline, emulatedPatterns}; |
| 250 if (trace || inline) | 248 if (trace || inline) |
| 251 response.selectors = selectors; | 249 response.selectors = selectors; |
| 252 | 250 |
| 253 return response; | 251 return response; |
| 254 }); | 252 }); |
| 255 | 253 |
| 256 port.on("elemhide.injectSelectors", (message, sender) => | 254 port.on("content.injectSelectors", (message, sender) => |
| 257 { | 255 { |
| 258 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, | 256 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, |
| 259 message.groupName, message.appendOnly); | 257 message.groupName, message.appendOnly); |
| 260 }); | 258 }); |
| 261 | 259 |
| 262 fetch(browser.extension.getURL("/snippets.js"), {cache: "no-cache"}) | 260 fetch(browser.extension.getURL("/snippets.js"), {cache: "no-cache"}) |
| 263 .then(response => response.ok ? response.text() : "") | 261 .then(response => response.ok ? response.text() : "") |
| 264 .then(text => | 262 .then(text => |
| 265 { | 263 { |
| 266 snippetsLibrarySource = text; | 264 snippetsLibrarySource = text; |
| 267 }); | 265 }); |
| LEFT | RIGHT |