LEFT | RIGHT |
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 29 matching lines...) Expand all Loading... |
40 ); | 40 ); |
41 | 41 |
42 if (filter && devtools) | 42 if (filter && devtools) |
43 devtools.logWhitelistedDocument( | 43 devtools.logWhitelistedDocument( |
44 page, urlString, typeMask, docDomain, filter | 44 page, urlString, typeMask, docDomain, filter |
45 ); | 45 ); |
46 | 46 |
47 return filter; | 47 return filter; |
48 } | 48 } |
49 | 49 |
| 50 let checkWhitelisted = |
50 /** | 51 /** |
51 * Gets the active whitelisting filter for the document associated | 52 * Gets the active whitelisting filter for the document associated |
52 * with the given page/frame, or null if it's not whitelisted. | 53 * with the given page/frame, or null if it's not whitelisted. |
53 * | 54 * |
54 * @param {Page} page | 55 * @param {Page} page |
55 * @param {Frame} [frame] | 56 * @param {Frame} [frame] |
56 * @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT] | 57 * @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT] |
57 * @return {?WhitelistFilter} | 58 * @return {?WhitelistFilter} |
58 */ | 59 */ |
59 exports.checkWhitelisted = function(page, frame, typeMask) | 60 exports.checkWhitelisted = function(page, frame, typeMask) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 key = key.replace(/=/g, ""); | 152 key = key.replace(/=/g, ""); |
152 | 153 |
153 if (verifyKey(key, signature, frame.url)) | 154 if (verifyKey(key, signature, frame.url)) |
154 recordKey(page, frame.url, key); | 155 recordKey(page, frame.url, key); |
155 }; | 156 }; |
156 | 157 |
157 port.on("filters.addKey", (message, sender) => | 158 port.on("filters.addKey", (message, sender) => |
158 { | 159 { |
159 processKey(message.token, sender.page, sender.frame); | 160 processKey(message.token, sender.page, sender.frame); |
160 }); | 161 }); |
| 162 |
| 163 port.on("filters.isPageWhitelisted", (message, sender) => |
| 164 { |
| 165 return !!checkWhitelisted(sender.page); |
| 166 }); |
LEFT | RIGHT |