Bug 1598223 - Fix issues caught by eslint in initial import. r=mixedpuppy

Differential Revision: https://phabricator.services.mozilla.com/D54618

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nihanth Subramanya 2019-11-28 16:03:16 +00:00
parent c6da6883d3
commit adaa4d2a6f
6 changed files with 50 additions and 42 deletions

View File

@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
/* global browser, runHeuristics */
@ -265,14 +269,6 @@ const rollout = {
},
async getSetting(name, defaultValue) {
if (defaultValue === undefined) {
throw new Error(
`Missing defaultValue argument when trying to fetch pref: ${JSON.stringify(
name
)}`
);
}
switch (typeof defaultValue) {
case "boolean":
log({
@ -284,10 +280,7 @@ const rollout = {
defaultValue
),
});
return await browser.experiments.preferences.getBoolPref(
name,
defaultValue
);
return browser.experiments.preferences.getBoolPref(name, defaultValue);
case "number":
log({
context: "getSetting",
@ -298,10 +291,7 @@ const rollout = {
defaultValue
),
});
return await browser.experiments.preferences.getIntPref(
name,
defaultValue
);
return browser.experiments.preferences.getIntPref(name, defaultValue);
case "string":
log({
context: "getSetting",
@ -312,9 +302,12 @@ const rollout = {
defaultValue
),
});
return await browser.experiments.preferences.getCharPref(
name,
defaultValue
return browser.experiments.preferences.getCharPref(name, defaultValue);
default:
throw new Error(
`Invalid defaultValue argument when trying to fetch pref: ${JSON.stringify(
name
)}`
);
}
},

View File

@ -1,13 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
/* global Services, ChromeUtils, BrowserWindowTracker,
ExtensionCommon, ExtensionAPI */
/* global BrowserWindowTracker, ExtensionCommon, ExtensionAPI */
/* exported doorhanger */
ChromeUtils.import("resource://gre/modules/Console.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm");
ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm"
);
var { EventManager, EventEmitter } = ExtensionCommon;
const {

View File

@ -1,8 +1,11 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
/* exported heuristics */
/* global Cc, Ci, Components, ExtensionAPI, Services */
let Cu3 = Components.utils;
Cu3.import("resource://gre/modules/Services.jsm");
/* global Cc, Ci, ExtensionAPI */
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
function log() {
// eslint-disable-next-line no-constant-condition

View File

@ -1,11 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
/* exported netChange */
/* global Cc, Ci, Components, EventManager, ExtensionAPI, Services, ExtensionCommon */
let Cu4 = Components.utils;
Cu4.import("resource://gre/modules/Services.jsm");
Cu4.import("resource://gre/modules/ExtensionCommon.jsm");
/* global Cc, Ci, ExtensionAPI, ExtensionCommon */
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { setTimeout } = Cu4.import("resource://gre/modules/Timer.jsm");
const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
var { EventManager } = ExtensionCommon;
let gNetworkLinkService = Cc[

View File

@ -1,14 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
/* exported preferences */
/* global Components, ExtensionAPI, ExtensionCommon, Services */
let Cu2 = Components.utils;
Cu2.import("resource://gre/modules/Services.jsm");
Cu2.import("resource://gre/modules/ExtensionSettingsStore.jsm");
Cu2.import("resource://gre/modules/AddonManager.jsm");
Cu2.import("resource://gre/modules/NetUtil.jsm");
Cu2.import("resource://gre/modules/ExtensionPreferencesManager.jsm");
/* global ExtensionPreferencesManager */
/* global ExtensionAPI, ExtensionCommon */
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { ExtensionPreferencesManager } = ChromeUtils.import(
"resource://gre/modules/ExtensionPreferencesManager.jsm"
);
// TODO file scope issue on experiments that join extension contexts causing redeclaration issues.
const TRR_URI_PREF = "network.trr.uri";

View File

@ -1,3 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
"use strict";
/* global browser */
/* exported runHeuristics */