Skip to content

Commit 80295c5

Browse files
committed
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
1 parent bcd73ea commit 80295c5

File tree

12 files changed

+37
-37
lines changed

12 files changed

+37
-37
lines changed

browser/components/aboutlogins/content/aboutLogins.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ window.addEventListener("AboutLoginsRemoveAllLoginsDialog", () => {
193193
}
194194
});
195195

196-
window.addEventListener("AboutLoginsExportPasswordsDialog", async event => {
196+
window.addEventListener("AboutLoginsExportPasswordsDialog", async () => {
197197
recordTelemetryEvent({
198198
object: "export",
199199
method: "mgmt_menu_item_used",

browser/components/firefoxview/tab-pickup-container.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ class TabPickupContainer extends HTMLDetailsElement {
116116
break;
117117
}
118118
case "view0-sync-disconnected-action": {
119-
const window = event.target.ownerGlobal;
119+
const win = event.target.ownerGlobal;
120120
const {
121121
switchToTabHavingURI,
122-
} = window.docShell.chromeEventHandler.ownerGlobal;
122+
} = win.docShell.chromeEventHandler.ownerGlobal;
123123
switchToTabHavingURI(
124124
"about:preferences?action=choose-what-to-sync#sync",
125125
true,

browser/components/protections/content/lockwise-card.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const HOW_IT_WORKS_URL_PREF = RPMGetFormatURLPref(
99
);
1010

1111
export default class LockwiseCard {
12-
constructor(document) {
13-
this.doc = document;
12+
constructor(doc) {
13+
this.doc = doc;
1414
}
1515

1616
/**

browser/components/protections/content/monitor-card.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const MONITOR_HOME_PAGE_URL = RPMGetFormatURLPref(
2323
);
2424

2525
export default class MonitorClass {
26-
constructor(document) {
27-
this.doc = document;
26+
constructor(doc) {
27+
this.doc = doc;
2828
}
2929

3030
init() {

browser/components/protections/content/proxy-card.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const PROXY_EXTENSION_URL = RPMGetStringPref(
1010
);
1111

1212
export default class ProxyCard {
13-
constructor(document) {
14-
this.doc = document;
13+
constructor(doc) {
14+
this.doc = doc;
1515
}
1616

1717
init() {

browser/components/protections/content/vpn-card.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/* eslint-env mozilla/remote-page */
66

77
export default class VPNCard {
8-
constructor(document) {
9-
this.doc = document;
8+
constructor(doc) {
9+
this.doc = doc;
1010
}
1111

1212
init() {

browser/components/screenshots/fileHelpers.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ function appendFiltersForContentType(
213213
* @param aFpP
214214
* A structure (see definition in internalSave(...) method)
215215
* containing all the data used within this method.
216-
* @param window
216+
* @param win
217217
* The window used for opening the file picker
218218
* @return Promise
219219
* @resolve a boolean. When true, it indicates that the file picker dialog
220220
* is accepted.
221221
*/
222-
function promiseTargetFile(aFpP, window) {
222+
function promiseTargetFile(aFpP, win) {
223223
return (async function() {
224-
let downloadLastDir = new lazy.DownloadLastDir(window);
224+
let downloadLastDir = new lazy.DownloadLastDir(win);
225225

226226
// Default to the user's default downloads directory configured
227227
// through download prefs.
@@ -249,7 +249,7 @@ function promiseTargetFile(aFpP, window) {
249249
let fp = makeFilePicker();
250250
let titleKey = aFpP.fpTitleKey;
251251
fp.init(
252-
window,
252+
win,
253253
ContentAreaUtils.stringBundle.GetStringFromName(titleKey),
254254
Ci.nsIFilePicker.modeSave
255255
);

browser/components/storybook/.storybook/fluent-utils.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ function* generateBundles() {
5151
yield* [storybookBundle];
5252
}
5353

54-
export async function insertFTLIfNeeded(name) {
55-
if (loadedResources.has(name)) {
54+
export async function insertFTLIfNeeded(fileName) {
55+
if (loadedResources.has(fileName)) {
5656
return;
5757
}
5858

5959
// This should be browser, locales-preview or toolkit.
60-
let [root, ...rest] = name.split("/");
60+
let [root, ...rest] = fileName.split("/");
6161
let ftlContents;
6262

6363
// TODO(mstriemer): These seem like they could be combined but I don't want
@@ -66,14 +66,14 @@ export async function insertFTLIfNeeded(name) {
6666
// eslint-disable-next-line no-unsanitized/method
6767
let imported = await import(
6868
/* webpackInclude: /.*[\/\\].*\.ftl$/ */
69-
`toolkit/locales/en-US/${name}`
69+
`toolkit/locales/en-US/${fileName}`
7070
);
7171
ftlContents = imported.default;
7272
} else if (root == "browser") {
7373
// eslint-disable-next-line no-unsanitized/method
7474
let imported = await import(
7575
/* webpackInclude: /.*[\/\\].*\.ftl$/ */
76-
`browser/locales/en-US/${name}`
76+
`browser/locales/en-US/${fileName}`
7777
);
7878
ftlContents = imported.default;
7979
} else if (root == "locales-preview") {
@@ -92,14 +92,14 @@ export async function insertFTLIfNeeded(name) {
9292
ftlContents = imported.default;
9393
}
9494

95-
if (loadedResources.has(name)) {
95+
if (loadedResources.has(fileName)) {
9696
// Seems possible we've attempted to load this twice before the first call
9797
// resolves, so once the first load is complete we can abandon the others.
9898
return;
9999
}
100100

101101
let ftlResource = new FluentResource(ftlContents);
102102
storybookBundle.addResource(ftlResource);
103-
loadedResources.set(name, ftlResource);
103+
loadedResources.set(fileName, ftlResource);
104104
document.l10n.translateRoots();
105105
}

browser/components/storybook/.storybook/preview.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ window.MozXULElement = {
1717

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

browser/components/storybook/stories/credential-management.stories.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export default {
1313

1414
window.MozXULElement.insertFTLIfNeeded("browser/aboutLogins.ftl");
1515

16-
const Template = ({ history }) =>
16+
const Template = ({ historyItems }) =>
1717
html`
18-
<login-timeline .history=${history}></login-timeline>
18+
<login-timeline .history=${historyItems}></login-timeline>
1919
`;
2020

2121
const ACTION_ID_CREATED = "login-item-timeline-action-created";
@@ -24,12 +24,12 @@ const ACTION_ID_USED = "login-item-timeline-action-used";
2424

2525
export const EmptyTimeline = Template.bind({});
2626
EmptyTimeline.args = {
27-
history: [],
27+
historyItems: [],
2828
};
2929

3030
export const TypicalTimeline = Template.bind({});
3131
TypicalTimeline.args = {
32-
history: [
32+
historyItems: [
3333
{ actionId: ACTION_ID_CREATED, time: 1463526500267 },
3434
{ actionId: ACTION_ID_UPDATED, time: 1653621219569 },
3535
{ actionId: ACTION_ID_USED, time: 1561813190300 },
@@ -38,7 +38,7 @@ TypicalTimeline.args = {
3838

3939
export const AllSameDayTimeline = Template.bind({});
4040
AllSameDayTimeline.args = {
41-
history: [
41+
historyItems: [
4242
{ actionId: ACTION_ID_CREATED, time: 1463526500267 },
4343
{ actionId: ACTION_ID_UPDATED, time: 1463526500267 },
4444
{ actionId: ACTION_ID_USED, time: 1463526500267 },

browser/components/storybook/stories/panel-list.stories.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const openMenu = e => {
2222
.toggle(e);
2323
};
2424

25-
const Template = ({ open, items }) =>
25+
const Template = ({ isOpen, items }) =>
2626
html`
2727
<style>
2828
panel-item[icon="passwords"]::part(button) {
@@ -50,7 +50,7 @@ const Template = ({ open, items }) =>
5050
class="ghost-button icon-button bottom end"
5151
@click=${openMenu}
5252
></button>
53-
<panel-list ?stay-open=${open} ?open=${open}>
53+
<panel-list ?stay-open=${isOpen} ?open=${isOpen}>
5454
${items.map(i =>
5555
i == "<hr>"
5656
? html`
@@ -72,7 +72,7 @@ const Template = ({ open, items }) =>
7272

7373
export const Simple = Template.bind({});
7474
Simple.args = {
75-
open: false,
75+
isOpen: false,
7676
items: [
7777
"Item One",
7878
{ text: "Item Two (accesskey w)", accesskey: "w" },
@@ -85,7 +85,7 @@ Simple.args = {
8585

8686
export const Icons = Template.bind({});
8787
Icons.args = {
88-
open: false,
88+
isOpen: false,
8989
items: [
9090
{ text: "Passwords", icon: "passwords" },
9191
{ text: "Settings", icon: "settings" },
@@ -95,5 +95,5 @@ Icons.args = {
9595
export const Open = Template.bind({});
9696
Open.args = {
9797
...Simple.args,
98-
open: true,
98+
isOpen: true,
9999
};

browser/components/textrecognition/textrecognition.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ class TextRecognitionModal {
114114

115115
/**
116116
* After the results are shown, measure how long a user interacts with the modal.
117-
* @param {number} length
117+
* @param {number} textLength
118118
*/
119-
static recordTextLengthTelemetry(length) {
119+
static recordTextLengthTelemetry(textLength) {
120120
const histogram = Services.telemetry.getHistogramById(
121121
"TEXT_RECOGNITION_TEXT_LENGTH"
122122
);
123-
histogram.add(length);
123+
histogram.add(textLength);
124124
}
125125

126126
setupCloseHandler() {

0 commit comments

Comments
 (0)