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

Unified Diff: lib/requestBlocker.js

Issue 29418679: Issue 5042 - Adds handling for requests which are not associated with browser tab (Closed)
Patch Set: rebase Created May 30, 2017, 9:04 a.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
« lib/devtools.js ('K') | « lib/devtools.js ('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
@@ -64,27 +64,37 @@
thirdParty, sitekey,
specificOnly, filter
);
}
}
ext.webRequest.onBeforeRequest.addListener((url, type, page, frame) =>
{
- if (checkWhitelisted(page, frame))
- return true;
+ let docDomain = null;
+ let sitekey = null;
+ let specificOnly = false;
Sebastian Noack 2017/05/30 11:10:49 Nit: The blank line above looks redundant, but ins
Jon Sonesen 2017/05/31 08:28:18 Acknowledged.
+ let thirdParty = false;
let urlString = stringifyURL(url);
- let docDomain = extractHostFromFrame(frame);
- let thirdParty = isThirdParty(url, docDomain);
- let sitekey = getKey(page, frame);
- let specificOnly = !!checkWhitelisted(
- page, frame, RegExpFilter.typeMap.GENERICBLOCK
+ if (frame && page)
+ {
+ if (checkWhitelisted(page, frame))
+ return true;
+
+ docDomain = extractHostFromFrame(frame);
+ sitekey = getKey(page, frame);
+ thirdParty = isThirdParty(url, docDomain);
+ specificOnly = !!checkWhitelisted(
+ page, frame, RegExpFilter.typeMap.GENERICBLOCK
);
Sebastian Noack 2017/05/30 11:10:49 Nit: You added one level off indentation to the co
Jon Sonesen 2017/05/31 08:28:18 I will do it as you suggest.
+ }
+
+
let mappedType = resourceTypes.get(type) || "OTHER";
let filter = defaultMatcher.matchesAny(
urlString, RegExpFilter.typeMap[mappedType],
docDomain, thirdParty, sitekey, specificOnly
);
« lib/devtools.js ('K') | « lib/devtools.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld