Index: lib/whitelisting.js |
=================================================================== |
--- a/lib/whitelisting.js |
+++ b/lib/whitelisting.js |
@@ -21,6 +21,8 @@ |
let {defaultMatcher} = require("matcher"); |
let {RegExpFilter} = require("filterClasses"); |
+let {DownloadableSubscription} = require("subscriptionClasses"); |
+let {FilterNotifier} = require("filterNotifier"); |
let {stringifyURL, getDecodedHostname, extractHostFromFrame, isThirdParty} = require("url"); |
let {port} = require("messaging"); |
let devtools = require("devtools"); |
@@ -82,6 +84,44 @@ |
return match(page, page.url, typeMask); |
}; |
+function revalidateWhitelistingState(page) |
+{ |
+ FilterNotifier.triggerListeners( |
+ "page.WhitelistingStateRevalidate", |
+ page, checkWhitelisted(page) |
+ ); |
+} |
+ |
+let revalidating = false; |
+FilterNotifier.addListener((action, arg) => |
+{ |
+ switch (action) |
+ { |
+ case "subscription.added": |
+ if (arg instanceof DownloadableSubscription && !arg.lastDownload) |
+ break; |
+ case "subscription.removed": |
+ case "subscription.disabled": |
+ case "subscription.updated": |
+ case "filter.added": |
+ case "filter.removed": |
+ case "filter.disabled": |
+ case "load": |
+ if (!revalidating) |
+ { |
+ revalidating = true; |
+ ext.pages.query({}, pages => |
+ { |
+ revalidating = false; |
+ for (let page of pages) |
+ revalidateWhitelistingState(page); |
+ }); |
+ } |
+ } |
+}); |
+ |
+ext.pages.onLoading.addListener(revalidateWhitelistingState); |
+ |
let getKey = |
/** |
* Gets the public key, previously recorded for the given page |