Left: | ||
Right: |
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-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 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 (function(global) | 22 (function(global) |
23 { | 23 { |
24 const {port} = require("messaging"); | 24 const {port} = require("messaging"); |
25 const {Prefs} = require("prefs"); | 25 const {Prefs} = require("prefs"); |
26 const {Utils} = require("utils"); | 26 const {Utils} = require("utils"); |
27 const {FilterStorage} = require("filterStorage"); | 27 const {FilterStorage} = require("filterStorage"); |
28 const {FilterNotifier} = require("filterNotifier"); | 28 const {FilterNotifier} = require("filterNotifier"); |
29 const {defaultMatcher} = require("matcher"); | 29 const {defaultMatcher} = require("matcher"); |
30 const {Notification: NotificationStorage} = require("notification"); | 30 const {Notification: NotificationStorage} = require("notification"); |
31 const {getActiveNotification, shouldDisplay} = require("notificationHelper"); | 31 const {getActiveNotification, shouldDisplay} = require("notificationHelper"); |
Sebastian Noack
2017/10/08 01:35:35
You have to implement mocks for these APIs in back
kzar
2017/10/08 10:08:15
Whoops, Done.
| |
32 | 32 |
33 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); | 33 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); |
34 const {Synchronizer} = require("synchronizer"); | 34 const {Synchronizer} = require("synchronizer"); |
35 | 35 |
36 const info = require("info"); | 36 const info = require("info"); |
37 const { | 37 const { |
38 Subscription, | 38 Subscription, |
39 DownloadableSubscription, | 39 DownloadableSubscription, |
40 SpecialSubscription | 40 SpecialSubscription |
41 } = require("subscriptionClasses"); | 41 } = require("subscriptionClasses"); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 | 345 |
346 port.on("notifications.get", (message, sender) => | 346 port.on("notifications.get", (message, sender) => |
347 { | 347 { |
348 let notification = getActiveNotification(); | 348 let notification = getActiveNotification(); |
349 | 349 |
350 if (!notification || | 350 if (!notification || |
351 "displayMethod" in message && | 351 "displayMethod" in message && |
352 !shouldDisplay(message.displayMethod, notification.type)) | 352 !shouldDisplay(message.displayMethod, notification.type)) |
353 return; | 353 return; |
354 | 354 |
355 notification.texts = NotificationStorage.getLocalizedTexts(notification, | 355 let texts = NotificationStorage.getLocalizedTexts(notification, |
Sebastian Noack
2017/10/08 01:35:35
It seems inappropriate to modify the original obje
kzar
2017/10/08 10:08:15
Good point, Done.
| |
356 message.locale); | 356 message.locale); |
357 return notification; | 357 return Object.assign({texts}, notification); |
358 }); | 358 }); |
359 | 359 |
360 port.on("subscriptions.add", (message, sender) => | 360 port.on("subscriptions.add", (message, sender) => |
361 { | 361 { |
362 let subscription = Subscription.fromURL(message.url); | 362 let subscription = Subscription.fromURL(message.url); |
363 if (message.confirm) | 363 if (message.confirm) |
364 { | 364 { |
365 if ("title" in message) | 365 if ("title" in message) |
366 subscription.title = message.title; | 366 subscription.title = message.title; |
367 if ("homepage" in message) | 367 if ("homepage" in message) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 if (message.url) | 429 if (message.url) |
430 subscriptions = [Subscription.fromURL(message.url)]; | 430 subscriptions = [Subscription.fromURL(message.url)]; |
431 | 431 |
432 for (let subscription of subscriptions) | 432 for (let subscription of subscriptions) |
433 { | 433 { |
434 if (subscription instanceof DownloadableSubscription) | 434 if (subscription instanceof DownloadableSubscription) |
435 Synchronizer.execute(subscription, true); | 435 Synchronizer.execute(subscription, true); |
436 } | 436 } |
437 }); | 437 }); |
438 })(this); | 438 })(this); |
LEFT | RIGHT |