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

Unified Diff: lib/antiadblockInit.js

Issue 29375899: Issue 4871 - Start using ESLint for adblockplusui (Closed)
Patch Set: Fix imports in antiadblockInit.js Created March 14, 2017, 9:01 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/.eslintrc.json ('k') | messageResponder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/antiadblockInit.js
diff --git a/lib/antiadblockInit.js b/lib/antiadblockInit.js
index e48039e27a250ecdc9c46c771c7a927e532b47a0..9b5d6672fa556f7d144f19083c8b41c45e03707b 100644
--- a/lib/antiadblockInit.js
+++ b/lib/antiadblockInit.js
@@ -15,19 +15,20 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
-Cu.import("resource://gre/modules/Services.jsm");
+"use strict";
-let {Utils} = require("utils");
-let {Prefs} = require("prefs");
-let {ActiveFilter} = require("filterClasses");
-let {FilterStorage} = require("filterStorage");
-let {FilterNotifier} = require("filterNotifier");
-let {Subscription} = require("subscriptionClasses");
-let {Notification} = require("notification");
+const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
kzar 2017/03/14 10:57:36 I just noticed this gives me a no-unused-vars erro
Wladimir Palant 2017/03/14 11:14:57 This seems to be a left-over, even though I don't
kzar 2017/03/15 03:16:58 Done.
+
+const {Prefs} = require("prefs");
+const {ActiveFilter} = require("filterClasses");
+const {FilterStorage} = require("filterStorage");
+const {FilterNotifier} = require("filterNotifier");
+const {Subscription} = require("subscriptionClasses");
+const {Notification} = require("notification");
let ext;
if (typeof window != "undefined" && window.ext)
- ext = window.ext;
+ ({ext} = window);
else
ext = require("ext_background");
@@ -58,7 +59,8 @@ exports.initAntiAdblockNotification = function initAntiAdblockNotification()
for (let domain in filter.domains)
{
let urlFilter = "||" + domain + "^$document";
- if (domain && filter.domains[domain] && urlFilters.indexOf(urlFilter) == -1)
+ if (domain && filter.domains[domain] &&
+ urlFilters.indexOf(urlFilter) == -1)
urlFilters.push(urlFilter);
}
}
@@ -74,9 +76,11 @@ exports.initAntiAdblockNotification = function initAntiAdblockNotification()
Notification.removeQuestionListener(notification.id, notificationListener);
}
- let subscription = Subscription.fromURL(Prefs.subscriptions_antiadblockurl);
- if (subscription.lastDownload && subscription.disabled)
- addAntiAdblockNotification(subscription);
+ let antiAdblockSubscription = Subscription.fromURL(
+ Prefs.subscriptions_antiadblockurl
+ );
+ if (antiAdblockSubscription.lastDownload && antiAdblockSubscription.disabled)
+ addAntiAdblockNotification(antiAdblockSubscription);
function onSubscriptionChange(subscription)
{
@@ -93,4 +97,4 @@ exports.initAntiAdblockNotification = function initAntiAdblockNotification()
FilterNotifier.on("subscription.updated", onSubscriptionChange);
FilterNotifier.on("subscription.removed", onSubscriptionChange);
FilterNotifier.on("subscription.disabled", onSubscriptionChange);
-}
+};
« no previous file with comments | « lib/.eslintrc.json ('k') | messageResponder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld