Index: lib/requestBlocker.js |
=================================================================== |
--- a/lib/requestBlocker.js |
+++ b/lib/requestBlocker.js |
@@ -48,16 +48,34 @@ |
// 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) |
Sebastian Noack
2017/09/06 18:06:48
The code looks a little squashed. Perhaps add a bl
Jon Sonesen
2017/09/07 08:10:04
Done.
|
+ yield resourceTypes.get(chrome.webRequest.ResourceType[type]) || "OTHER"; |
+ // WEBSOCKET and WEBRTC get addressed through workarounds, even if webRequest |
Sebastian Noack
2017/09/06 18:06:48
Perhaps also add a blank line here?
Sebastian Noack
2017/09/06 18:06:48
"webrequest" => "the webRequest API"
Jon Sonesen
2017/09/07 08:10:04
Done.
|
+ // 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 |
Sebastian Noack
2017/09/06 18:06:49
Perhaps also add a blank line here?
Jon Sonesen
2017/09/07 08:10:04
Done.
|
+ // 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) |