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 10 matching lines...) Expand all Loading... |
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 {Prefs} = require("./prefs"); | 27 const {Prefs} = require("./prefs"); |
28 const {checkWhitelisted, getKey} = require("./whitelisting"); | 28 const {checkWhitelisted, getKey} = require("./whitelisting"); |
29 const {stringifyURL, extractHostFromFrame, isThirdParty} = require("./url"); | 29 const {stringifyURL, extractHostFromFrame, isThirdParty} = require("./url"); |
30 const {port} = require("./messaging"); | 30 const {port} = require("./messaging"); |
31 const devtools = require("./devtools"); | 31 const {logRequest: hitLoggerLogRequest} = require("./hitLogger"); |
32 | 32 |
33 const extensionProtocol = new URL(browser.extension.getURL("")).protocol; | 33 const extensionProtocol = new URL(browser.extension.getURL("")).protocol; |
34 | 34 |
35 // Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests. | 35 // Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests. |
36 if (!browser.webRequest.ResourceType || | 36 if (!browser.webRequest.ResourceType || |
37 !("OBJECT_SUBREQUEST" in browser.webRequest.ResourceType)) | 37 !("OBJECT_SUBREQUEST" in browser.webRequest.ResourceType)) |
38 { | 38 { |
39 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; | 39 RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT; |
40 } | 40 } |
41 | 41 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 return browser.tabs.query({url}).then(tabs => tabs.map(tab => tab.id)); | 122 return browser.tabs.query({url}).then(tabs => tabs.map(tab => tab.id)); |
123 } | 123 } |
124 | 124 |
125 function logRequest(tabIds, url, type, docDomain, thirdParty, | 125 function logRequest(tabIds, url, type, docDomain, thirdParty, |
126 sitekey, specificOnly, filter) | 126 sitekey, specificOnly, filter) |
127 { | 127 { |
128 if (filter) | 128 if (filter) |
129 FilterNotifier.emit("filter.hitCount", filter, 0, 0, tabIds); | 129 FilterNotifier.emit("filter.hitCount", filter, 0, 0, tabIds); |
130 | 130 |
131 devtools.logRequest( | 131 hitLoggerLogRequest( |
132 tabIds, url, type, docDomain, | 132 tabIds, url, type, docDomain, |
133 thirdParty, sitekey, | 133 thirdParty, sitekey, |
134 specificOnly, filter | 134 specificOnly, filter |
135 ); | 135 ); |
136 } | 136 } |
137 | 137 |
138 browser.webRequest.onBeforeRequest.addListener(details => | 138 browser.webRequest.onBeforeRequest.addListener(details => |
139 { | 139 { |
140 // Never block top-level documents. | 140 // Never block top-level documents. |
141 if (details.type == "main_frame") | 141 if (details.type == "main_frame") |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } | 309 } |
310 | 310 |
311 FilterNotifier.on("subscription.added", onFilterChange); | 311 FilterNotifier.on("subscription.added", onFilterChange); |
312 FilterNotifier.on("subscription.removed", onFilterChange); | 312 FilterNotifier.on("subscription.removed", onFilterChange); |
313 FilterNotifier.on("subscription.updated", onFilterChange); | 313 FilterNotifier.on("subscription.updated", onFilterChange); |
314 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); | 314 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); |
315 FilterNotifier.on("filter.added", onFilterChange); | 315 FilterNotifier.on("filter.added", onFilterChange); |
316 FilterNotifier.on("filter.removed", onFilterChange); | 316 FilterNotifier.on("filter.removed", onFilterChange); |
317 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); | 317 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); |
318 FilterNotifier.on("load", onFilterChange); | 318 FilterNotifier.on("load", onFilterChange); |
OLD | NEW |