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

Unified Diff: lib/requestBlocker.js

Issue 29445639: Noissue - Use lowercase for WebRTC and WebSocket resource types (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created May 22, 2017, 2:40 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 | « no previous file | 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
@@ -33,26 +33,26 @@
// OBJECT_SUBREQUEST and OBJECT requests.
RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
// Map of content types reported by the browser to the respecitve content types
// used by Adblock Plus. Other content types are simply mapped to OTHER.
let resourceTypes = new Map(function*()
{
for (let type in RegExpFilter.typeMap)
- yield [type.toLowerCase(), type];
+ yield [type, type];
- yield ["sub_frame", "SUBDOCUMENT"];
+ yield ["SUB_FRAME", "SUBDOCUMENT"];
// Treat navigator.sendBeacon() the same as <a ping>, it's essentially the
// same concept - merely generalized.
- yield ["beacon", "PING"];
+ yield ["BEACON", "PING"];
// Treat <img srcset> and <picture> the same as other images.
- yield ["imageset", "IMAGE"];
+ yield ["IMAGESET", "IMAGE"];
}());
function onBeforeRequestAsync(page, url, type, docDomain,
thirdParty, sitekey,
specificOnly, filter)
{
if (filter)
FilterNotifier.emit("filter.hitCount", filter, 0, 0, page);
@@ -76,17 +76,17 @@
let docDomain = extractHostFromFrame(frame);
let thirdParty = isThirdParty(url, docDomain);
let sitekey = getKey(page, frame);
let specificOnly = !!checkWhitelisted(
page, frame, RegExpFilter.typeMap.GENERICBLOCK
);
- let mappedType = resourceTypes.get(type) || "OTHER";
+ let mappedType = resourceTypes.get(type.toUpperCase()) || "OTHER";
let filter = defaultMatcher.matchesAny(
urlString, RegExpFilter.typeMap[mappedType],
docDomain, thirdParty, sitekey, specificOnly
);
setTimeout(onBeforeRequestAsync, 0, page, urlString,
mappedType, docDomain,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld