Bug 1917530 - Fix some ESLint no-shadow issues in misc code. r=frontend-codestyle-reviewers,perftest-reviewers,translations-reviewers,omc-reviewers,migration-reviewers,webcompat-reviewers,urlbar-reviewers,dao,twisniewski,sparky,mconley,emcminn,mossop
Differential Revision: https://phabricator.services.mozilla.com/D221443
This commit is contained in:
@@ -943,7 +943,6 @@ export class ContextMenuChild extends JSWindowActorChild {
|
|||||||
? undefined
|
? undefined
|
||||||
: context.target.title || context.target.alt,
|
: context.target.title || context.target.alt,
|
||||||
};
|
};
|
||||||
const { SVGAnimatedLength } = context.target.ownerGlobal;
|
|
||||||
if (SVGAnimatedLength.isInstance(context.imageInfo.height)) {
|
if (SVGAnimatedLength.isInstance(context.imageInfo.height)) {
|
||||||
context.imageInfo.height = context.imageInfo.height.animVal.value;
|
context.imageInfo.height = context.imageInfo.height.animVal.value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ export class ASRouterAdminInner extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChangeTargetingParameters(event) {
|
onChangeTargetingParameters(event) {
|
||||||
const { name } = event.target;
|
const { name: eventName } = event.target;
|
||||||
const { value } = event.target;
|
const { value } = event.target;
|
||||||
|
|
||||||
let targetingParametersError = null;
|
let targetingParametersError = null;
|
||||||
@@ -246,14 +246,14 @@ export class ASRouterAdminInner extends React.PureComponent {
|
|||||||
JSON.parse(value);
|
JSON.parse(value);
|
||||||
event.target.classList.remove("errorState");
|
event.target.classList.remove("errorState");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`Error parsing value of parameter ${name}`);
|
console.error(`Error parsing value of parameter ${eventName}`);
|
||||||
event.target.classList.add("errorState");
|
event.target.classList.add("errorState");
|
||||||
targetingParametersError = { id: name };
|
targetingParametersError = { id: eventName };
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState(({ stringTargetingParameters }) => {
|
this.setState(({ stringTargetingParameters }) => {
|
||||||
const updatedParameters = { ...stringTargetingParameters };
|
const updatedParameters = { ...stringTargetingParameters };
|
||||||
updatedParameters[name] = value;
|
updatedParameters[eventName] = value;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
copiedToClipboard: false,
|
copiedToClipboard: false,
|
||||||
@@ -692,6 +692,7 @@ export class ASRouterAdminInner extends React.PureComponent {
|
|||||||
{this.state.messages
|
{this.state.messages
|
||||||
.map(message => message.template)
|
.map(message => message.template)
|
||||||
.filter(
|
.filter(
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
(value, index, self) => self.indexOf(value) === index
|
(value, index, self) => self.indexOf(value) === index
|
||||||
)
|
)
|
||||||
.map(template => (
|
.map(template => (
|
||||||
@@ -1224,11 +1225,11 @@ export class ASRouterAdminInner extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChangeAttributionParameters(event) {
|
onChangeAttributionParameters(event) {
|
||||||
const { name, value } = event.target;
|
const { eventName, value } = event.target;
|
||||||
|
|
||||||
this.setState(({ attributionParameters }) => {
|
this.setState(({ attributionParameters }) => {
|
||||||
const updatedParameters = { ...attributionParameters };
|
const updatedParameters = { ...attributionParameters };
|
||||||
updatedParameters[name] = value;
|
updatedParameters[eventName] = value;
|
||||||
|
|
||||||
return { attributionParameters: updatedParameters };
|
return { attributionParameters: updatedParameters };
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -420,18 +420,20 @@ export class ChromeProfileMigrator extends MigratorBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let crypto;
|
let loginCrypto;
|
||||||
try {
|
try {
|
||||||
if (AppConstants.platform == "win") {
|
if (AppConstants.platform == "win") {
|
||||||
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
|
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
|
||||||
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
|
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
|
||||||
);
|
);
|
||||||
crypto = new ChromeWindowsLoginCrypto(_chromeUserDataPathSuffix);
|
loginCrypto = new ChromeWindowsLoginCrypto(
|
||||||
|
_chromeUserDataPathSuffix
|
||||||
|
);
|
||||||
} else if (AppConstants.platform == "macosx") {
|
} else if (AppConstants.platform == "macosx") {
|
||||||
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
|
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
|
||||||
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
|
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
|
||||||
);
|
);
|
||||||
crypto = new ChromeMacOSLoginCrypto(
|
loginCrypto = new ChromeMacOSLoginCrypto(
|
||||||
_keychainServiceName,
|
_keychainServiceName,
|
||||||
_keychainAccountName,
|
_keychainAccountName,
|
||||||
_keychainMockPassphrase
|
_keychainMockPassphrase
|
||||||
@@ -462,7 +464,7 @@ export class ChromeProfileMigrator extends MigratorBase {
|
|||||||
}
|
}
|
||||||
let loginInfo = {
|
let loginInfo = {
|
||||||
username: row.getResultByName("username_value"),
|
username: row.getResultByName("username_value"),
|
||||||
password: await crypto.decryptData(
|
password: await loginCrypto.decryptData(
|
||||||
row.getResultByName("password_value"),
|
row.getResultByName("password_value"),
|
||||||
null
|
null
|
||||||
),
|
),
|
||||||
@@ -578,18 +580,20 @@ export class ChromeProfileMigrator extends MigratorBase {
|
|||||||
type: MigrationUtils.resourceTypes.PAYMENT_METHODS,
|
type: MigrationUtils.resourceTypes.PAYMENT_METHODS,
|
||||||
|
|
||||||
async migrate(aCallback) {
|
async migrate(aCallback) {
|
||||||
let crypto;
|
let loginCrypto;
|
||||||
try {
|
try {
|
||||||
if (AppConstants.platform == "win") {
|
if (AppConstants.platform == "win") {
|
||||||
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
|
let { ChromeWindowsLoginCrypto } = ChromeUtils.importESModule(
|
||||||
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
|
"resource:///modules/ChromeWindowsLoginCrypto.sys.mjs"
|
||||||
);
|
);
|
||||||
crypto = new ChromeWindowsLoginCrypto(_chromeUserDataPathSuffix);
|
loginCrypto = new ChromeWindowsLoginCrypto(
|
||||||
|
_chromeUserDataPathSuffix
|
||||||
|
);
|
||||||
} else if (AppConstants.platform == "macosx") {
|
} else if (AppConstants.platform == "macosx") {
|
||||||
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
|
let { ChromeMacOSLoginCrypto } = ChromeUtils.importESModule(
|
||||||
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
|
"resource:///modules/ChromeMacOSLoginCrypto.sys.mjs"
|
||||||
);
|
);
|
||||||
crypto = new ChromeMacOSLoginCrypto(
|
loginCrypto = new ChromeMacOSLoginCrypto(
|
||||||
_keychainServiceName,
|
_keychainServiceName,
|
||||||
_keychainAccountName,
|
_keychainAccountName,
|
||||||
_keychainMockPassphrase
|
_keychainMockPassphrase
|
||||||
@@ -609,7 +613,7 @@ export class ChromeProfileMigrator extends MigratorBase {
|
|||||||
for (let row of rows) {
|
for (let row of rows) {
|
||||||
cards.push({
|
cards.push({
|
||||||
"cc-name": row.getResultByName("name_on_card"),
|
"cc-name": row.getResultByName("name_on_card"),
|
||||||
"cc-number": await crypto.decryptData(
|
"cc-number": await loginCrypto.decryptData(
|
||||||
row.getResultByName("card_number_encrypted"),
|
row.getResultByName("card_number_encrypted"),
|
||||||
null
|
null
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { PlacesUtils } from "resource://gre/modules/PlacesUtils.sys.mjs";
|
|||||||
|
|
||||||
// Resources
|
// Resources
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
function History() {}
|
function History() {}
|
||||||
|
|
||||||
History.prototype = {
|
History.prototype = {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ function Home(props) {
|
|||||||
utmContent,
|
utmContent,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
const [{ articles, status }, setArticlesState] = useState({
|
const [{ articles, status }, setArticlesState] = useState({
|
||||||
articles: [],
|
articles: [],
|
||||||
// Can be success, loading, or error.
|
// Can be success, loading, or error.
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
/* eslint-env mozilla/browser-window */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResetPBMPanel contains the logic for the restart private browsing action.
|
* ResetPBMPanel contains the logic for the restart private browsing action.
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/* eslint-env mozilla/browser-window */
|
|
||||||
|
|
||||||
const DEFAULT_NEW_REPORT_ENDPOINT = "https://webcompat.com/issues/new";
|
const DEFAULT_NEW_REPORT_ENDPOINT = "https://webcompat.com/issues/new";
|
||||||
|
|
||||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ const UPDATE_CHECK_PERIOD_MS = 12 * 60 * 60 * 1000; // 12 hours
|
|||||||
/**
|
/**
|
||||||
* A node in the QueryScorer's phrase tree.
|
* A node in the QueryScorer's phrase tree.
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
class Node {
|
class Node {
|
||||||
constructor(word) {
|
constructor(word) {
|
||||||
this.word = word;
|
this.word = word;
|
||||||
|
|||||||
@@ -777,13 +777,13 @@ export let BrowserUsageTelemetry = {
|
|||||||
return "keyboard";
|
return "keyboard";
|
||||||
}
|
}
|
||||||
|
|
||||||
const { URL } = node.ownerDocument;
|
const { URL: url } = node.ownerDocument;
|
||||||
if (URL == AppConstants.BROWSER_CHROME_URL) {
|
if (url == AppConstants.BROWSER_CHROME_URL) {
|
||||||
return this._getBrowserWidgetContainer(node);
|
return this._getBrowserWidgetContainer(node);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
URL.startsWith("about:preferences") ||
|
url.startsWith("about:preferences") ||
|
||||||
URL.startsWith("about:settings")
|
url.startsWith("about:settings")
|
||||||
) {
|
) {
|
||||||
// Find the element's category.
|
// Find the element's category.
|
||||||
let container = node.closest("[data-category]");
|
let container = node.closest("[data-category]");
|
||||||
|
|||||||
@@ -602,6 +602,7 @@ export var TabCrashHandler = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
let { includeURL, comments, URL } = message.data;
|
let { includeURL, comments, URL } = message.data;
|
||||||
|
|
||||||
let extraExtraKeyVals = {
|
let extraExtraKeyVals = {
|
||||||
|
|||||||
@@ -490,6 +490,7 @@ export var TestRunner = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async _cropImage(window, srcPath, bounds, rects, targetPath) {
|
async _cropImage(window, srcPath, bounds, rects, targetPath) {
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
const { document, Image } = window;
|
const { document, Image } = window;
|
||||||
const promise = new Promise((resolve, reject) => {
|
const promise = new Promise((resolve, reject) => {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* 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/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
import { AddonManager } from "resource://gre/modules/AddonManager.sys.mjs";
|
import { AddonManager } from "resource://gre/modules/AddonManager.sys.mjs";
|
||||||
|
|
||||||
export var LightweightThemes = {
|
export var LightweightThemes = {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import { BrowserTestUtils } from "resource://testing-common/BrowserTestUtils.sys.mjs";
|
import { BrowserTestUtils } from "resource://testing-common/BrowserTestUtils.sys.mjs";
|
||||||
|
|
||||||
const URL =
|
const TEST_URL =
|
||||||
"https://test1.example.com/browser/browser/tools/mozscreenshots/mozscreenshots/extension/mozscreenshots/browser/resources/lib/permissionPrompts.html";
|
"https://test1.example.com/browser/browser/tools/mozscreenshots/mozscreenshots/extension/mozscreenshots/browser/resources/lib/permissionPrompts.html";
|
||||||
let lastTab = null;
|
let lastTab = null;
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ async function clickOn(selector, beforeContentFn) {
|
|||||||
// Save the tab so we can close it later.
|
// Save the tab so we can close it later.
|
||||||
lastTab = await BrowserTestUtils.openNewForegroundTab(
|
lastTab = await BrowserTestUtils.openNewForegroundTab(
|
||||||
browserWindow.gBrowser,
|
browserWindow.gBrowser,
|
||||||
URL
|
TEST_URL
|
||||||
);
|
);
|
||||||
|
|
||||||
let { SpecialPowers } = lastTab.ownerGlobal;
|
let { SpecialPowers } = lastTab.ownerGlobal;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ importScripts("mp4box.all.min.js");
|
|||||||
importScripts("demuxer_mp4.js");
|
importScripts("demuxer_mp4.js");
|
||||||
importScripts("shared.js");
|
importScripts("shared.js");
|
||||||
|
|
||||||
self.onmessage = e => {
|
self.onmessage = event => {
|
||||||
const resolve = result => {
|
const resolve = result => {
|
||||||
self.postMessage(result);
|
self.postMessage(result);
|
||||||
};
|
};
|
||||||
@@ -16,15 +16,15 @@ self.onmessage = e => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
runTestInternal(
|
runTestInternal(
|
||||||
e.data.testName,
|
event.data.testName,
|
||||||
e.data.canvasType,
|
event.data.canvasType,
|
||||||
e.data.offscreenCanvas,
|
event.data.offscreenCanvas,
|
||||||
/* isWorker */ true,
|
/* isWorker */ true,
|
||||||
e.data.videoUri,
|
event.data.videoUri,
|
||||||
resolve,
|
resolve,
|
||||||
reject
|
reject
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (ex) {
|
||||||
reject(e);
|
reject(ex);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -251,8 +251,7 @@ AbstractWorker.prototype = {
|
|||||||
"id is",
|
"id is",
|
||||||
id
|
id
|
||||||
);
|
);
|
||||||
let msg = exn.toMsg();
|
this.postMessage({ fail: exn.toMsg(), id, durationMs });
|
||||||
this.postMessage({ fail: msg, id, durationMs });
|
|
||||||
} else {
|
} else {
|
||||||
// If we encounter an exception for which we have no
|
// If we encounter an exception for which we have no
|
||||||
// serialization mechanism in place, we have no choice but to
|
// serialization mechanism in place, we have no choice but to
|
||||||
|
|||||||
@@ -245,11 +245,8 @@ class Engine {
|
|||||||
this.bergamot = bergamot;
|
this.bergamot = bergamot;
|
||||||
/** @type {Bergamot["TranslationModel"][]} */
|
/** @type {Bergamot["TranslationModel"][]} */
|
||||||
this.languageTranslationModels = languageTranslationModelFiles.map(
|
this.languageTranslationModels = languageTranslationModelFiles.map(
|
||||||
languageTranslationModelFiles =>
|
modelFiles =>
|
||||||
BergamotUtils.constructSingleTranslationModel(
|
BergamotUtils.constructSingleTranslationModel(bergamot, modelFiles)
|
||||||
bergamot,
|
|
||||||
languageTranslationModelFiles
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @type {Bergamot["BlockingService"]} */
|
/** @type {Bergamot["BlockingService"]} */
|
||||||
|
|||||||
Reference in New Issue
Block a user