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