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

Side by Side Diff: lib/whitelisting.js

Issue 29339020: Issue 3868 - Use the new FilterNotifier API (Closed)
Patch Set: Created March 23, 2016, 8:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/subscriptionInit.js ('k') | metadata.common » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return match(page, page.url, typeMask); 84 return match(page, page.url, typeMask);
85 }; 85 };
86 86
87 port.on("filters.isPageWhitelisted", (message, sender) => 87 port.on("filters.isPageWhitelisted", (message, sender) =>
88 { 88 {
89 return !!checkWhitelisted(sender.page); 89 return !!checkWhitelisted(sender.page);
90 }); 90 });
91 91
92 function revalidateWhitelistingState(page) 92 function revalidateWhitelistingState(page)
93 { 93 {
94 FilterNotifier.triggerListeners( 94 FilterNotifier.emit(
95 "page.WhitelistingStateRevalidate", 95 "page.WhitelistingStateRevalidate",
96 page, checkWhitelisted(page) 96 page, checkWhitelisted(page)
97 ); 97 );
98 } 98 }
99 99
100 FilterNotifier.addListener(action => 100 FilterNotifier.on("filter.behaviorChanged", () =>
101 { 101 {
102 if (action == "filter.behaviorChanged") 102 ext.pages.query({}, pages =>
103 ext.pages.query({}, pages => 103 {
104 { 104 for (let page of pages)
105 for (let page of pages) 105 revalidateWhitelistingState(page);
106 revalidateWhitelistingState(page); 106 });
107 });
108 }); 107 });
109 108
110 ext.pages.onLoading.addListener(revalidateWhitelistingState); 109 ext.pages.onLoading.addListener(revalidateWhitelistingState);
111 110
112 let getKey = 111 let getKey =
113 /** 112 /**
114 * Gets the public key, previously recorded for the given page 113 * Gets the public key, previously recorded for the given page
115 * and frame, to be considered for the $sitekey filter option. 114 * and frame, to be considered for the $sitekey filter option.
116 * 115 *
117 * @param {Page} page 116 * @param {Page} page
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 172
174 if (typeof chrome == "object") 173 if (typeof chrome == "object")
175 chrome.webRequest.onHeadersReceived.addListener( 174 chrome.webRequest.onHeadersReceived.addListener(
176 onHeadersReceived, 175 onHeadersReceived,
177 { 176 {
178 urls: ["http://*/*", "https://*/*"], 177 urls: ["http://*/*", "https://*/*"],
179 types: ["main_frame", "sub_frame"] 178 types: ["main_frame", "sub_frame"]
180 }, 179 },
181 ["responseHeaders"] 180 ["responseHeaders"]
182 ); 181 );
OLDNEW
« no previous file with comments | « lib/subscriptionInit.js ('k') | metadata.common » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld