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

Delta Between Two Patch Sets: lib/whitelisting.js

Issue 29338491: Issue 3823 - Split up message responder code (Closed)
Left Patch Set: Implement Port.disconnect() Created March 21, 2016, 4:59 p.m.
Right Patch Set: Moved get-domain-enabled-state to whitelisting module Created March 22, 2016, 8:22 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/messaging.js ('k') | metadata.common » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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
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 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld