Bug 1812098 - Fix ESLint raised issues with no-shadow of builtinGlobals in browser .mjs files. r=Gijs,credential-management-reviewers,sgalich,fxview-reviewers,sclements

Differential Revision: https://phabricator.services.mozilla.com/D169463
This commit is contained in:
Mark Banner
2023-03-14 09:13:48 +00:00
parent 0d26f2f7ef
commit 8aea2c2c67
12 changed files with 37 additions and 37 deletions

View File

@@ -193,7 +193,7 @@ window.addEventListener("AboutLoginsRemoveAllLoginsDialog", () => {
}
});
window.addEventListener("AboutLoginsExportPasswordsDialog", async event => {
window.addEventListener("AboutLoginsExportPasswordsDialog", async () => {
recordTelemetryEvent({
object: "export",
method: "mgmt_menu_item_used",

View File

@@ -116,10 +116,10 @@ class TabPickupContainer extends HTMLDetailsElement {
break;
}
case "view0-sync-disconnected-action": {
const window = event.target.ownerGlobal;
const win = event.target.ownerGlobal;
const {
switchToTabHavingURI,
} = window.docShell.chromeEventHandler.ownerGlobal;
} = win.docShell.chromeEventHandler.ownerGlobal;
switchToTabHavingURI(
"about:preferences?action=choose-what-to-sync#sync",
true,

View File

@@ -9,8 +9,8 @@ const HOW_IT_WORKS_URL_PREF = RPMGetFormatURLPref(
);
export default class LockwiseCard {
constructor(document) {
this.doc = document;
constructor(doc) {
this.doc = doc;
}
/**

View File

@@ -23,8 +23,8 @@ const MONITOR_HOME_PAGE_URL = RPMGetFormatURLPref(
);
export default class MonitorClass {
constructor(document) {
this.doc = document;
constructor(doc) {
this.doc = doc;
}
init() {

View File

@@ -10,8 +10,8 @@ const PROXY_EXTENSION_URL = RPMGetStringPref(
);
export default class ProxyCard {
constructor(document) {
this.doc = document;
constructor(doc) {
this.doc = doc;
}
init() {

View File

@@ -5,8 +5,8 @@
/* eslint-env mozilla/remote-page */
export default class VPNCard {
constructor(document) {
this.doc = document;
constructor(doc) {
this.doc = doc;
}
init() {

View File

@@ -213,15 +213,15 @@ function appendFiltersForContentType(
* @param aFpP
* A structure (see definition in internalSave(...) method)
* containing all the data used within this method.
* @param window
* @param win
* The window used for opening the file picker
* @return Promise
* @resolve a boolean. When true, it indicates that the file picker dialog
* is accepted.
*/
function promiseTargetFile(aFpP, window) {
function promiseTargetFile(aFpP, win) {
return (async function() {
let downloadLastDir = new lazy.DownloadLastDir(window);
let downloadLastDir = new lazy.DownloadLastDir(win);
// Default to the user's default downloads directory configured
// through download prefs.
@@ -249,7 +249,7 @@ function promiseTargetFile(aFpP, window) {
let fp = makeFilePicker();
let titleKey = aFpP.fpTitleKey;
fp.init(
window,
win,
ContentAreaUtils.stringBundle.GetStringFromName(titleKey),
Ci.nsIFilePicker.modeSave
);

View File

@@ -51,13 +51,13 @@ function* generateBundles() {
yield* [storybookBundle];
}
export async function insertFTLIfNeeded(name) {
if (loadedResources.has(name)) {
export async function insertFTLIfNeeded(fileName) {
if (loadedResources.has(fileName)) {
return;
}
// This should be browser, locales-preview or toolkit.
let [root, ...rest] = name.split("/");
let [root, ...rest] = fileName.split("/");
let ftlContents;
// TODO(mstriemer): These seem like they could be combined but I don't want
@@ -66,14 +66,14 @@ export async function insertFTLIfNeeded(name) {
// eslint-disable-next-line no-unsanitized/method
let imported = await import(
/* webpackInclude: /.*[\/\\].*\.ftl$/ */
`toolkit/locales/en-US/${name}`
`toolkit/locales/en-US/${fileName}`
);
ftlContents = imported.default;
} else if (root == "browser") {
// eslint-disable-next-line no-unsanitized/method
let imported = await import(
/* webpackInclude: /.*[\/\\].*\.ftl$/ */
`browser/locales/en-US/${name}`
`browser/locales/en-US/${fileName}`
);
ftlContents = imported.default;
} else if (root == "locales-preview") {
@@ -92,7 +92,7 @@ export async function insertFTLIfNeeded(name) {
ftlContents = imported.default;
}
if (loadedResources.has(name)) {
if (loadedResources.has(fileName)) {
// Seems possible we've attempted to load this twice before the first call
// resolves, so once the first load is complete we can abandon the others.
return;
@@ -100,6 +100,6 @@ export async function insertFTLIfNeeded(name) {
let ftlResource = new FluentResource(ftlContents);
storybookBundle.addResource(ftlResource);
loadedResources.set(name, ftlResource);
loadedResources.set(fileName, ftlResource);
document.l10n.translateRoots();
}

View File

@@ -17,11 +17,11 @@ window.MozXULElement = {
// For some reason Storybook doesn't watch the static folder. By creating a
// method with a dynamic import we can pull the desired files into the bundle.
async importCss(name) {
async importCss(resourceName) {
// eslint-disable-next-line no-unsanitized/method
let file = await import(
/* webpackInclude: /.*[\/\\].*\.css$/ */
`browser/themes/shared/${name}`
`browser/themes/shared/${resourceName}`
);
return file;
},

View File

@@ -13,9 +13,9 @@ export default {
window.MozXULElement.insertFTLIfNeeded("browser/aboutLogins.ftl");
const Template = ({ history }) =>
const Template = ({ historyItems }) =>
html`
<login-timeline .history=${history}></login-timeline>
<login-timeline .history=${historyItems}></login-timeline>
`;
const ACTION_ID_CREATED = "login-item-timeline-action-created";
@@ -24,12 +24,12 @@ const ACTION_ID_USED = "login-item-timeline-action-used";
export const EmptyTimeline = Template.bind({});
EmptyTimeline.args = {
history: [],
historyItems: [],
};
export const TypicalTimeline = Template.bind({});
TypicalTimeline.args = {
history: [
historyItems: [
{ actionId: ACTION_ID_CREATED, time: 1463526500267 },
{ actionId: ACTION_ID_UPDATED, time: 1653621219569 },
{ actionId: ACTION_ID_USED, time: 1561813190300 },
@@ -38,7 +38,7 @@ TypicalTimeline.args = {
export const AllSameDayTimeline = Template.bind({});
AllSameDayTimeline.args = {
history: [
historyItems: [
{ actionId: ACTION_ID_CREATED, time: 1463526500267 },
{ actionId: ACTION_ID_UPDATED, time: 1463526500267 },
{ actionId: ACTION_ID_USED, time: 1463526500267 },

View File

@@ -22,7 +22,7 @@ const openMenu = e => {
.toggle(e);
};
const Template = ({ open, items }) =>
const Template = ({ isOpen, items }) =>
html`
<style>
panel-item[icon="passwords"]::part(button) {
@@ -50,7 +50,7 @@ const Template = ({ open, items }) =>
class="ghost-button icon-button bottom end"
@click=${openMenu}
></button>
<panel-list ?stay-open=${open} ?open=${open}>
<panel-list ?stay-open=${isOpen} ?open=${isOpen}>
${items.map(i =>
i == "<hr>"
? html`
@@ -72,7 +72,7 @@ const Template = ({ open, items }) =>
export const Simple = Template.bind({});
Simple.args = {
open: false,
isOpen: false,
items: [
"Item One",
{ text: "Item Two (accesskey w)", accesskey: "w" },
@@ -85,7 +85,7 @@ Simple.args = {
export const Icons = Template.bind({});
Icons.args = {
open: false,
isOpen: false,
items: [
{ text: "Passwords", icon: "passwords" },
{ text: "Settings", icon: "settings" },
@@ -95,5 +95,5 @@ Icons.args = {
export const Open = Template.bind({});
Open.args = {
...Simple.args,
open: true,
isOpen: true,
};

View File

@@ -114,13 +114,13 @@ class TextRecognitionModal {
/**
* After the results are shown, measure how long a user interacts with the modal.
* @param {number} length
* @param {number} textLength
*/
static recordTextLengthTelemetry(length) {
static recordTextLengthTelemetry(textLength) {
const histogram = Services.telemetry.getHistogramById(
"TEXT_RECOGNITION_TEXT_LENGTH"
);
histogram.add(length);
histogram.add(textLength);
}
setupCloseHandler() {