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 requestBlocker */ | 18 /** @module requestBlocker */ |
19 | 19 |
20 "use strict"; | 20 "use strict"; |
21 | 21 |
22 const {Filter, RegExpFilter, BlockingFilter} = | 22 const {Filter, RegExpFilter, BlockingFilter} = |
23 require("../adblockpluscore/lib/filterClasses"); | 23 require("../adblockpluscore/lib/filterClasses"); |
24 const {Subscription} = require("../adblockpluscore/lib/subscriptionClasses"); | 24 const {Subscription} = require("../adblockpluscore/lib/subscriptionClasses"); |
25 const {defaultMatcher} = require("../adblockpluscore/lib/matcher"); | 25 const {defaultMatcher} = require("../adblockpluscore/lib/matcher"); |
26 const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier"); | 26 const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier"); |
| 27 const {isThirdParty} = require("../adblockpluscore/lib/domain"); |
27 const {Prefs} = require("./prefs"); | 28 const {Prefs} = require("./prefs"); |
28 const {checkWhitelisted, getKey} = require("./whitelisting"); | 29 const {checkWhitelisted, getKey} = require("./whitelisting"); |
29 const {extractHostFromFrame, isThirdParty} = require("./url"); | 30 const {extractHostFromFrame} = require("./url"); |
30 const {port} = require("./messaging"); | 31 const {port} = require("./messaging"); |
31 const {logRequest: hitLoggerLogRequest} = require("./hitLogger"); | 32 const {logRequest: hitLoggerLogRequest} = require("./hitLogger"); |
32 | 33 |
33 const extensionProtocol = new URL(browser.extension.getURL("")).protocol; | 34 const extensionProtocol = new URL(browser.extension.getURL("")).protocol; |
34 | 35 |
35 // Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests. | 36 // Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests. |
36 if (!browser.webRequest.ResourceType || | 37 if (!browser.webRequest.ResourceType || |
37 !("OBJECT_SUBREQUEST" in browser.webRequest.ResourceType)) | 38 !("OBJECT_SUBREQUEST" in browser.webRequest.ResourceType)) |
38 { | 39 { |
39 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; | 40 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 330 } |
330 | 331 |
331 filterNotifier.on("subscription.added", onFilterChange); | 332 filterNotifier.on("subscription.added", onFilterChange); |
332 filterNotifier.on("subscription.removed", arg => onFilterChange(arg, false)); | 333 filterNotifier.on("subscription.removed", arg => onFilterChange(arg, false)); |
333 filterNotifier.on("subscription.updated", onFilterChange); | 334 filterNotifier.on("subscription.updated", onFilterChange); |
334 filterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); | 335 filterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); |
335 filterNotifier.on("filter.added", onFilterChange); | 336 filterNotifier.on("filter.added", onFilterChange); |
336 filterNotifier.on("filter.removed", onFilterChange); | 337 filterNotifier.on("filter.removed", onFilterChange); |
337 filterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); | 338 filterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); |
338 filterNotifier.on("load", onFilterChange); | 339 filterNotifier.on("load", onFilterChange); |
OLD | NEW |