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 contentFiltering */ | 18 /** @module contentFiltering */ |
19 | 19 |
20 "use strict"; | 20 "use strict"; |
21 | 21 |
22 const {RegExpFilter} = require("../adblockpluscore/lib/filterClasses"); | 22 const {RegExpFilter} = require("../adblockpluscore/lib/filterClasses"); |
23 const {ElemHide} = require("../adblockpluscore/lib/elemHide"); | 23 const {ElemHide} = require("../adblockpluscore/lib/elemHide"); |
24 const {ElemHideEmulation} = require("../adblockpluscore/lib/elemHideEmulation"); | 24 const {ElemHideEmulation} = require("../adblockpluscore/lib/elemHideEmulation"); |
25 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier"); | 25 const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier"); |
26 const {Snippets, compileScript} = require("../adblockpluscore/lib/snippets"); | 26 const {Snippets, compileScript} = require("../adblockpluscore/lib/snippets"); |
27 const {checkWhitelisted} = require("./whitelisting"); | 27 const {checkWhitelisted} = require("./whitelisting"); |
28 const {extractHostFromFrame} = require("./url"); | 28 const {extractHostFromFrame} = require("./url"); |
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. |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 let docDomain = extractHostFromFrame(sender.frame); | 233 let docDomain = extractHostFromFrame(sender.frame); |
234 | 234 |
235 if (snippets) | 235 if (snippets) |
236 { | 236 { |
237 for (let filter of Snippets.getFiltersForDomain(docDomain)) | 237 for (let filter of Snippets.getFiltersForDomain(docDomain)) |
238 { | 238 { |
239 executeScript(filter.script, sender.page.id, sender.frame.id).then(() => | 239 executeScript(filter.script, sender.page.id, sender.frame.id).then(() => |
240 { | 240 { |
241 let tabIds = [sender.page.id]; | 241 let tabIds = [sender.page.id]; |
242 if (filter) | 242 if (filter) |
243 FilterNotifier.emit("filter.hitCount", filter, 0, 0, tabIds); | 243 filterNotifier.emit("filter.hitCount", filter, 0, 0, tabIds); |
244 | 244 |
245 logRequest(tabIds, { | 245 logRequest(tabIds, { |
246 url: sender.frame.url.href, | 246 url: sender.frame.url.href, |
247 type: "SNIPPET", | 247 type: "SNIPPET", |
248 docDomain | 248 docDomain |
249 }, filter); | 249 }, filter); |
250 }); | 250 }); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, | 288 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, |
289 message.groupName, message.appendOnly); | 289 message.groupName, message.appendOnly); |
290 }); | 290 }); |
291 | 291 |
292 fetch(browser.extension.getURL("/snippets.js"), {cache: "no-cache"}) | 292 fetch(browser.extension.getURL("/snippets.js"), {cache: "no-cache"}) |
293 .then(response => response.ok ? response.text() : "") | 293 .then(response => response.ok ? response.text() : "") |
294 .then(text => | 294 .then(text => |
295 { | 295 { |
296 snippetsLibrarySource = text; | 296 snippetsLibrarySource = text; |
297 }); | 297 }); |
OLD | NEW |