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

Side by Side Diff: lib/requestBlocker.js

Issue 29680696: [$csp4 adblockpluschrome] Issue 5241 - Add support for Content Security Policy filters (Closed)
Patch Set: Rebased Created March 26, 2018, 6:22 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/devtools.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // WEBRTC gets addressed through a workaround, even if the webRequest API is 66 // WEBRTC gets addressed through a workaround, even if the webRequest API is
67 // lacking support to block this kind of a request. 67 // lacking support to block this kind of a request.
68 yield "WEBRTC"; 68 yield "WEBRTC";
69 69
70 // POPUP and ELEMHIDE filters aren't blocked on the request level but by other 70 // POPUP, CSP and ELEMHIDE filters aren't mapped to resource types.
71 // means. They don't have a corresponding value in webRequest.ResourceType.
72 yield "POPUP"; 71 yield "POPUP";
73 yield "ELEMHIDE"; 72 yield "ELEMHIDE";
73 yield "CSP";
74 }()); 74 }());
75 75
76 function onBeforeRequestAsync(page, url, type, docDomain, 76 function onBeforeRequestAsync(page, url, type, docDomain,
77 thirdParty, sitekey, 77 thirdParty, sitekey,
78 specificOnly, filter) 78 specificOnly, filter)
79 { 79 {
80 if (filter) 80 if (filter)
81 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page); 81 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page);
82 82
83 if (devtools) 83 if (devtools)
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 port.on("request.blockedByRTCWrapper", (msg, sender) => 207 port.on("request.blockedByRTCWrapper", (msg, sender) =>
208 { 208 {
209 return ext.webRequest.onBeforeRequest._dispatch( 209 return ext.webRequest.onBeforeRequest._dispatch(
210 new URL(msg.url), 210 new URL(msg.url),
211 "webrtc", 211 "webrtc",
212 sender.page, 212 sender.page,
213 sender.frame 213 sender.frame
214 ).includes(false); 214 ).includes(false);
215 }); 215 });
OLDNEW
« no previous file with comments | « lib/devtools.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld