Index: lib/whitelisting.js |
=================================================================== |
--- a/lib/whitelisting.js |
+++ b/lib/whitelisting.js |
@@ -1,6 +1,6 @@ |
/* |
* This file is part of Adblock Plus <https://adblockplus.org/>, |
- * Copyright (C) 2006-2016 Eyeo GmbH |
+ * Copyright (C) 2006-2017 eyeo GmbH |
* |
* Adblock Plus is free software: you can redistribute it and/or modify |
* it under the terms of the GNU General Public License version 3 as |
@@ -21,7 +21,6 @@ |
const {defaultMatcher} = require("matcher"); |
const {RegExpFilter} = require("filterClasses"); |
-const {DownloadableSubscription} = require("subscriptionClasses"); |
const {FilterNotifier} = require("filterNotifier"); |
const {stringifyURL, getDecodedHostname, |
extractHostFromFrame, isThirdParty} = require("url"); |
@@ -44,9 +43,11 @@ |
); |
if (filter && devtools) |
+ { |
devtools.logWhitelistedDocument( |
page, urlString, typeMask, docDomain, filter |
); |
+ } |
return filter; |
} |
@@ -72,7 +73,7 @@ |
while (frame && !filter) |
{ |
- let parent = frame.parent; |
+ let {parent} = frame; |
let docDomain = extractHostFromFrame(parent); |
let sitekey = getKey(page, frame); |
@@ -127,7 +128,7 @@ |
for (; frame != null; frame = frame.parent) |
{ |
- let key = keys[stringifyURL(frame.url)]; |
+ let key = keys.get(stringifyURL(frame.url)); |
if (key) |
return key; |
} |
@@ -157,10 +158,10 @@ |
let keys = sitekeys.get(page); |
if (!keys) |
{ |
- keys = Object.create(null); |
+ keys = new Map(); |
sitekeys.set(page, keys); |
} |
- keys[stringifyURL(url)] = key; |
+ keys.set(stringifyURL(url), key); |
} |
port.on("filters.addKey", (message, sender) => |
@@ -182,11 +183,6 @@ |
let key = checkKey(header.value, url); |
if (key) |
{ |
- // For pre-rendered tabs we don't know for sure the navigation is going |
- // to happen until the onCommitted event fires. Unfortunately if we want |
- // sitekey whitelisting to work for requests made before onCommitted has |
- // been fired we must update the page structure now anyway. |
- ext._updatePageFrameStructure(details.frameId, details.tabId, details.url, true); |
recordKey(key, page, url); |
break; |
} |
@@ -195,6 +191,7 @@ |
} |
if (typeof chrome == "object") |
+{ |
chrome.webRequest.onHeadersReceived.addListener( |
onHeadersReceived, |
{ |
@@ -203,3 +200,4 @@ |
}, |
["responseHeaders"] |
); |
+} |