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: Addressed some final nits Created March 20, 2018, 9:01 a.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') | metadata.chrome » ('j') | 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // WEBSOCKET and WEBRTC get addressed through workarounds, even if the
67 // webRequest API is lacking support to block these kind of requests. 67 // webRequest API is lacking support to block these kind of requests.
68 yield "WEBSOCKET"; 68 yield "WEBSOCKET";
69 yield "WEBRTC"; 69 yield "WEBRTC";
70 70
71 // POPUP and ELEMHIDE filters aren't blocked on the request level but by other 71 // POPUP, CSP and ELEMHIDE filters aren't mapped to resource types.
72 // means. They don't have a corresponding value in webRequest.ResourceType.
73 yield "POPUP"; 72 yield "POPUP";
74 yield "ELEMHIDE"; 73 yield "ELEMHIDE";
74 yield "CSP";
75 }()); 75 }());
76 76
77 function onBeforeRequestAsync(page, url, type, docDomain, 77 function onBeforeRequestAsync(page, url, type, docDomain,
78 thirdParty, sitekey, 78 thirdParty, sitekey,
79 specificOnly, filter) 79 specificOnly, filter)
80 { 80 {
81 if (filter) 81 if (filter)
82 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page); 82 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page);
83 83
84 if (devtools) 84 if (devtools)
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return false; 218 return false;
219 } 219 }
220 220
221 return ext.webRequest.onBeforeRequest._dispatch( 221 return ext.webRequest.onBeforeRequest._dispatch(
222 new URL(msg.url), 222 new URL(msg.url),
223 msg.requestType, 223 msg.requestType,
224 sender.page, 224 sender.page,
225 sender.frame 225 sender.frame
226 ).includes(false); 226 ).includes(false);
227 }); 227 });
OLDNEW
« no previous file with comments | « lib/devtools.js ('k') | metadata.chrome » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld