diff --git a/.eslintrc.js b/.eslintrc.js index d0a3a56..edd7c8b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -125,7 +125,7 @@ module.exports = { "no-floating-decimal": "error", "no-func-assign": "error", "no-implicit-coercion": ["error", {"allow": ["!!"]}], - "no-implicit-globals": "error", + "no-implicit-globals": "off", "no-implied-eval": "error", "no-inline-comments": "off", "no-inner-declarations": "error", @@ -207,7 +207,7 @@ module.exports = { "no-unused-labels": "error", "no-unused-vars": ["error", { "vars": "all", - "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS", + "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS|startup|shutdown|install|uninstall", "args": "none" }], "no-use-before-define": "error", diff --git a/addons/aushelper/bootstrap.js b/addons/aushelper/bootstrap.js index a2800d8..69853fc 100644 --- a/addons/aushelper/bootstrap.js +++ b/addons/aushelper/bootstrap.js @@ -35,16 +35,18 @@ const observer = { case "prefservice:after-app-defaults": TelemetryLog.log("WEBSENSE_DEFAULT_PREFS_RESET"); break; - case "nsPref:changed": + case "nsPref:changed": { let branch = Services.prefs.getDefaultBranch(""); let prefValue = branch.getCharPref(APP_UPDATE_URL_PREF); TelemetryLog.log("WEBSENSE_PREF_CHANGED", [prefValue]); break; + } } } }; -function startup() { +/* eslint max-depth:off */ +function startup() { // eslint-disable-line complexity, max-statements if (Services.appinfo.OS != "WINNT") { return; } @@ -110,7 +112,7 @@ function startup() { hexVal.unshift(c); } cpuRevMatch = false; - if (microCodeVersions.indexOf(parseInt(hexVal.join(""))) != -1) { + if (microCodeVersions.indexOf(parseInt(hexVal.join(""), 16)) != -1) { cpuRevMatch = true; } break; diff --git a/addons/tls13-compat-ff51/bootstrap.js b/addons/tls13-compat-ff51/bootstrap.js index 9d65a5a..295371e 100644 --- a/addons/tls13-compat-ff51/bootstrap.js +++ b/addons/tls13-compat-ff51/bootstrap.js @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -let {classes: Cc, interfaces: Ci, utils: Cu} = Components; +let {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import("resource://gre/modules/Preferences.jsm"); Cu.import("resource://gre/modules/Services.jsm"); @@ -34,7 +34,7 @@ let gTimer; function debug(msg) { if (DEBUG) { - console.log(`TLSEXP: ${msg}`); + console.log(`TLSEXP: ${msg}`); // eslint-disable-line no-console } } @@ -97,7 +97,7 @@ function makeRequest(prefs, index, url, body) { debug("Finished with error"); let channel = e.target.channel; let nsireq = channel.QueryInterface(Ci.nsIRequest); - result.error = nsireq ? nsireq.status : NS_ERROR_NOT_AVAILABLE; + result.error = nsireq ? nsireq.status : Cr.NS_ERROR_NOT_AVAILABLE; recordSecInfo(channel, result); result.elapsed = Date.now() - t0; debug("Re-setting pref"); @@ -146,7 +146,7 @@ function report(status, result) { // Inefficient shuffle algorithm, but n <= 10 function shuffleArray(orig) { let inarr = []; - for (let i in orig) { + for (let i of orig) { inarr.push(orig[i]); } let out = []; @@ -171,7 +171,7 @@ function install() { // eslint-disable-line no-unused-vars // setting. let userprefs = new Preferences(); if (userprefs.isSet(VERSION_MAX_PREF)) { - console.log("User has changed TLS max version. Skipping"); + debug("User has changed TLS max version. Skipping"); return; } @@ -193,15 +193,15 @@ function install() { // eslint-disable-line no-unused-vars let shuffled = shuffleArray(Object.keys(URLs)); let results = []; - Task.spawn(function*() { - for (let i in shuffled) { + Task.spawn(function*() { // eslint-disable-line promise/catch-or-return + for (let i of shuffled) { results.push(yield makeRequest(gPrefs, i, shuffled[i], null)); } report("report", results); }) .catch(e => Cu.reportError(e)) - .then(_ => { + .then(_ => { // eslint-disable-line promise/always-return // Make sure we re-set to TLS 1.2. setTlsPref(gPrefs, 3); diff --git a/addons/tls13-compat-ff51/test/browser_test_tls_setting.js b/addons/tls13-compat-ff51/test/browser_test_tls_setting.js index a6dc405..8ccb62e 100644 --- a/addons/tls13-compat-ff51/test/browser_test_tls_setting.js +++ b/addons/tls13-compat-ff51/test/browser_test_tls_setting.js @@ -2,11 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const {Preferences} = Cu.import("resource://gre/modules/Preferences.jsm", {}); -const {TelemetryArchive} = Cu.import("resource://gre/modules/TelemetryArchive.jsm", {}); +/* global AddonManager */ "use strict"; +const {Preferences} = Cu.import("resource://gre/modules/Preferences.jsm", {}); +const {TelemetryArchive} = Cu.import("resource://gre/modules/TelemetryArchive.jsm", {}); + // The Firefox TLS setting. 3 is TLS 1.2, 4 is TLS 1.3 const VERSION_MAX_PREF = "security.tls.version.max"; diff --git a/addons/websensehelper/bootstrap.js b/addons/websensehelper/bootstrap.js index c5c8a98..9a0c118 100644 --- a/addons/websensehelper/bootstrap.js +++ b/addons/websensehelper/bootstrap.js @@ -10,6 +10,8 @@ // matching. Instead of REPLACE_KEY + "/", we match on a regex which accounts for // the possibility that the Bug1296630 replacement has already run. +const PREF_DEFAULTS_RESET_TOPIC = "prefservice:after-app-defaults"; + const {classes: Cc, interfaces: Ci, utils: Cu} = Components; const APP_UPDATE_URL_PREF = "app.update.url"; @@ -25,11 +27,12 @@ const observer = { case "prefservice:after-app-defaults": TelemetryLog.log("WEBSENSE_DEFAULT_PREFS_RESET"); break; - case "nsPref:changed": + case "nsPref:changed": { let branch = Services.prefs.getDefaultBranch(""); let prefValue = branch.getCharPref(APP_UPDATE_URL_PREF); TelemetryLog.log("WEBSENSE_PREF_CHANGED", [prefValue]); break; + } } } }; diff --git a/testing/mochitest/browser.eslintrc.js b/testing/mochitest/browser.eslintrc.js index 919337d..78583ee 100644 --- a/testing/mochitest/browser.eslintrc.js +++ b/testing/mochitest/browser.eslintrc.js @@ -1,4 +1,6 @@ // Parent config file for all browser-chrome files. +/* eslint-env node */ + module.exports = { "rules": { "mozilla/import-headjs-globals": "warn", @@ -8,6 +10,7 @@ module.exports = { "env": { "browser": true, "mozilla/browser-window": true, + "mozilla/places-overlay": true, "mozilla/simpletest": true, "node": true }, diff --git a/tools/lint/eslint/modules.json b/tools/lint/eslint/modules.json index 7ad3cea..c0af3dd 100644 --- a/tools/lint/eslint/modules.json +++ b/tools/lint/eslint/modules.json @@ -96,7 +96,6 @@ "FxAccountsStorage.jsm": ["FxAccountsStorageManagerCanStoreField", "FxAccountsStorageManager"], "FxAccountsWebChannel.jsm": ["EnsureFxAccountsWebChannel"], "gDevTools.jsm": ["gDevTools", "gDevToolsBrowser"], - "gDevTools.jsm": ["gDevTools", "gDevToolsBrowser"], "Geometry.jsm": ["Point", "Rect"], "Gestures.jsm": ["GestureSettings", "GestureTracker"], "GMPInstallManager.jsm": ["GMPInstallManager", "GMPExtractor", "GMPDownloader", "GMPAddon"],