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

Unified Diff: lib/requestBlocker.js

Issue 29522656: Issue 5316 - Adds supported filter types export value to requestBlocker (Closed)
Patch Set: update dependency file Created Sept. 19, 2017, 1:45 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dependencies ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/requestBlocker.js
===================================================================
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -48,16 +48,37 @@
// Treat navigator.sendBeacon() the same as <a ping>, it's essentially the
// same concept - merely generalized.
yield ["beacon", "PING"];
// Treat <img srcset> and <picture> the same as other images.
yield ["imageset", "IMAGE"];
}());
+exports.filterTypes = new Set(function*()
+{
+ // Microsoft Edge does not have webRequest.ResourceType or the devtools panel.
+ // Since filterTypes is only used by devtools, we can just bail out here.
+ if (!(chrome.webRequest.ResourceType))
+ return;
+
+ for (let type in chrome.webRequest.ResourceType)
+ yield resourceTypes.get(chrome.webRequest.ResourceType[type]) || "OTHER";
+
+ // WEBSOCKET and WEBRTC get addressed through workarounds, even if the
+ // webRequest API is lacking support to block these kind of requests.
+ yield "WEBSOCKET";
+ yield "WEBRTC";
+
+ // POPUP and ELEMHIDE filters aren't blocked on the request level but by other
+ // means. They don't have a corresponding value in webRequest.ResourceType.
+ yield "POPUP";
+ yield "ELEMHIDE";
+}());
+
function onBeforeRequestAsync(page, url, type, docDomain,
thirdParty, sitekey,
specificOnly, filter)
{
if (filter)
FilterNotifier.emit("filter.hitCount", filter, 0, 0, page);
if (devtools)
« no previous file with comments | « dependencies ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld