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

Delta Between Two Patch Sets: messageResponder.js

Issue 29488575: Issue 5384 - Introduced dedicated mobile options page (Closed)
Left Patch Set: Created July 13, 2017, 2:54 p.m.
Right Patch Set: Added ID constants Created Aug. 28, 2017, 2:51 p.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 | « locale/en-US/mobile-options.json ('k') | mobile-options.html » ('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-2017 eyeo GmbH 3 * Copyright (C) 2006-present 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
(...skipping 15 matching lines...) Expand all
29 const {FilterStorage} = require("filterStorage"); 29 const {FilterStorage} = require("filterStorage");
30 const {FilterNotifier} = require("filterNotifier"); 30 const {FilterNotifier} = require("filterNotifier");
31 const {defaultMatcher} = require("matcher"); 31 const {defaultMatcher} = require("matcher");
32 const {ElemHideEmulation} = require("elemHideEmulation"); 32 const {ElemHideEmulation} = require("elemHideEmulation");
33 const {Notification: NotificationStorage} = require("notification"); 33 const {Notification: NotificationStorage} = require("notification");
34 34
35 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); 35 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses");
36 const {Synchronizer} = require("synchronizer"); 36 const {Synchronizer} = require("synchronizer");
37 37
38 const info = require("info"); 38 const info = require("info");
39 const {Subscription, 39 const {
40 DownloadableSubscription, 40 Subscription,
41 SpecialSubscription} = require("subscriptionClasses"); 41 DownloadableSubscription,
42 SpecialSubscription
43 } = require("subscriptionClasses");
42 44
43 // Some modules doesn't exist on Firefox. Moreover, 45 // Some modules doesn't exist on Firefox. Moreover,
44 // require() throws an exception on Firefox in that case. 46 // require() throws an exception on Firefox in that case.
45 // However, try/catch causes the whole function to to be 47 // However, try/catch causes the whole function to to be
46 // deoptimized on V8. So we wrap it into another function. 48 // deoptimized on V8. So we wrap it into another function.
47 function tryRequire(module) 49 function tryRequire(module)
48 { 50 {
49 try 51 try
50 { 52 {
51 return require(module); 53 return require(module);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 }); 192 });
191 193
192 port.on("app.listen", (message, sender) => 194 port.on("app.listen", (message, sender) =>
193 { 195 {
194 getListenerFilters(sender.page).app = message.filter; 196 getListenerFilters(sender.page).app = message.filter;
195 }); 197 });
196 198
197 port.on("app.open", (message, sender) => 199 port.on("app.open", (message, sender) =>
198 { 200 {
199 if (message.what == "options") 201 if (message.what == "options")
200 { 202 {
saroyanm 2017/07/18 12:46:26 Why is this change necessary ?
Thomas Greiner 2017/07/18 17:42:30 This is how we pass the domain to the options page
201 ext.showOptions(() => 203 ext.showOptions(() =>
202 { 204 {
203 if (!message.action) 205 if (!message.action)
204 return; 206 return;
205 207
206 sendMessage("app", message.action, ...message.args); 208 sendMessage("app", message.action, ...message.args);
207 }); 209 });
208 } 210 }
209 }); 211 });
210 212
(...skipping 18 matching lines...) Expand all
229 return filter instanceof BlockingFilter; 231 return filter instanceof BlockingFilter;
230 }); 232 });
231 233
232 port.on("filters.get", (message, sender) => 234 port.on("filters.get", (message, sender) =>
233 { 235 {
234 if (message.what == "elemhideemulation") 236 if (message.what == "elemhideemulation")
235 { 237 {
236 let filters = []; 238 let filters = [];
237 const {checkWhitelisted} = require("whitelisting"); 239 const {checkWhitelisted} = require("whitelisting");
238 240
239 if (Prefs.enabled && !checkWhitelisted(sender.page, sender.frame, 241 let isWhitelisted = checkWhitelisted(sender.page, sender.frame,
240 RegExpFilter.typeMap.DOCUMENT | 242 RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE);
241 RegExpFilter.typeMap.ELEMHIDE)) 243 if (Prefs.enabled && !isWhitelisted)
242 { 244 {
243 let {hostname} = sender.frame.url; 245 let {hostname} = sender.frame.url;
244 filters = ElemHideEmulation.getRulesForDomain(hostname); 246 filters = ElemHideEmulation.getRulesForDomain(hostname);
245 filters = filters.map((filter) => 247 filters = filters.map((filter) =>
246 { 248 {
247 return { 249 return {
248 selector: filter.selector, 250 selector: filter.selector,
249 text: filter.text 251 text: filter.text
250 }; 252 };
251 }); 253 });
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 if (message.url) 434 if (message.url)
433 subscriptions = [Subscription.fromURL(message.url)]; 435 subscriptions = [Subscription.fromURL(message.url)];
434 436
435 for (let subscription of subscriptions) 437 for (let subscription of subscriptions)
436 { 438 {
437 if (subscription instanceof DownloadableSubscription) 439 if (subscription instanceof DownloadableSubscription)
438 Synchronizer.execute(subscription, true); 440 Synchronizer.execute(subscription, true);
439 } 441 }
440 }); 442 });
441 })(this); 443 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld