Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 "use strict"; | 18 "use strict"; |
19 | 19 |
20 // Before Chrome 58, the webRequest API did not intercept WebSocket | 20 // The webRequest API doesn't support WebSocket connection blocking in Microsoft |
kzar
2017/06/22 11:23:38
Maybe reword something like this?
The webRequest
Oleksandr
2017/06/22 13:34:59
Done.
| |
21 // connections (see https://crbug.com/129353). Hence we inject CSP headers, | 21 // Edge and versions of Chrome before 58. Therefore for those we inject CSP |
22 // below, as a workaround. Edge does not intercept WebSocket requests either: | 22 // headers below as a workaround. See https://crbug.com/129353 and |
23 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10297376 / | 23 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10297376 / |
24 if (!chrome.webRequest.ResourceType || | 24 if (!chrome.webRequest.ResourceType || |
25 !("WEBSOCKET" in chrome.webRequest.ResourceType)) | 25 !("WEBSOCKET" in chrome.webRequest.ResourceType)) |
26 { | 26 { |
27 const {defaultMatcher} = require("matcher"); | 27 const {defaultMatcher} = require("matcher"); |
28 const {BlockingFilter, RegExpFilter} = require("filterClasses"); | 28 const {BlockingFilter, RegExpFilter} = require("filterClasses"); |
29 const {getDecodedHostname} = require("url"); | 29 const {getDecodedHostname} = require("url"); |
30 const {checkWhitelisted} = require("whitelisting"); | 30 const {checkWhitelisted} = require("whitelisting"); |
31 | 31 |
32 chrome.webRequest.onHeadersReceived.addListener(details => | 32 chrome.webRequest.onHeadersReceived.addListener(details => |
33 { | 33 { |
(...skipping 26 matching lines...) Expand all Loading... | |
60 } | 60 } |
61 }, { | 61 }, { |
62 urls: ["http://*/*", "https://*/*"], | 62 urls: ["http://*/*", "https://*/*"], |
63 // We must also intercept script requests since otherwise Web Workers can | 63 // We must also intercept script requests since otherwise Web Workers can |
64 // be abused to execute scripts for which our Content Security Policy | 64 // be abused to execute scripts for which our Content Security Policy |
65 // won't be injected. | 65 // won't be injected. |
66 // https://github.com/gorhill/uBO-Extra/issues/19 | 66 // https://github.com/gorhill/uBO-Extra/issues/19 |
67 types: ["main_frame", "sub_frame", "script"] | 67 types: ["main_frame", "sub_frame", "script"] |
68 }, ["blocking", "responseHeaders"]); | 68 }, ["blocking", "responseHeaders"]); |
69 } | 69 } |
LEFT | RIGHT |