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

Side by Side Diff: messageResponder.js

Issue 29773630: Issue 5761 - Changes require paths to relative (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Created May 8, 2018, 1:03 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« background.js ('K') | « lib/antiadblockInit.js ('k') | no next file » | 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-present 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 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 /* globals require */ 18 /* globals require */
19 19
20 "use strict"; 20 "use strict";
21 21
22 (function(global) 22 (function(global)
23 { 23 {
24 const {port} = require("messaging"); 24 const {port} = require("../lib/messaging");
25 const {Prefs} = require("prefs"); 25 const {Prefs} = require("../lib/prefs");
26 const {Utils} = require("utils"); 26 const {Utils} = require("../lib/utils");
27 const {FilterStorage} = require("filterStorage"); 27 const {FilterStorage} = require("../adblockpluscore/lib/filterStorage");
28 const {FilterNotifier} = require("filterNotifier"); 28 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier");
29 const {defaultMatcher} = require("matcher"); 29 const {defaultMatcher} = require("../adblockpluscore/lib/matcher");
30 const {Notification: NotificationStorage} = require("notification"); 30 const {Notification:
31 NotificationStorage} = require("../adblockpluscore/lib/notification");
31 const {getActiveNotification, shouldDisplay, 32 const {getActiveNotification, shouldDisplay,
32 notificationClicked} = require("notificationHelper"); 33 notificationClicked} = require("../lib/notificationHelper");
33 34
34 const { 35 const {
35 Filter, ActiveFilter, BlockingFilter, RegExpFilter 36 Filter, ActiveFilter, BlockingFilter, RegExpFilter
36 } = require("filterClasses"); 37 } = require("../adblockpluscore/lib/filterClasses");
37 const {Synchronizer} = require("synchronizer"); 38 const {Synchronizer} = require("../adblockpluscore/lib/synchronizer");
38 39
39 const info = require("info"); 40 const info = require("../buildtools/info");
kzar 2018/05/17 13:53:27 It turns out using a relative path for the info mo
40 const { 41 const {
41 Subscription, 42 Subscription,
42 DownloadableSubscription, 43 DownloadableSubscription,
43 SpecialSubscription 44 SpecialSubscription
44 } = require("subscriptionClasses"); 45 } = require("../adblockpluscore/lib/subscriptionClasses");
45 46
46 const {showOptions} = require("options"); 47 const {showOptions} = require("../lib/options");
47 48
48 port.on("types.get", (message, sender) => 49 port.on("types.get", (message, sender) =>
49 { 50 {
50 let filterTypes = Array.from(require("requestBlocker").filterTypes); 51 let filterTypes = Array.from(require("requestBlocker").filterTypes);
51 filterTypes.push(...filterTypes.splice(filterTypes.indexOf("OTHER"), 1)); 52 filterTypes.push(...filterTypes.splice(filterTypes.indexOf("OTHER"), 1));
52 return filterTypes; 53 return filterTypes;
53 }); 54 });
54 55
55 function convertObject(keys, obj) 56 function convertObject(keys, obj)
56 { 57 {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 FilterStorage.addSubscription(subscription); 150 FilterStorage.addSubscription(subscription);
150 if (subscription instanceof DownloadableSubscription && 151 if (subscription instanceof DownloadableSubscription &&
151 !subscription.lastDownload) 152 !subscription.lastDownload)
152 Synchronizer.execute(subscription); 153 Synchronizer.execute(subscription);
153 } 154 }
154 155
155 port.on("app.get", (message, sender) => 156 port.on("app.get", (message, sender) =>
156 { 157 {
157 if (message.what == "issues") 158 if (message.what == "issues")
158 { 159 {
159 let subscriptionInit = require("subscriptionInit"); 160 let subscriptionInit = require("../lib/subscriptionInit");
160 return { 161 return {
161 dataCorrupted: subscriptionInit.isDataCorrupted(), 162 dataCorrupted: subscriptionInit.isDataCorrupted(),
162 filterlistsReinitialized: subscriptionInit.isReinitialized() 163 filterlistsReinitialized: subscriptionInit.isReinitialized()
163 }; 164 };
164 } 165 }
165 166
166 if (message.what == "doclink") 167 if (message.what == "doclink")
167 { 168 {
168 let {application} = info; 169 let {application} = info;
169 if (info.platform == "chromium" && application != "opera") 170 if (info.platform == "chromium" && application != "opera")
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 if (!message.action) 213 if (!message.action)
213 return; 214 return;
214 215
215 sendMessage("app", message.action, ...message.args); 216 sendMessage("app", message.action, ...message.args);
216 }); 217 });
217 } 218 }
218 }); 219 });
219 220
220 port.on("filters.add", (message, sender) => 221 port.on("filters.add", (message, sender) =>
221 { 222 {
222 let result = require("filterValidation").parseFilter(message.text); 223 let result = require("../lib/filterValidation").parseFilter(message.text);
223 let errors = []; 224 let errors = [];
224 if (result.error) 225 if (result.error)
225 errors.push(result.error.toString()); 226 errors.push(result.error.toString());
226 else if (result.filter) 227 else if (result.filter)
227 FilterStorage.addFilter(result.filter); 228 FilterStorage.addFilter(result.filter);
228 229
229 return errors; 230 return errors;
230 }); 231 });
231 232
232 port.on("filters.blocked", (message, sender) => 233 port.on("filters.blocked", (message, sender) =>
233 { 234 {
234 let filter = defaultMatcher.matchesAny(message.url, 235 let filter = defaultMatcher.matchesAny(message.url,
235 RegExpFilter.typeMap[message.requestType], message.docDomain, 236 RegExpFilter.typeMap[message.requestType], message.docDomain,
236 message.thirdParty); 237 message.thirdParty);
237 238
238 return filter instanceof BlockingFilter; 239 return filter instanceof BlockingFilter;
239 }); 240 });
240 241
241 port.on("filters.get", (message, sender) => 242 port.on("filters.get", (message, sender) =>
242 { 243 {
243 let subscription = Subscription.fromURL(message.subscriptionUrl); 244 let subscription = Subscription.fromURL(message.subscriptionUrl);
244 if (!subscription) 245 if (!subscription)
245 return []; 246 return [];
246 247
247 return subscription.filters.map(convertFilter); 248 return subscription.filters.map(convertFilter);
248 }); 249 });
249 250
250 port.on("filters.importRaw", (message, sender) => 251 port.on("filters.importRaw", (message, sender) =>
251 { 252 {
252 let result = require("filterValidation").parseFilters(message.text); 253 let result = require("../lib/filterValidation").parseFilters(message.text);
253 let errors = []; 254 let errors = [];
254 for (let error of result.errors) 255 for (let error of result.errors)
255 { 256 {
256 if (error.type != "unexpected-filter-list-header") 257 if (error.type != "unexpected-filter-list-header")
257 errors.push(error.toString()); 258 errors.push(error.toString());
258 } 259 }
259 260
260 if (errors.length > 0) 261 if (errors.length > 0)
261 return errors; 262 return errors;
262 263
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // "*.listen" messages to tackle #6440 479 // "*.listen" messages to tackle #6440
479 if (action == "listen") 480 if (action == "listen")
480 { 481 {
481 listen(type, filters, message.filter); 482 listen(type, filters, message.filter);
482 } 483 }
483 }); 484 });
484 } 485 }
485 486
486 browser.runtime.onConnect.addListener(onConnect); 487 browser.runtime.onConnect.addListener(onConnect);
487 })(this); 488 })(this);
OLDNEW
« background.js ('K') | « lib/antiadblockInit.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld