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({ recordTelemetryEvent({
object: "export", object: "export",
method: "mgmt_menu_item_used", method: "mgmt_menu_item_used",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -17,11 +17,11 @@ window.MozXULElement = {
// For some reason Storybook doesn't watch the static folder. By creating a // 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. // 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 // eslint-disable-next-line no-unsanitized/method
let file = await import( let file = await import(
/* webpackInclude: /.*[\/\\].*\.css$/ */ /* webpackInclude: /.*[\/\\].*\.css$/ */
`browser/themes/shared/${name}` `browser/themes/shared/${resourceName}`
); );
return file; return file;
}, },

View File

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

View File

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