Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/requestBlocker.js

Issue 29721716: Issue 6473 - Remove WebSocket wrapper (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Created March 13, 2018, 4:33 p.m.
Right Patch Set: Address comments to Patch Set 1 Created March 13, 2018, 6:04 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « inject.preload.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 exports.filterTypes = new Set(function*() 56 exports.filterTypes = new Set(function*()
57 { 57 {
58 // Microsoft Edge does not have webRequest.ResourceType or the devtools panel. 58 // Microsoft Edge does not have webRequest.ResourceType or the devtools panel.
59 // Since filterTypes is only used by devtools, we can just bail out here. 59 // Since filterTypes is only used by devtools, we can just bail out here.
60 if (!(browser.webRequest.ResourceType)) 60 if (!(browser.webRequest.ResourceType))
61 return; 61 return;
62 62
63 for (let type in browser.webRequest.ResourceType) 63 for (let type in browser.webRequest.ResourceType)
64 yield resourceTypes.get(browser.webRequest.ResourceType[type]) || "OTHER"; 64 yield resourceTypes.get(browser.webRequest.ResourceType[type]) || "OTHER";
65 65
66 // WEBSOCKET and WEBRTC get addressed through workarounds, even if the 66 // WEBRTC gets addressed through a workaround, even if the webRequest API is
67 // webRequest API is lacking support to block these kind of requests. 67 // lacking support to block this kind of a request.
68 yield "WEBSOCKET";
69 yield "WEBRTC"; 68 yield "WEBRTC";
70 69
71 // POPUP and ELEMHIDE filters aren't blocked on the request level but by other 70 // POPUP and ELEMHIDE filters aren't blocked on the request level but by other
72 // means. They don't have a corresponding value in webRequest.ResourceType. 71 // means. They don't have a corresponding value in webRequest.ResourceType.
73 yield "POPUP"; 72 yield "POPUP";
74 yield "ELEMHIDE"; 73 yield "ELEMHIDE";
75 }()); 74 }());
76 75
77 function onBeforeRequestAsync(page, url, type, docDomain, 76 function onBeforeRequestAsync(page, url, type, docDomain,
78 thirdParty, sitekey, 77 thirdParty, sitekey,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 197
199 FilterNotifier.on("subscription.added", onFilterChange); 198 FilterNotifier.on("subscription.added", onFilterChange);
200 FilterNotifier.on("subscription.removed", onFilterChange); 199 FilterNotifier.on("subscription.removed", onFilterChange);
201 FilterNotifier.on("subscription.updated", onFilterChange); 200 FilterNotifier.on("subscription.updated", onFilterChange);
202 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true)); 201 FilterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true));
203 FilterNotifier.on("filter.added", onFilterChange); 202 FilterNotifier.on("filter.added", onFilterChange);
204 FilterNotifier.on("filter.removed", onFilterChange); 203 FilterNotifier.on("filter.removed", onFilterChange);
205 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true)); 204 FilterNotifier.on("filter.disabled", arg => onFilterChange(arg, true));
206 FilterNotifier.on("load", onFilterChange); 205 FilterNotifier.on("load", onFilterChange);
207 206
208 port.on("request.blockedByWrapper", (msg, sender) => 207 port.on("request.blockedByRTCWrapper", (msg, sender) =>
209 { 208 {
210 return ext.webRequest.onBeforeRequest._dispatch( 209 return ext.webRequest.onBeforeRequest._dispatch(
211 new URL(msg.url), 210 new URL(msg.url),
212 msg.requestType, 211 "webrtc",
213 sender.page, 212 sender.page,
214 sender.frame 213 sender.frame
215 ).includes(false); 214 ).includes(false);
216 }); 215 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld