| OLD | NEW | 
|    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 "use strict"; |   18 "use strict"; | 
|   19  |   19  | 
|   20 /** |   20 /** | 
|   21  * @fileOverview Handles notifications. |   21  * @fileOverview Handles notifications. | 
|   22  */ |   22  */ | 
|   23  |   23  | 
|   24 const {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); |  | 
|   25  |  | 
|   26 const {Prefs} = require("prefs"); |   24 const {Prefs} = require("prefs"); | 
|   27 const {Downloader, Downloadable, |   25 const {Downloader, Downloadable, | 
|   28        MILLIS_IN_MINUTE, MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("downloader"); |   26        MILLIS_IN_MINUTE, MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("downloader"); | 
|   29 const {Utils} = require("utils"); |   27 const {Utils} = require("utils"); | 
|   30 const {Matcher, defaultMatcher} = require("matcher"); |   28 const {Matcher, defaultMatcher} = require("matcher"); | 
|   31 const {Filter, RegExpFilter, WhitelistFilter} = require("filterClasses"); |   29 const {Filter, RegExpFilter, WhitelistFilter} = require("filterClasses"); | 
 |   30 const {compareVersion} = require("coreUtils"); | 
|   32  |   31  | 
|   33 const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; |   32 const INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; | 
|   34 const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; |   33 const CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; | 
|   35 const EXPIRATION_INTERVAL = 1 * MILLIS_IN_DAY; |   34 const EXPIRATION_INTERVAL = 1 * MILLIS_IN_DAY; | 
|   36 const TYPE = { |   35 const TYPE = { | 
|   37   information: 0, |   36   information: 0, | 
|   38   question: 1, |   37   question: 1, | 
|   39   relentless: 2, |   38   relentless: 2, | 
|   40   critical: 3 |   39   critical: 3 | 
|   41 }; |   40 }; | 
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  210     let notifications = localData.concat(remoteData); |  209     let notifications = localData.concat(remoteData); | 
|  211     if (notifications.length === 0) |  210     if (notifications.length === 0) | 
|  212       return null; |  211       return null; | 
|  213  |  212  | 
|  214     const {addonName, addonVersion, application, |  213     const {addonName, addonVersion, application, | 
|  215            applicationVersion, platform, platformVersion} = require("info"); |  214            applicationVersion, platform, platformVersion} = require("info"); | 
|  216  |  215  | 
|  217     let targetChecks = { |  216     let targetChecks = { | 
|  218       extension: v => v == addonName, |  217       extension: v => v == addonName, | 
|  219       extensionMinVersion: |  218       extensionMinVersion: | 
|  220         v => Services.vc.compare(addonVersion, v) >= 0, |  219         v => compareVersion(addonVersion, v) >= 0, | 
|  221       extensionMaxVersion: |  220       extensionMaxVersion: | 
|  222         v => Services.vc.compare(addonVersion, v) <= 0, |  221         v => compareVersion(addonVersion, v) <= 0, | 
|  223       application: v => v == application, |  222       application: v => v == application, | 
|  224       applicationMinVersion: |  223       applicationMinVersion: | 
|  225         v => Services.vc.compare(applicationVersion, v) >= 0, |  224         v => compareVersion(applicationVersion, v) >= 0, | 
|  226       applicationMaxVersion: |  225       applicationMaxVersion: | 
|  227         v => Services.vc.compare(applicationVersion, v) <= 0, |  226         v => compareVersion(applicationVersion, v) <= 0, | 
|  228       platform: v => v == platform, |  227       platform: v => v == platform, | 
|  229       platformMinVersion: |  228       platformMinVersion: | 
|  230         v => Services.vc.compare(platformVersion, v) >= 0, |  229         v => compareVersion(platformVersion, v) >= 0, | 
|  231       platformMaxVersion: |  230       platformMaxVersion: | 
|  232         v => Services.vc.compare(platformVersion, v) <= 0, |  231         v => compareVersion(platformVersion, v) <= 0, | 
|  233       blockedTotalMin: v => Prefs.show_statsinpopup && |  232       blockedTotalMin: v => Prefs.show_statsinpopup && | 
|  234         Prefs.blocked_total >= v, |  233         Prefs.blocked_total >= v, | 
|  235       blockedTotalMax: v => Prefs.show_statsinpopup && |  234       blockedTotalMax: v => Prefs.show_statsinpopup && | 
|  236         Prefs.blocked_total <= v, |  235         Prefs.blocked_total <= v, | 
|  237       locales: v => v.includes(Utils.appLocale) |  236       locales: v => v.includes(Utils.appLocale) | 
|  238     }; |  237     }; | 
|  239  |  238  | 
|  240     let notificationToShow = null; |  239     let notificationToShow = null; | 
|  241     for (let notification of notifications) |  240     for (let notification of notifications) | 
|  242     { |  241     { | 
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  481     else if (index != -1 && forceValue !== true) |  480     else if (index != -1 && forceValue !== true) | 
|  482       categories.splice(index, 1); |  481       categories.splice(index, 1); | 
|  483  |  482  | 
|  484     // HACK: JSON values aren't saved unless they are assigned a |  483     // HACK: JSON values aren't saved unless they are assigned a | 
|  485     // different object. |  484     // different object. | 
|  486     Prefs.notifications_ignoredcategories = |  485     Prefs.notifications_ignoredcategories = | 
|  487       JSON.parse(JSON.stringify(categories)); |  486       JSON.parse(JSON.stringify(categories)); | 
|  488   } |  487   } | 
|  489 }; |  488 }; | 
|  490 Notification.init(); |  489 Notification.init(); | 
| OLD | NEW |