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

Side by Side Diff: lib/requestBlocker.js

Issue 29522656: Issue 5316 - Adds supported filter types export value to requestBlocker (Closed)
Patch Set: Created Aug. 21, 2017, 3:28 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 | « no previous file | 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-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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 yield ["sub_frame", "SUBDOCUMENT"]; 46 yield ["sub_frame", "SUBDOCUMENT"];
47 47
48 // Treat navigator.sendBeacon() the same as <a ping>, it's essentially the 48 // Treat navigator.sendBeacon() the same as <a ping>, it's essentially the
49 // same concept - merely generalized. 49 // same concept - merely generalized.
50 yield ["beacon", "PING"]; 50 yield ["beacon", "PING"];
51 51
52 // Treat <img srcset> and <picture> the same as other images. 52 // Treat <img srcset> and <picture> the same as other images.
53 yield ["imageset", "IMAGE"]; 53 yield ["imageset", "IMAGE"];
54 }()); 54 }());
55 55
56 // Expose supported resource types for devtools panel
Jon Sonesen 2017/08/21 15:33:07 I think this comment could be improved but not sur
Sebastian Noack 2017/08/22 09:47:28 Yeah, I'd rather just remove that comment.
Jon Sonesen 2017/09/01 08:09:06 Acknowledged.
57 exports.filterTypes = new Set(function*()
58 {
59 for (let type in chrome.webRequest.ResourceType)
Sebastian Noack 2017/08/22 09:47:28 webRequest.ResourceType doesn't exist in Microsoft
Jon Sonesen 2017/09/01 08:09:06 Cool, can I just return if !(chrome.webRequest.Res
Sebastian Noack 2017/09/05 18:08:10 Yes, that will do.
60 yield resourceTypes.get(chrome.webRequest.ResourceType[type]) || "OTHER";
Sebastian Noack 2017/08/22 09:47:28 There are some filter types which we need to hard-
Jon Sonesen 2017/09/01 08:09:06 Cool, does it make sense to just add yields with e
Sebastian Noack 2017/09/05 18:08:10 Yes, I think this is the simplest approach.
61 }());
62
56 function onBeforeRequestAsync(page, url, type, docDomain, 63 function onBeforeRequestAsync(page, url, type, docDomain,
57 thirdParty, sitekey, 64 thirdParty, sitekey,
58 specificOnly, filter) 65 specificOnly, filter)
59 { 66 {
60 if (filter) 67 if (filter)
61 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page); 68 FilterNotifier.emit("filter.hitCount", filter, 0, 0, page);
62 69
63 if (devtools) 70 if (devtools)
64 { 71 {
65 devtools.logRequest( 72 devtools.logRequest(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return false; 204 return false;
198 } 205 }
199 206
200 return ext.webRequest.onBeforeRequest._dispatch( 207 return ext.webRequest.onBeforeRequest._dispatch(
201 new URL(msg.url), 208 new URL(msg.url),
202 msg.requestType, 209 msg.requestType,
203 sender.page, 210 sender.page,
204 sender.frame 211 sender.frame
205 ).includes(false); 212 ).includes(false);
206 }); 213 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld