Index: lib/requestBlocker.js |
=================================================================== |
--- a/lib/requestBlocker.js |
+++ b/lib/requestBlocker.js |
@@ -46,27 +46,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; |
+ 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 |
); |
+ } |
+ |
+ |
let filter = defaultMatcher.matchesAny( |
urlString, RegExpFilter.typeMap[type], |
docDomain, thirdParty, sitekey, specificOnly |
); |
setTimeout(onBeforeRequestAsync, 0, page, urlString, |
type, docDomain, |