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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (!inline && !updateFrameStyles(sender.page.id, sender.frame.id, | 243 if (!inline && !updateFrameStyles(sender.page.id, sender.frame.id, |
244 selectors, "standard")) | 244 selectors, "standard")) |
245 { | 245 { |
246 inline = true; | 246 inline = true; |
247 } | 247 } |
248 | 248 |
249 let response = {trace, inline, emulatedPatterns}; | 249 let response = {trace, inline, emulatedPatterns}; |
250 if (trace || inline) | 250 if (trace || inline) |
251 response.selectors = selectors; | 251 response.selectors = selectors; |
252 | 252 |
253 // If we can't remove user style sheets using tabs.removeCSS, we'll only keep | |
254 // adding them, which could cause problems with emulation filters as | |
255 // described in issue #5864. Instead, we can just ask the content script to | |
256 // add styles for emulation filters inline. | |
257 if (!styleSheetRemovalSupported) | |
258 response.inlineEmulated = true; | |
259 | |
260 return response; | 253 return response; |
261 }); | 254 }); |
262 | 255 |
263 port.on("elemhide.injectSelectors", (message, sender) => | 256 port.on("elemhide.injectSelectors", (message, sender) => |
264 { | 257 { |
265 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, | 258 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, |
266 message.groupName, message.appendOnly); | 259 message.groupName, message.appendOnly); |
267 }); | 260 }); |
268 | 261 |
269 fetch(browser.extension.getURL("/snippets.js"), {cache: "no-cache"}) | 262 fetch(browser.extension.getURL("/snippets.js"), {cache: "no-cache"}) |
270 .then(response => response.ok ? response.text() : "") | 263 .then(response => response.ok ? response.text() : "") |
271 .then(text => | 264 .then(text => |
272 { | 265 { |
273 snippetsLibrarySource = text; | 266 snippetsLibrarySource = text; |
274 }); | 267 }); |
OLD | NEW |