Bug 1864896: Autofix unused function arguments (browser). r=webcompat-reviewers,mconley,fxview-reviewers,desktop-theme-reviewers,omc-reviewers,migration-reviewers,twisniewski,aminomancer,dao,sclements,firefox-desktop-core-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D203005
This commit is contained in:
Dave Townsend 2024-03-19 09:36:35 +00:00
Родитель d4ff9efb67
Коммит a9a51bf046
185 изменённых файлов: 487 добавлений и 526 удалений

Просмотреть файл

@ -281,7 +281,7 @@ export class AboutReaderParent extends JSWindowActorParent {
* @return {Promise}
* @resolves JS object representing the article, or null if no article is found.
*/
async _getArticle(url, browser) {
async _getArticle(url) {
return lazy.ReaderMode.downloadAndParseDocument(url).catch(e => {
if (e && e.newURL) {
// Pass up the error so we can navigate the browser in question to the new URL:

Просмотреть файл

@ -371,7 +371,7 @@ export class ContextMenuChild extends JSWindowActorChild {
}
// Returns true if clicked-on link targets a resource that can be saved.
_isLinkSaveable(aLink) {
_isLinkSaveable() {
// We don't do the Right Thing for news/snews yet, so turn them off
// until we do.
return (
@ -696,7 +696,7 @@ export class ContextMenuChild extends JSWindowActorChild {
* - link
* - linkURI
*/
_cleanContext(aEvent) {
_cleanContext() {
const context = this.context;
const cleanTarget = Object.create(null);

Просмотреть файл

@ -138,7 +138,7 @@ export class FormValidationChild extends JSWindowActorChild {
* Blur event handler in which we disconnect from the form element and
* hide the popup.
*/
_onBlur(aEvent) {
_onBlur() {
if (this._element) {
this._element.removeEventListener("input", this);
this._element.removeEventListener("blur", this);

Просмотреть файл

@ -19,7 +19,7 @@ class PopupShownObserver {
this._weakContext = Cu.getWeakReference(browsingContext);
}
observe(subject, topic, data) {
observe(subject, topic) {
let ctxt = this._weakContext.get();
let actor = ctxt.currentWindowGlobal?.getExistingActor("FormValidation");
if (!actor) {

Просмотреть файл

@ -19,7 +19,7 @@ ChromeUtils.defineLazyGetter(lazy, "gNavigatorBundle", function () {
export const PluginManager = {
gmpCrashes: new Map(),
observe(subject, topic, data) {
observe(subject, topic) {
switch (topic) {
case "gmp-plugin-crash":
this._registerGMPCrash(subject);

Просмотреть файл

@ -50,7 +50,7 @@ var progressListener = {
* the STATE_IS_WINDOW case, which will clear any mappings from
* blockedWindows.
*/
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
onStateChange(aWebProgress, aRequest, aStateFlags) {
if (
aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW &&
aStateFlags & Ci.nsIWebProgressListener.STATE_STOP
@ -64,7 +64,7 @@ var progressListener = {
* onRefreshAttempted has already fired for this DOM Window, will
* send the appropriate refresh blocked data to the parent.
*/
onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
onLocationChange(aWebProgress) {
let win = aWebProgress.DOMWindow;
if (this.blockedWindows.has(win)) {
let data = this.blockedWindows.get(win);
@ -180,7 +180,7 @@ export class RefreshBlockerObserverChild extends JSProcessActorChild {
this.filtersMap = new Map();
}
observe(subject, topic, data) {
observe(subject, topic) {
switch (topic) {
case "webnavigation-create":
case "chrome-webnavigation-create":

Просмотреть файл

@ -213,7 +213,7 @@ function getActorForWindow(window) {
return null;
}
function handlePCRequest(aSubject, aTopic, aData) {
function handlePCRequest(aSubject) {
let { windowID, innerWindowID, callID, isSecure } = aSubject;
let contentWindow = Services.wm.getOuterWindowWithId(windowID);
if (!contentWindow.pendingPeerConnectionRequests) {
@ -235,7 +235,7 @@ function handlePCRequest(aSubject, aTopic, aData) {
}
}
function handleGUMStop(aSubject, aTopic, aData) {
function handleGUMStop(aSubject) {
let contentWindow = Services.wm.getOuterWindowWithId(aSubject.windowID);
let request = {
@ -250,7 +250,7 @@ function handleGUMStop(aSubject, aTopic, aData) {
}
}
function handleGUMRequest(aSubject, aTopic, aData) {
function handleGUMRequest(aSubject) {
// Now that a getUserMedia request has been created, we should check
// to see if we're supposed to have any devices muted. This needs
// to occur after the getUserMedia request is made, since the global
@ -472,7 +472,7 @@ function forgetPendingListsEventually(aContentWindow) {
aContentWindow.removeEventListener("unload", WebRTCChild.handleEvent);
}
function updateIndicators(aSubject, aTopic, aData) {
function updateIndicators(aSubject) {
if (
aSubject instanceof Ci.nsIPropertyBag &&
aSubject.getProperty("requestURL") == kBrowserURL

Просмотреть файл

@ -609,7 +609,7 @@ function prompt(aActor, aBrowser, aRequest) {
actionL10nIds.push({ id }, { id: "webrtc-action-always-block" });
secondaryActions = [
{
callback(aState) {
callback() {
aActor.denyRequest(aRequest);
if (!isNotNowLabelEnabled) {
lazy.SitePermissions.setForPrincipal(
@ -623,7 +623,7 @@ function prompt(aActor, aBrowser, aRequest) {
},
},
{
callback(aState) {
callback() {
aActor.denyRequest(aRequest);
lazy.SitePermissions.setForPrincipal(
principal,
@ -1029,7 +1029,7 @@ function prompt(aActor, aBrowser, aRequest) {
video.srcObject = stream;
video.stream = stream;
doc.getElementById("webRTC-preview").hidden = false;
video.onloadedmetadata = function (e) {
video.onloadedmetadata = function () {
video.play();
};
},

Просмотреть файл

@ -438,7 +438,7 @@ function openBrowserWindow(
});
}
function openPreferences(cmdLine, extraArgs) {
function openPreferences(cmdLine) {
openBrowserWindow(cmdLine, lazy.gSystemPrincipal, "about:preferences");
}

Просмотреть файл

@ -2341,7 +2341,7 @@ BrowserGlue.prototype = {
_badgeIcon();
}
lazy.RemoteSettings(STUDY_ADDON_COLLECTION_KEY).on("sync", async event => {
lazy.RemoteSettings(STUDY_ADDON_COLLECTION_KEY).on("sync", async () => {
Services.prefs.setBoolPref(PREF_ION_NEW_STUDIES_AVAILABLE, true);
});
@ -2436,7 +2436,7 @@ BrowserGlue.prototype = {
lazy.Sanitizer.onStartup();
this._maybeShowRestoreSessionInfoBar();
this._scheduleStartupIdleTasks();
this._lateTasksIdleObserver = (idleService, topic, data) => {
this._lateTasksIdleObserver = (idleService, topic) => {
if (topic == "idle") {
idleService.removeIdleObserver(
this._lateTasksIdleObserver,
@ -3699,7 +3699,7 @@ BrowserGlue.prototype = {
"account-connection-connected",
]);
let clickCallback = (subject, topic, data) => {
let clickCallback = (subject, topic) => {
if (topic != "alertclickcallback") {
return;
}
@ -4712,7 +4712,7 @@ BrowserGlue.prototype = {
}
const title = await lazy.accountsL10n.formatValue(titleL10nId);
const clickCallback = (obsSubject, obsTopic, obsData) => {
const clickCallback = (obsSubject, obsTopic) => {
if (obsTopic == "alertclickcallback") {
win.gBrowser.selectedTab = firstTab;
}
@ -4751,7 +4751,7 @@ BrowserGlue.prototype = {
tab = win.gBrowser.addWebTab(url);
}
tab.attention = true;
let clickCallback = (subject, topic, data) => {
let clickCallback = (subject, topic) => {
if (topic != "alertclickcallback") {
return;
}
@ -4780,7 +4780,7 @@ BrowserGlue.prototype = {
: { id: "account-connection-connected-with-noname" },
]);
let clickCallback = async (subject, topic, data) => {
let clickCallback = async (subject, topic) => {
if (topic != "alertclickcallback") {
return;
}
@ -4815,7 +4815,7 @@ BrowserGlue.prototype = {
"account-connection-disconnected",
]);
let clickCallback = (subject, topic, data) => {
let clickCallback = (subject, topic) => {
if (topic != "alertclickcallback") {
return;
}
@ -4870,7 +4870,7 @@ BrowserGlue.prototype = {
const TOGGLE_ENABLED_PREF =
"media.videocontrols.picture-in-picture.video-toggle.enabled";
const observe = (subject, topic, data) => {
const observe = (subject, topic) => {
const enabled = Services.prefs.getBoolPref(TOGGLE_ENABLED_PREF, false);
Services.telemetry.scalarSet("pictureinpicture.toggle_enabled", enabled);
@ -6475,11 +6475,11 @@ export var AboutHomeStartupCache = {
/** nsICacheEntryOpenCallback **/
onCacheEntryCheck(aEntry) {
onCacheEntryCheck() {
return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
},
onCacheEntryAvailable(aEntry, aNew, aResult) {
onCacheEntryAvailable(aEntry) {
this.log.trace("Cache entry is available.");
this._cacheEntry = aEntry;

Просмотреть файл

@ -70,7 +70,7 @@ class AboutWelcomeObserver {
this.win.addEventListener("unload", this.onWindowClose, { once: true });
}
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
switch (aTopic) {
case "quit-application":
this.terminateReason = AWTerminate.APP_SHUT_DOWN;

Просмотреть файл

@ -97,8 +97,8 @@ const TEST_GLOBAL = {
JSWindowActorParent,
JSWindowActorChild,
AboutReaderParent: {
addMessageListener: (messageName, listener) => {},
removeMessageListener: (messageName, listener) => {},
addMessageListener: (_messageName, _listener) => {},
removeMessageListener: (_messageName, _listener) => {},
},
AboutWelcomeTelemetry: class {
submitGleanPingForPing() {}
@ -281,8 +281,8 @@ const TEST_GLOBAL = {
},
dump() {},
EveryWindow: {
registerCallback: (id, init, uninit) => {},
unregisterCallback: id => {},
registerCallback: (_id, _init, _uninit) => {},
unregisterCallback: _id => {},
},
setTimeout: window.setTimeout.bind(window),
clearTimeout: window.clearTimeout.bind(window),
@ -402,7 +402,7 @@ const TEST_GLOBAL = {
},
urlFormatter: { formatURL: str => str, formatURLPref: str => str },
mm: {
addMessageListener: (msg, cb) => this.receiveMessage(),
addMessageListener: (_msg, _cb) => this.receiveMessage(),
removeMessageListener() {},
},
obs: {
@ -412,7 +412,7 @@ const TEST_GLOBAL = {
},
telemetry: {
setEventRecordingEnabled: () => {},
recordEvent: eventDetails => {},
recordEvent: _eventDetails => {},
scalarSet: () => {},
keyedScalarAdd: () => {},
},
@ -570,7 +570,7 @@ const TEST_GLOBAL = {
finish: () => {},
},
Sampling: {
ratioSample(seed, ratios) {
ratioSample(_seed, _ratios) {
return Promise.resolve(0);
},
},

Просмотреть файл

@ -236,7 +236,7 @@ export const ContentAnalysis = {
},
// nsIObserver
async observe(aSubj, aTopic, aData) {
async observe(aSubj, aTopic) {
switch (aTopic) {
case "quit-application-requested": {
let pendingRequests =

Просмотреть файл

@ -121,7 +121,7 @@ add_task(async function test() {
// Insert the media key.
await new Promise(resolve => {
session.addEventListener("message", function (event) {
session.addEventListener("message", function () {
session
.update(aKeyInfo.keyObj)
.then(() => {

Просмотреть файл

@ -20,7 +20,7 @@ function getIconFile() {
loadUsingSystemPrincipal: true,
contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON,
},
function (inputStream, status) {
function (inputStream) {
let size = inputStream.available();
gFaviconData = NetUtil.readInputStreamToString(inputStream, size);
resolve();

Просмотреть файл

@ -108,7 +108,7 @@ async function setupEMEKey(browser) {
// Insert the EME key.
await new Promise(resolve => {
session.addEventListener("message", function (event) {
session.addEventListener("message", function () {
session
.update(aKeyInfo.keyObj)
.then(() => {

Просмотреть файл

@ -86,11 +86,11 @@ function OpenCacheEntry(key, where, flags, lci) {
CacheListener.prototype = {
QueryInterface: ChromeUtils.generateQI(["nsICacheEntryOpenCallback"]),
onCacheEntryCheck(entry) {
onCacheEntryCheck() {
return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
},
onCacheEntryAvailable(entry, isnew, status) {
onCacheEntryAvailable() {
resolve();
},
@ -311,7 +311,7 @@ async function test_storage_cleared() {
let storeRequest = store.get(1);
await new Promise(done => {
storeRequest.onsuccess = event => {
storeRequest.onsuccess = () => {
let res = storeRequest.result;
Assert.equal(
res.userContext,

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function () {
});
info("Synthesize a mouse click and wait for a new tab...");
let newTab = await new Promise((resolve, reject) => {
let newTab = await new Promise(resolve => {
gBrowser.tabContainer.addEventListener(
"TabOpen",
function (openEvent) {

Просмотреть файл

@ -111,7 +111,7 @@ function promiseUnregister(info) {
ok(aState, "ServiceWorkerRegistration exists");
resolve();
},
unregisterFailed(aState) {
unregisterFailed() {
ok(false, "unregister should succeed");
},
},

Просмотреть файл

@ -24,7 +24,7 @@ add_task(async function test() {
});
let browser1 = gBrowser.getBrowserForTab(tab1);
await BrowserTestUtils.browserLoaded(browser1);
await SpecialPowers.spawn(browser1, [], function (opts) {
await SpecialPowers.spawn(browser1, [], function () {
content.window.name = "tab-1";
});
@ -34,7 +34,7 @@ add_task(async function test() {
});
let browser2 = gBrowser.getBrowserForTab(tab2);
await BrowserTestUtils.browserLoaded(browser2);
await SpecialPowers.spawn(browser2, [], function (opts) {
await SpecialPowers.spawn(browser2, [], function () {
content.window.name = "tab-2";
});

Просмотреть файл

@ -25,7 +25,7 @@
store.createIndex("userContext", "userContext", { unique: false });
};
request.onsuccess = event => {
request.onsuccess = () => {
let db = request.result;
let transaction = db.transaction(["obj"], "readwrite");
let store = transaction.objectStore("obj");

Просмотреть файл

@ -1454,7 +1454,7 @@ var CustomizableUIInternal = {
}
},
onCustomizeEnd(aWindow) {
onCustomizeEnd() {
this._clearPreviousUIState();
},
@ -6215,7 +6215,7 @@ class OverflowableToolbar {
* nsIObserver implementation starts here.
*/
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
// This nsIObserver method allows us to defer initialization until after
// this window has finished painting and starting up.
if (

Просмотреть файл

@ -155,7 +155,7 @@ export const CustomizableWidgets = [
panelview.panelMultiView.addEventListener("PanelMultiViewHidden", this);
window.addEventListener("unload", this);
},
onViewHiding(event) {
onViewHiding() {
lazy.log.debug("History view is being hidden!");
},
onPanelMultiViewHidden(event) {
@ -175,7 +175,7 @@ export const CustomizableWidgets = [
}
panelMultiView.removeEventListener("PanelMultiViewHidden", this);
},
onWindowUnload(event) {
onWindowUnload() {
if (this._panelMenuView) {
delete this._panelMenuView;
}

Просмотреть файл

@ -70,7 +70,7 @@ function closeGlobalTab() {
}
var gTabsProgressListener = {
onLocationChange(aBrowser, aWebProgress, aRequest, aLocation, aFlags) {
onLocationChange(aBrowser, aWebProgress, aRequest, aLocation) {
// Tear down customize mode when the customize mode tab loads some other page.
// Customize mode will be re-entered if "about:blank" is loaded again, so
// don't tear down in this case.
@ -663,7 +663,7 @@ CustomizeMode.prototype = {
});
},
async addToToolbar(aNode, aReason) {
async addToToolbar(aNode) {
aNode = this._getCustomizableChildForNode(aNode);
if (aNode.localName == "toolbarpaletteitem" && aNode.firstElementChild) {
aNode = aNode.firstElementChild;
@ -1282,15 +1282,15 @@ CustomizeMode.prototype = {
this._onUIChange();
},
onWidgetMoved(aWidgetId, aArea, aOldPosition, aNewPosition) {
onWidgetMoved() {
this._onUIChange();
},
onWidgetAdded(aWidgetId, aArea, aPosition) {
onWidgetAdded() {
this._onUIChange();
},
onWidgetRemoved(aWidgetId, aArea) {
onWidgetRemoved() {
this._onUIChange();
},
@ -1649,7 +1649,7 @@ CustomizeMode.prototype = {
delete this.paletteDragHandler;
},
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
switch (aTopic) {
case "nsPref:changed":
this._updateResetButton();
@ -2329,7 +2329,7 @@ CustomizeMode.prototype = {
}
},
_setGridDragActive(aDragOverNode, aDraggedItem, aValue) {
_setGridDragActive(aDragOverNode, aDraggedItem) {
let targetArea = this._getCustomizableParent(aDragOverNode);
let draggedWrapper = this.$("wrapper-" + aDraggedItem.id);
let originArea = this._getCustomizableParent(draggedWrapper);
@ -2428,7 +2428,7 @@ CustomizeMode.prototype = {
return aElement.closest(areas.map(a => "#" + CSS.escape(a)).join(","));
},
_getDragOverNode(aEvent, aAreaElement, aAreaType, aDraggedItemId) {
_getDragOverNode(aEvent, aAreaElement, aAreaType) {
let expectedParent =
CustomizableUI.getCustomizationTarget(aAreaElement) || aAreaElement;
if (!expectedParent.contains(aEvent.target)) {

Просмотреть файл

@ -568,7 +568,7 @@ const PanelUI = {
}
},
onWidgetAfterDOMChange(aNode, aNextNode, aContainer, aWasRemoval) {
onWidgetAfterDOMChange(aNode, aNextNode, aContainer) {
if (aContainer == this.overflowFixedList) {
this.updateOverflowStatus();
}
@ -601,7 +601,7 @@ const PanelUI = {
}
},
_onHelpViewShow(aEvent) {
_onHelpViewShow() {
// Call global menu setup function
buildHelpMenu();

Просмотреть файл

@ -44,7 +44,7 @@ function promiseFullscreenChange() {
reject("Fullscreen change did not happen within " + 20000 + "ms");
}, 20000);
function onFullscreenChange(event) {
function onFullscreenChange() {
clearTimeout(timeoutId);
window.removeEventListener("fullscreen", onFullscreenChange, true);
info("Fullscreen event received");

Просмотреть файл

@ -47,7 +47,7 @@ function waitForPageLoad(aTab) {
reject("Page didn't load within " + 20000 + "ms");
}, 20000);
async function onTabLoad(event) {
async function onTabLoad() {
clearTimeout(timeoutId);
aTab.linkedBrowser.removeEventListener("load", onTabLoad, true);
info("Tab event received: load");

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function test_PanelMultiView_toggle_with_other_popup() {
gBrowser,
url: TEST_URL,
},
async function (browser) {
async function () {
// 1. Open the main menu.
await gCUITestUtils.openMainMenu();

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function () {
let privateWindow = null;
let observerWindowOpened = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic == "domwindowopened") {
privateWindow = aSubject;
privateWindow.addEventListener(

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function () {
let newWindow = null;
let observerWindowOpened = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic == "domwindowopened") {
newWindow = aSubject;
newWindow.addEventListener(

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function () {
await BrowserTestUtils.withNewTab(
{ gBrowser, url: "http://example.com", waitForLoad: true },
async function (browser) {
async function () {
CustomizableUI.addWidgetToArea(
"zoom-controls",
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL

Просмотреть файл

@ -11,7 +11,7 @@ add_task(async function () {
let otherToolbox = newWindow.gNavToolbox;
let handlerCalledCount = 0;
let handler = ev => {
let handler = () => {
handlerCalledCount++;
};

Просмотреть файл

@ -29,7 +29,7 @@ function expectCommandUpdate(count, testWindow = window) {
supportsCommand(cmd) {
return cmd == "cmd_delete";
},
isCommandEnabled(cmd) {
isCommandEnabled() {
if (!count) {
ok(false, "unexpected update");
reject();

Просмотреть файл

@ -14,7 +14,7 @@ add_task(async function testMainActionCalled() {
url: "about:blank",
};
await BrowserTestUtils.withNewTab(options, function (browser) {
await BrowserTestUtils.withNewTab(options, function () {
is(
PanelUI.notificationPanel.state,
"closed",
@ -77,7 +77,7 @@ add_task(async function testSecondaryActionWorkflow() {
url: "about:blank",
};
await BrowserTestUtils.withNewTab(options, async function (browser) {
await BrowserTestUtils.withNewTab(options, async function () {
is(
PanelUI.notificationPanel.state,
"closed",
@ -167,7 +167,7 @@ add_task(async function testDownloadingBadge() {
url: "about:blank",
};
await BrowserTestUtils.withNewTab(options, async function (browser) {
await BrowserTestUtils.withNewTab(options, async function () {
let mainActionCalled = false;
let mainAction = {
callback: () => {
@ -225,7 +225,7 @@ add_task(async function testDownloadingBadge() {
* then we display any other badges that are remaining.
*/
add_task(async function testInteractionWithBadges() {
await BrowserTestUtils.withNewTab("about:blank", async function (browser) {
await BrowserTestUtils.withNewTab("about:blank", async function () {
// Remove the fxa toolbar button from the navbar to ensure the notification
// is displayed on the app menu button.
let { CustomizableUI } = ChromeUtils.importESModule(
@ -328,7 +328,7 @@ add_task(async function testInteractionWithBadges() {
* This tests that adding a badge will not dismiss any existing doorhangers.
*/
add_task(async function testAddingBadgeWhileDoorhangerIsShowing() {
await BrowserTestUtils.withNewTab("about:blank", function (browser) {
await BrowserTestUtils.withNewTab("about:blank", function () {
is(
PanelUI.notificationPanel.state,
"closed",
@ -468,7 +468,7 @@ add_task(async function testMultipleBadges() {
* Tests that non-badges also operate like a stack.
*/
add_task(async function testMultipleNonBadges() {
await BrowserTestUtils.withNewTab("about:blank", async function (browser) {
await BrowserTestUtils.withNewTab("about:blank", async function () {
is(
PanelUI.notificationPanel.state,
"closed",

Просмотреть файл

@ -20,7 +20,7 @@ function waitForDocshellActivated() {
content.document,
"visibilitychange",
true /* capture */,
aEvent => {
() => {
return content.browsingContext.isActive;
}
);

Просмотреть файл

@ -15,7 +15,7 @@ add_task(async function testDoesNotShowDoorhangerForBackgroundWindow() {
url: "about:blank",
};
await BrowserTestUtils.withNewTab(options, async function (browser) {
await BrowserTestUtils.withNewTab(options, async function () {
let win = await BrowserTestUtils.openNewBrowserWindow();
await SimpleTest.promiseFocus(win);
let mainActionCalled = false;
@ -95,7 +95,7 @@ add_task(
url: "about:blank",
};
await BrowserTestUtils.withNewTab(options, async function (browser) {
await BrowserTestUtils.withNewTab(options, async function () {
let win = await BrowserTestUtils.openNewBrowserWindow();
await SimpleTest.promiseFocus(win);
AppMenuNotifications.showNotification("update-manual", { callback() {} });
@ -140,7 +140,7 @@ add_task(
url: "about:blank",
};
await BrowserTestUtils.withNewTab(options, async function (browser) {
await BrowserTestUtils.withNewTab(options, async function () {
let win = await BrowserTestUtils.openNewBrowserWindow();
await SimpleTest.promiseFocus(win);
AppMenuNotifications.showNotification("update-manual", { callback() {} });

Просмотреть файл

@ -18,7 +18,7 @@ add_task(async function () {
await finishedCustomizing;
let startedCount = 0;
let handler = e => startedCount++;
let handler = () => startedCount++;
gNavToolbox.addEventListener("customizationstarting", handler);
await startCustomizing();
CustomizableUI.removeWidgetFromArea("stop-reload-button");

Просмотреть файл

@ -267,7 +267,7 @@ function openAndLoadWindow(aOptions, aWaitForDelayedStartup = false) {
return new Promise(resolve => {
let win = OpenBrowserWindow(aOptions);
if (aWaitForDelayedStartup) {
Services.obs.addObserver(function onDS(aSubject, aTopic, aData) {
Services.obs.addObserver(function onDS(aSubject) {
if (aSubject != win) {
return;
}
@ -309,7 +309,7 @@ function promisePanelElementShown(win, aPanel) {
let timeoutId = win.setTimeout(() => {
reject("Panel did not show within 20 seconds.");
}, 20000);
function onPanelOpen(e) {
function onPanelOpen() {
aPanel.removeEventListener("popupshown", onPanelOpen);
win.clearTimeout(timeoutId);
resolve();
@ -328,7 +328,7 @@ function promisePanelElementHidden(win, aPanel) {
let timeoutId = win.setTimeout(() => {
reject("Panel did not hide within 20 seconds.");
}, 20000);
function onPanelClose(e) {
function onPanelClose() {
aPanel.removeEventListener("popuphidden", onPanelClose);
win.clearTimeout(timeoutId);
executeSoon(resolve);
@ -352,7 +352,7 @@ function subviewShown(aSubview) {
let timeoutId = win.setTimeout(() => {
reject("Subview (" + aSubview.id + ") did not show within 20 seconds.");
}, 20000);
function onViewShown(e) {
function onViewShown() {
aSubview.removeEventListener("ViewShown", onViewShown);
win.clearTimeout(timeoutId);
resolve();
@ -367,7 +367,7 @@ function subviewHidden(aSubview) {
let timeoutId = win.setTimeout(() => {
reject("Subview (" + aSubview.id + ") did not hide within 20 seconds.");
}, 20000);
function onViewHiding(e) {
function onViewHiding() {
aSubview.removeEventListener("ViewHiding", onViewHiding);
win.clearTimeout(timeoutId);
resolve();
@ -406,7 +406,7 @@ function promiseTabLoadEvent(aTab, aURL) {
* @return {Promise} resolved when the requisite mutation shows up.
*/
function promiseAttributeMutation(aNode, aAttribute, aFilterFn) {
return new Promise((resolve, reject) => {
return new Promise(resolve => {
info("waiting for mutation of attribute '" + aAttribute + "'.");
let obs = new MutationObserver(mutations => {
for (let mut of mutations) {

Просмотреть файл

@ -196,7 +196,7 @@ export const DoHConfigController = {
return;
}
Services.obs.addObserver(function obs(sub, top, data) {
Services.obs.addObserver(function obs() {
Services.obs.removeObserver(obs, lazy.Region.REGION_TOPIC);
updateRegionAndResolve();
}, lazy.Region.REGION_TOPIC);

Просмотреть файл

@ -13,7 +13,7 @@ async function setPrefAndWaitForConfigFlush(pref, value) {
await configFlushedPromise;
}
async function clearPrefAndWaitForConfigFlush(pref, value) {
async function clearPrefAndWaitForConfigFlush(pref) {
let configFlushedPromise = DoHTestUtils.waitForConfigFlush();
Preferences.reset(pref);
await configFlushedPromise;

Просмотреть файл

@ -81,23 +81,23 @@ export var Policies = {
// Used for cleaning up policies.
// Use the same timing that you used for setting up the policy.
_cleanup: {
onBeforeAddons(manager) {
onBeforeAddons() {
if (Cu.isInAutomation || isXpcshell) {
console.log("_cleanup from onBeforeAddons");
clearBlockedAboutPages();
}
},
onProfileAfterChange(manager) {
onProfileAfterChange() {
if (Cu.isInAutomation || isXpcshell) {
console.log("_cleanup from onProfileAfterChange");
}
},
onBeforeUIStartup(manager) {
onBeforeUIStartup() {
if (Cu.isInAutomation || isXpcshell) {
console.log("_cleanup from onBeforeUIStartup");
}
},
onAllWindowsRestored(manager) {
onAllWindowsRestored() {
if (Cu.isInAutomation || isXpcshell) {
console.log("_cleanup from onAllWindowsRestored");
}
@ -112,7 +112,7 @@ export var Policies = {
AllowedDomainsForApps: {
onBeforeAddons(manager, param) {
Services.obs.addObserver(function (subject, topic, data) {
Services.obs.addObserver(function (subject) {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (channel.URI.host.endsWith(".google.com")) {
channel.setRequestHeader("X-GoogApps-Allowed-Domains", param, true);
@ -2792,7 +2792,7 @@ function clearBlockedAboutPages() {
gBlockedAboutPages = [];
}
function blockAboutPage(manager, feature, neededOnContentProcess = false) {
function blockAboutPage(manager, feature) {
addChromeURLBlocker();
gBlockedAboutPages.push(feature);
@ -2828,7 +2828,7 @@ let ChromeURLBlockPolicy = {
}
return Ci.nsIContentPolicy.ACCEPT;
},
shouldProcess(contentLocation, loadInfo) {
shouldProcess() {
return Ci.nsIContentPolicy.ACCEPT;
},
classDescription: "Policy Engine Content Policy",

Просмотреть файл

@ -130,10 +130,10 @@ export let WebsiteFilter = {
}
return Ci.nsIContentPolicy.ACCEPT;
},
shouldProcess(contentLocation, loadInfo) {
shouldProcess() {
return Ci.nsIContentPolicy.ACCEPT;
},
observe(subject, topic, data) {
observe(subject) {
try {
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
if (

Просмотреть файл

@ -58,7 +58,7 @@ add_task(async function test_pageinfo_permissions() {
"xr",
];
await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function (browser) {
await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function () {
let pageInfo = BrowserPageInfo(TEST_ORIGIN, "permTab");
await BrowserTestUtils.waitForEvent(pageInfo, "load");

Просмотреть файл

@ -96,7 +96,7 @@ function waitForAboutDialog() {
var domwindow = aXULWindow.docShell.domWindow;
domwindow.addEventListener("load", aboutDialogOnLoad, true);
},
onCloseWindow: aXULWindow => {},
onCloseWindow: () => {},
};
Services.wm.addListener(listener);

Просмотреть файл

@ -73,7 +73,7 @@ async function testPageBlockedByPolicy(page, policyJSON) {
async browser => {
BrowserTestUtils.startLoadingURIString(browser, page);
await BrowserTestUtils.browserLoaded(browser, false, page, true);
await SpecialPowers.spawn(browser, [page], async function (innerPage) {
await SpecialPowers.spawn(browser, [page], async function () {
ok(
content.document.documentURI.startsWith(
"about:neterror?e=blockedByPolicy"

Просмотреть файл

@ -237,7 +237,7 @@ async function testPageBlockedByPolicy(page, policyJSON) {
async browser => {
BrowserTestUtils.startLoadingURIString(browser, page);
await BrowserTestUtils.browserLoaded(browser, false, page, true);
await SpecialPowers.spawn(browser, [page], async function (innerPage) {
await SpecialPowers.spawn(browser, [page], async function () {
ok(
content.document.documentURI.startsWith(
"about:neterror?e=blockedByPolicy"

Просмотреть файл

@ -116,7 +116,7 @@ function checkUserPref(prefName, prefValue) {
);
}
function checkClearPref(prefName, prefValue) {
function checkClearPref(prefName) {
equal(
Services.prefs.prefHasUserValue(prefName),
false,

Просмотреть файл

@ -12,7 +12,7 @@ const REQ_LOC_CHANGE_EVENT = "intl:requested-locales-changed";
function promiseLocaleChanged(requestedLocale) {
return new Promise(resolve => {
let localeObserver = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
switch (aTopic) {
case REQ_LOC_CHANGE_EVENT:
let reqLocs = Services.locale.requestedLocales;
@ -26,10 +26,10 @@ function promiseLocaleChanged(requestedLocale) {
});
}
function promiseLocaleNotChanged(requestedLocale) {
function promiseLocaleNotChanged() {
return new Promise(resolve => {
let localeObserver = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
switch (aTopic) {
case REQ_LOC_CHANGE_EVENT:
ok(false, "Locale should not change.");

Просмотреть файл

@ -143,7 +143,7 @@ class OpenTabsTarget extends EventTarget {
windowList.map(win => win.delayedStartupPromise)
).then(() => {
// re-filter the list as properties might have changed in the interim
return windowList.filter(win => this.includeWindowFilter);
return windowList.filter(() => this.includeWindowFilter);
});
}
@ -377,7 +377,7 @@ const gExclusiveWindows = new (class {
constructor() {
Services.obs.addObserver(this, "domwindowclosed");
}
observe(subject, topic, data) {
observe(subject) {
let win = subject;
let winTarget = this.perWindowInstances.get(win);
if (winTarget) {

Просмотреть файл

@ -616,7 +616,7 @@ export const TabsSetupFlowManager = new (class {
);
}
syncOpenTabs(containerElem) {
syncOpenTabs() {
// Flip the pref on.
// The observer should trigger re-evaluating state and advance to next step
Services.prefs.setBoolPref(SYNC_TABS_PREF, true);

Просмотреть файл

@ -148,7 +148,7 @@ export default class FxviewTabList extends MozLitElement {
"timeMsPref",
"browser.tabs.firefox-view.updateTimeMs",
NOW_THRESHOLD_MS,
(prefName, oldVal, newVal) => {
() => {
this.clearIntervalTimer();
if (!this.isConnected) {
return;

Просмотреть файл

@ -339,7 +339,7 @@ class OpenTabsInView extends ViewPage {
></view-opentabs-card>`;
}
handleEvent({ detail, target, type }) {
handleEvent({ detail, type }) {
if (this.recentBrowsing && type === "fxview-search-textbox-query") {
this.onSearchQuery({ detail });
return;

Просмотреть файл

@ -65,7 +65,7 @@ class RecentlyClosedTabsInView extends ViewPage {
tabList: "fxview-tab-list",
};
observe(subject, topic, data) {
observe(subject, topic) {
if (
topic == SS_NOTIFY_CLOSED_OBJECTS_CHANGED ||
(topic == SS_NOTIFY_BROWSER_SHUTDOWN_FLUSH &&

Просмотреть файл

@ -700,7 +700,7 @@ class SyncedTabsInView extends ViewPage {
this.toggleVisibilityInCardContainer();
}
sendTabTelemetry(numTabs) {
sendTabTelemetry() {
/*
Services.telemetry.recordEvent(
"firefoxview_next",

Просмотреть файл

@ -131,7 +131,7 @@ async function moreMenuSetup() {
}
add_task(async function test_close_open_tab() {
await withFirefoxView({}, async browser => {
await withFirefoxView({}, async () => {
const [cards, rows] = await moreMenuSetup();
const firstTab = rows[0];
const tertiaryButtonEl = firstTab.tertiaryButtonEl;
@ -321,7 +321,7 @@ add_task(async function test_send_device_submenu() {
.stub(gSync, "getSendTabTargets")
.callsFake(() => fxaDevicesWithCommands);
await withFirefoxView({}, async browser => {
await withFirefoxView({}, async () => {
// TEST_URL1 is our only tab, left over from previous test
Assert.deepEqual(
getVisibleTabURLs(),

Просмотреть файл

@ -148,7 +148,7 @@ export class ViewPage extends ViewPageContent {
this.windowResizeTask?.arm();
}
onVisibilityChange(event) {
onVisibilityChange() {
if (this.isVisible) {
this.paused = false;
this.viewVisibleCallback();

Просмотреть файл

@ -444,7 +444,7 @@ async function setup(cachedAddons) {
document
.getElementById("join-ion-accept-dialog-button")
.addEventListener("click", async event => {
.addEventListener("click", async () => {
const ionId = Services.prefs.getStringPref(PREF_ION_ID, null);
if (!ionId) {
@ -501,7 +501,7 @@ async function setup(cachedAddons) {
document
.getElementById("leave-ion-accept-dialog-button")
.addEventListener("click", async event => {
.addEventListener("click", async () => {
const completedStudies = Services.prefs.getStringPref(
PREF_ION_COMPLETED_STUDIES,
"{}"
@ -567,7 +567,7 @@ async function setup(cachedAddons) {
document
.getElementById("join-study-accept-dialog-button")
.addEventListener("click", async event => {
.addEventListener("click", async () => {
const dialog = document.getElementById("join-study-consent-dialog");
const studyAddonId = dialog.getAttribute("addon-id");
toggleEnrolled(studyAddonId, cachedAddons).then(dialog.close());
@ -575,7 +575,7 @@ async function setup(cachedAddons) {
document
.getElementById("leave-study-accept-dialog-button")
.addEventListener("click", async event => {
.addEventListener("click", async () => {
const dialog = document.getElementById("leave-study-consent-dialog");
const studyAddonId = dialog.getAttribute("addon-id");
await toggleEnrolled(studyAddonId, cachedAddons).then(dialog.close());
@ -597,7 +597,7 @@ async function setup(cachedAddons) {
};
AddonManager.addAddonListener(addonsListener);
window.addEventListener("unload", event => {
window.addEventListener("unload", () => {
AddonManager.removeAddonListener(addonsListener);
});
}
@ -639,7 +639,7 @@ function updateContents(contents) {
}
}
document.addEventListener("DOMContentLoaded", async domEvent => {
document.addEventListener("DOMContentLoaded", async () => {
toggleContentBasedOnLocale();
showEnrollmentStatus();

Просмотреть файл

@ -321,7 +321,7 @@ add_task(async function testBadDefaultAddon() {
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
async function taskFn() {
const beforePref = Services.prefs.getStringPref(PREF_ION_ID, null);
Assert.strictEqual(
beforePref,
@ -402,7 +402,7 @@ add_task(async function testAboutPage() {
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
async function taskFn() {
const beforePref = Services.prefs.getStringPref(PREF_ION_ID, null);
Assert.strictEqual(
beforePref,
@ -694,19 +694,16 @@ add_task(async function testAboutPage() {
// Wait for deletion ping, uninstalls, and UI updates...
const ionUnenrolled = await new Promise((resolve, reject) => {
Services.prefs.addObserver(
PREF_ION_ID,
function observer(subject, topic, data) {
try {
const prefValue = Services.prefs.getStringPref(PREF_ION_ID, null);
Services.prefs.removeObserver(PREF_ION_ID, observer);
resolve(prefValue);
} catch (ex) {
Services.prefs.removeObserver(PREF_ION_ID, observer);
reject(ex);
}
Services.prefs.addObserver(PREF_ION_ID, function observer() {
try {
const prefValue = Services.prefs.getStringPref(PREF_ION_ID, null);
Services.prefs.removeObserver(PREF_ION_ID, observer);
resolve(prefValue);
} catch (ex) {
Services.prefs.removeObserver(PREF_ION_ID, observer);
reject(ex);
}
);
});
});
ok(!ionUnenrolled, "after accepting unenrollment, Ion pref is null.");
@ -795,7 +792,7 @@ add_task(async function testEnrollmentPings() {
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
async function taskFn() {
const beforePref = Services.prefs.getStringPref(PREF_ION_ID, null);
Assert.strictEqual(
beforePref,
@ -984,7 +981,7 @@ add_task(async function testContentReplacement() {
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
async function taskFn() {
// Check that text was updated from Remote Settings.
console.log("debug:", content.document.getElementById("title").innerHTML);
Assert.equal(
@ -1042,7 +1039,7 @@ add_task(async function testBadContentReplacement() {
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
async function taskFn() {
// Check that text was updated from Remote Settings.
Assert.equal(
content.document.getElementById("join-ion-consent").innerHTML,
@ -1081,7 +1078,7 @@ add_task(async function testLocaleGating() {
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
async function taskFn() {
const localeNotificationBar = content.document.getElementById(
"locale-notification"
);
@ -1107,7 +1104,7 @@ add_task(async function testLocaleGating() {
url: "about:ion",
gBrowser,
},
async function taskFn(browser) {
async function taskFn() {
const localeNotificationBar = content.document.getElementById(
"locale-notification"
);

Просмотреть файл

@ -14,7 +14,7 @@ module.exports = {
"no-multi-str": "error",
"no-return-assign": "error",
"no-shadow": "error",
"no-unused-vars": ["error", { args: "after-used", vars: "all" }],
"no-unused-vars": ["error", { argsIgnorePattern: "^_", vars: "all" }],
strict: ["error", "global"],
yoda: "error",
},
@ -26,7 +26,7 @@ module.exports = {
"no-unused-vars": [
"error",
{
args: "none",
argsIgnorePattern: "^_",
vars: "local",
},
],

Просмотреть файл

@ -138,11 +138,10 @@ export class FileMigratorBase {
* from the native file picker. This will not be called if the user
* chooses to cancel the native file picker.
*
* @param {string} filePath
* @param {string} _filePath
* The path that the user selected from the native file picker.
*/
// eslint-disable-next-line no-unused-vars
async migrate(filePath) {
async migrate(_filePath) {
throw new Error("FileMigrator.migrate must be overridden.");
}
}

Просмотреть файл

@ -141,7 +141,7 @@ export class MigratorBase {
* bookmarks file exists.
*
* @abstract
* @param {object|string} aProfile
* @param {object|string} _aProfile
* The profile from which data may be imported, or an empty string
* in the case of a single-profile migrator.
* In the case of multiple-profiles migrator, it is guaranteed that
@ -149,8 +149,7 @@ export class MigratorBase {
* above).
* @returns {Promise<MigratorResource[]>|MigratorResource[]}
*/
// eslint-disable-next-line no-unused-vars
getResources(aProfile) {
getResources(_aProfile) {
throw new Error("getResources must be overridden");
}
@ -223,14 +222,13 @@ export class MigratorBase {
* to getPermissions resolves to true, that the MigratorBase will be able to
* get read access to all of the resources it needs to do a migration.
*
* @param {DOMWindow} win
* @param {DOMWindow} _win
* The top-level DOM window hosting the UI that is requesting the permission.
* This can be used to, for example, anchor a file picker window to the
* same window that is hosting the migration UI.
* @returns {Promise<boolean>}
*/
// eslint-disable-next-line no-unused-vars
async getPermissions(win) {
async getPermissions(_win) {
return Promise.resolve(true);
}

Просмотреть файл

@ -56,7 +56,7 @@ function cacheDataForContext(loadContextInfo) {
return new Promise(resolve => {
let cacheEntries = [];
let cacheVisitor = {
onCacheStorageInfo(num, consumption) {},
onCacheStorageInfo() {},
onCacheEntryInfo(uri, idEnhance) {
cacheEntries.push({ uri, idEnhance });
},
@ -257,7 +257,7 @@ async function doTest(aBrowser) {
}
// The check function, which checks the number of cache entries.
async function doCheck(aShouldIsolate, aInputA, aInputB) {
async function doCheck(aShouldIsolate) {
let expectedEntryCount = 1;
let data = [];
data = data.concat(

Просмотреть файл

@ -56,7 +56,7 @@ function clearAllPlacesFavicons() {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic === "places-favicons-expired") {
resolve();
Services.obs.removeObserver(observer, "places-favicons-expired");
@ -77,7 +77,7 @@ function observeFavicon(aFirstPartyDomain, aExpectedCookie, aPageURI) {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
// Make sure that the topic is 'http-on-modify-request'.
if (aTopic === "http-on-modify-request") {
// We check the firstPartyDomain for the originAttributes of the loading
@ -136,7 +136,7 @@ function observeFavicon(aFirstPartyDomain, aExpectedCookie, aPageURI) {
function waitOnFaviconResponse(aFaviconURL) {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (
aTopic === "http-on-examine-response" ||
aTopic === "http-on-examine-cached-response"

Просмотреть файл

@ -57,7 +57,7 @@ function clearAllPlacesFavicons() {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic === "places-favicons-expired") {
resolve();
Services.obs.removeObserver(observer, "places-favicons-expired");
@ -80,7 +80,7 @@ function FaviconObserver(
}
FaviconObserver.prototype = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
// Make sure that the topic is 'http-on-modify-request'.
if (aTopic === "http-on-modify-request") {
// We check the userContextId for the originAttributes of the loading

Просмотреть файл

@ -57,7 +57,7 @@ function getResult() {
return credentialQueue.shift();
}
async function doInit(aMode) {
async function doInit() {
await SpecialPowers.pushPrefEnv({
set: [["privacy.partition.network_state", false]],
});

Просмотреть файл

@ -72,12 +72,12 @@ async function doBefore() {
}
// the test function does nothing on purpose.
function doTest(aBrowser) {
function doTest() {
return 0;
}
// the check function
function doCheck(shouldIsolate, a, b) {
function doCheck(shouldIsolate) {
// if we're doing first party isolation and the image cache isolation is
// working, then gHits should be 2 because the image would have been loaded
// one per first party domain. if first party isolation is disabled, then

Просмотреть файл

@ -20,8 +20,8 @@ function cacheDataForContext(loadContextInfo) {
return new Promise(resolve => {
let cachedURIs = [];
let cacheVisitor = {
onCacheStorageInfo(num, consumption) {},
onCacheEntryInfo(uri, idEnhance) {
onCacheStorageInfo() {},
onCacheEntryInfo(uri) {
cachedURIs.push(uri.asciiSpec);
},
onCacheEntryVisitCompleted() {

Просмотреть файл

@ -448,7 +448,7 @@ this.IsolationTestTools = {
// is finished before the next round of testing.
if (SpecialPowers.useRemoteSubframes) {
await new Promise(resolve => {
let observer = (subject, topic, data) => {
let observer = (subject, topic) => {
if (topic === "ipc:content-shutdown") {
Services.obs.removeObserver(observer, "ipc:content-shutdown");
resolve();

Просмотреть файл

@ -576,7 +576,7 @@ export const PageDataService = new (class PageDataService extends EventEmitter {
* @param {string} data
* The data associated with the notification.
*/
observe(subject, topic, data) {
observe(subject, topic) {
switch (topic) {
case "idle":
lazy.logConsole.debug("User went idle");

Просмотреть файл

@ -9,7 +9,7 @@ const DUMMY_PAGE = PATH + "empty_file.html";
add_task(
async function test_principal_right_click_open_link_in_new_private_win() {
await BrowserTestUtils.withNewTab(TEST_PAGE, async function (browser) {
await BrowserTestUtils.withNewTab(TEST_PAGE, async function () {
let promiseNewWindow = BrowserTestUtils.waitForNewWindow({
url: DUMMY_PAGE,
});

Просмотреть файл

@ -41,7 +41,7 @@ add_task(async function test_experiment_messaging_system_dismiss() {
let { win: win1, tab: tab1 } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab1, [LOCALE], async function (locale) {
await SpecialPowers.spawn(tab1, [LOCALE], async function () {
content.document.querySelector("#dismiss-btn").click();
info("button clicked");
});

Просмотреть файл

@ -47,7 +47,7 @@ add_task(async function test_experiment_messaging_system_impressions() {
let { win: win1, tab: tab1 } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab1, [LOCALE], async function (locale) {
await SpecialPowers.spawn(tab1, [LOCALE], async function () {
is(
content.document
.querySelector(".promo button")
@ -72,7 +72,7 @@ add_task(async function test_experiment_messaging_system_impressions() {
let { win: win2, tab: tab2 } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab2, [LOCALE], async function (locale) {
await SpecialPowers.spawn(tab2, [LOCALE], async function () {
is(
content.document
.querySelector(".promo button")

Просмотреть файл

@ -46,7 +46,7 @@ function getStorageEntryCount(device, goon) {
var visitor = {
entryCount: 0,
onCacheStorageInfo(aEntryCount, aConsumption) {},
onCacheStorageInfo() {},
onCacheEntryInfo(uri) {
var urispec = uri.asciiSpec;
info(device + ":" + urispec + "\n");

Просмотреть файл

@ -31,7 +31,7 @@ function test() {
};
function testCheckbox() {
win.removeEventListener("load", testCheckbox);
Services.obs.addObserver(function onCertUI(aSubject, aTopic, aData) {
Services.obs.addObserver(function onCertUI() {
Services.obs.removeObserver(onCertUI, "cert-exception-ui-ready");
ok(win.gCert, "The certificate information should be available now");

Просмотреть файл

@ -19,7 +19,7 @@ add_task(async () => {
await BrowserTestUtils.browserLoaded(privateTab);
let observerExited = {
observe(aSubject, aTopic, aData) {
observe() {
ok(false, "Notification received!");
},
};

Просмотреть файл

@ -32,7 +32,7 @@ function clearAllPlacesFavicons() {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (aTopic === "places-favicons-expired") {
resolve();
Services.obs.removeObserver(observer, "places-favicons-expired");
@ -59,7 +59,7 @@ function observeFavicon(aIsPrivate, aExpectedCookie, aPageURI) {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
// Make sure that the topic is 'http-on-modify-request'.
if (aTopic === "http-on-modify-request") {
// We check the privateBrowsingId for the originAttributes of the loading
@ -121,7 +121,7 @@ function observeFavicon(aIsPrivate, aExpectedCookie, aPageURI) {
function waitOnFaviconResponse(aFaviconURL) {
return new Promise(resolve => {
let observer = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
if (
aTopic === "http-on-examine-response" ||
aTopic === "http-on-examine-cached-response"

Просмотреть файл

@ -5,7 +5,7 @@
</head>
<body>
<script type="text/javascript">
navigator.geolocation.getCurrentPosition(function(pos) {
navigator.geolocation.getCurrentPosition(function() {
// ignore
});
</script>

Просмотреть файл

@ -6,7 +6,7 @@
add_task(async function test_no_notification_when_pb_autostart() {
let observedLastPBContext = false;
let observerExited = {
observe(aSubject, aTopic, aData) {
observe() {
observedLastPBContext = true;
},
};
@ -31,7 +31,7 @@ add_task(async function test_no_notification_when_pb_autostart() {
add_task(async function test_notification_when_about_preferences() {
let observedLastPBContext = false;
let observerExited = {
observe(aSubject, aTopic, aData) {
observe() {
observedLastPBContext = true;
},
};

Просмотреть файл

@ -11,7 +11,7 @@ function test() {
let expectedExiting = true;
let expectedExited = false;
let observerExiting = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
is(
aTopic,
"last-pb-context-exiting",
@ -26,7 +26,7 @@ function test() {
},
};
let observerExited = {
observe(aSubject, aTopic, aData) {
observe(aSubject, aTopic) {
is(
aTopic,
"last-pb-context-exited",

Просмотреть файл

@ -55,7 +55,7 @@ function test() {
}
function openPrivateBrowsingModeByUI(aWindow, aCallback) {
Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
Services.obs.addObserver(function observer(aSubject) {
aSubject.addEventListener(
"load",
function () {

Просмотреть файл

@ -12,7 +12,7 @@ add_task(async function test() {
function promiseLocationChange() {
return new Promise(resolve => {
Services.obs.addObserver(function onLocationChange(subj, topic, data) {
Services.obs.addObserver(function onLocationChange(subj, topic) {
Services.obs.removeObserver(onLocationChange, topic);
resolve();
}, "browser-fullZoom:location-change");
@ -59,7 +59,7 @@ add_task(async function test() {
);
}
function testOnWindow(options, callback) {
function testOnWindow(options) {
return BrowserTestUtils.openNewBrowserWindow(options).then(win => {
windowsToClose.push(win);
windowsToReset.push(win);

Просмотреть файл

@ -31,7 +31,7 @@ if (searchParams.has("entrypoint")) {
searchParamsChanged = true;
}
document.addEventListener("DOMContentLoaded", e => {
document.addEventListener("DOMContentLoaded", () => {
if (searchParamsChanged) {
let newURL = protocol + pathname;
let params = searchParams.toString();

Просмотреть файл

@ -134,7 +134,7 @@ add_task(async function () {
await BrowserTestUtils.removeTab(tab);
});
async function checkNoLoginsContentIsDisplayed(tab, expectedLinkContent) {
async function checkNoLoginsContentIsDisplayed(tab) {
await SpecialPowers.spawn(tab.linkedBrowser, [], async function () {
await ContentTaskUtils.waitForCondition(() => {
const noLogins = content.document.querySelector(

Просмотреть файл

@ -594,7 +594,7 @@ export var ReportBrokenSite = new (class ReportBrokenSite {
const expectedBrowser = tabbrowser.getBrowserForTab(tab);
return new Promise(resolve => {
const listener = {
onLocationChange(browser, webProgress, request, uri, flags) {
onLocationChange(browser, webProgress, request, uri) {
if (
browser == expectedBrowser &&
uri.spec == url &&

Просмотреть файл

@ -12,26 +12,23 @@ add_common_setup();
add_task(async function testBackButtonsAreAdded() {
ensureReportBrokenSitePreffedOn();
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
let rbs = await AppMenu().openReportBrokenSite();
rbs.isBackButtonEnabled();
await rbs.clickBack();
await rbs.close();
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
let rbs = await AppMenu().openReportBrokenSite();
rbs.isBackButtonEnabled();
await rbs.clickBack();
await rbs.close();
rbs = await HelpMenu().openReportBrokenSite();
ok(!rbs.backButton, "Back button is not shown for Help Menu");
await rbs.close();
rbs = await HelpMenu().openReportBrokenSite();
ok(!rbs.backButton, "Back button is not shown for Help Menu");
await rbs.close();
rbs = await ProtectionsPanel().openReportBrokenSite();
rbs.isBackButtonEnabled();
await rbs.clickBack();
await rbs.close();
rbs = await ProtectionsPanel().openReportBrokenSite();
rbs.isBackButtonEnabled();
await rbs.clickBack();
await rbs.close();
rbs = await HelpMenu().openReportBrokenSite();
ok(!rbs.backButton, "Back button is not shown for Help Menu");
await rbs.close();
}
);
rbs = await HelpMenu().openReportBrokenSite();
ok(!rbs.backButton, "Back button is not shown for Help Menu");
await rbs.close();
});
});

Просмотреть файл

@ -12,34 +12,31 @@ add_common_setup();
requestLongerTimeout(2);
async function testPressingKey(key, tabToMatch, makePromise, followUp) {
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
for (const menu of [AppMenu(), ProtectionsPanel(), HelpMenu()]) {
info(
`Opening RBS to test pressing ${key} for ${tabToMatch} on ${menu.menuDescription}`
);
const rbs = await menu.openReportBrokenSite();
const promise = makePromise(rbs);
if (tabToMatch) {
if (await tabTo(tabToMatch)) {
await pressKeyAndAwait(promise, key);
followUp && (await followUp(rbs));
await rbs.close();
ok(true, `was able to activate ${tabToMatch} with keyboard`);
} else {
await rbs.close();
ok(false, `could not tab to ${tabToMatch}`);
}
} else {
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
for (const menu of [AppMenu(), ProtectionsPanel(), HelpMenu()]) {
info(
`Opening RBS to test pressing ${key} for ${tabToMatch} on ${menu.menuDescription}`
);
const rbs = await menu.openReportBrokenSite();
const promise = makePromise(rbs);
if (tabToMatch) {
if (await tabTo(tabToMatch)) {
await pressKeyAndAwait(promise, key);
followUp && (await followUp(rbs));
await rbs.close();
ok(true, `was able to use keyboard`);
ok(true, `was able to activate ${tabToMatch} with keyboard`);
} else {
await rbs.close();
ok(false, `could not tab to ${tabToMatch}`);
}
} else {
await pressKeyAndAwait(promise, key);
followUp && (await followUp(rbs));
await rbs.close();
ok(true, `was able to use keyboard`);
}
}
);
});
}
add_task(async function testSendMoreInfo() {
@ -98,16 +95,13 @@ add_task(async function testESCOnSent() {
add_task(async function testBackButtons() {
ensureReportBrokenSitePreffedOn();
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
for (const menu of [AppMenu(), ProtectionsPanel()]) {
await menu.openReportBrokenSite();
await tabTo("#report-broken-site-popup-mainView .subviewbutton-back");
const promise = BrowserTestUtils.waitForEvent(menu.popup, "ViewShown");
await pressKeyAndAwait(promise, "KEY_Enter");
menu.close();
}
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
for (const menu of [AppMenu(), ProtectionsPanel()]) {
await menu.openReportBrokenSite();
await tabTo("#report-broken-site-popup-mainView .subviewbutton-back");
const promise = BrowserTestUtils.waitForEvent(menu.popup, "ViewShown");
await pressKeyAndAwait(promise, "KEY_Enter");
menu.close();
}
);
});
});

Просмотреть файл

@ -29,45 +29,42 @@ async function clickSendAndCheckPing(rbs, expectedReason = null) {
add_task(async function testReasonDropdown() {
ensureReportBrokenSitePreffedOn();
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
ensureReasonDisabled();
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
ensureReasonDisabled();
let rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonHidden();
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs);
await rbs.clickOkay();
let rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonHidden();
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs);
await rbs.clickOkay();
ensureReasonOptional();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonOptional();
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs);
await rbs.clickOkay();
ensureReasonOptional();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonOptional();
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs);
await rbs.clickOkay();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonOptional();
rbs.chooseReason("slow");
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs, "slow");
await rbs.clickOkay();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonOptional();
rbs.chooseReason("slow");
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs, "slow");
await rbs.clickOkay();
ensureReasonRequired();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonRequired();
await rbs.isSendButtonEnabled();
const selectPromise = BrowserTestUtils.waitForSelectPopupShown(window);
EventUtils.synthesizeMouseAtCenter(rbs.sendButton, {}, window);
await selectPromise;
rbs.chooseReason("media");
await rbs.dismissDropdownPopup();
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs, "media");
await rbs.clickOkay();
}
);
ensureReasonRequired();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isReasonRequired();
await rbs.isSendButtonEnabled();
const selectPromise = BrowserTestUtils.waitForSelectPopupShown(window);
EventUtils.synthesizeMouseAtCenter(rbs.sendButton, {}, window);
await selectPromise;
rbs.chooseReason("media");
await rbs.dismissDropdownPopup();
await rbs.isSendButtonEnabled();
await clickSendAndCheckPing(rbs, "media");
await rbs.clickOkay();
});
});
async function getListItems(rbs) {
@ -90,72 +87,69 @@ add_task(async function testReasonDropdownRandomized() {
undefined
);
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
// confirm that the default order is initially used
Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
const rbs = await AppMenu().openReportBrokenSite();
const defaultOrder = [
"choose",
"slow",
"media",
"content",
"account",
"adblockers",
"other",
];
Assert.deepEqual(
await getListItems(rbs),
defaultOrder,
"non-random order is correct"
);
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
// confirm that the default order is initially used
Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
const rbs = await AppMenu().openReportBrokenSite();
const defaultOrder = [
"choose",
"slow",
"media",
"content",
"account",
"adblockers",
"other",
];
Assert.deepEqual(
await getListItems(rbs),
defaultOrder,
"non-random order is correct"
);
// confirm that a random order happens per user
let randomOrder;
let isRandomized = false;
Services.prefs.setBoolPref(RANDOMIZE_PREF, true);
// confirm that a random order happens per user
let randomOrder;
let isRandomized = false;
Services.prefs.setBoolPref(RANDOMIZE_PREF, true);
// This becomes ClientEnvironment.randomizationId, which we can set to
// any value which results in a different order from the default ordering.
Services.prefs.setCharPref("app.normandy.user_id", "dummy");
// This becomes ClientEnvironment.randomizationId, which we can set to
// any value which results in a different order from the default ordering.
Services.prefs.setCharPref("app.normandy.user_id", "dummy");
// clicking cancel triggers a reset, which is when the randomization
// logic is called. so we must click cancel after pref-changes here.
// clicking cancel triggers a reset, which is when the randomization
// logic is called. so we must click cancel after pref-changes here.
rbs.clickCancel();
await AppMenu().openReportBrokenSite();
randomOrder = await getListItems(rbs);
Assert.ok(
randomOrder != defaultOrder,
"options are randomized with pref on"
);
// confirm that the order doesn't change per user
isRandomized = false;
for (let attempt = 0; attempt < 5; ++attempt) {
rbs.clickCancel();
await AppMenu().openReportBrokenSite();
randomOrder = await getListItems(rbs);
Assert.ok(
randomOrder != defaultOrder,
"options are randomized with pref on"
);
const order = await getListItems(rbs);
// confirm that the order doesn't change per user
isRandomized = false;
for (let attempt = 0; attempt < 5; ++attempt) {
rbs.clickCancel();
await AppMenu().openReportBrokenSite();
const order = await getListItems(rbs);
if (order != randomOrder) {
isRandomized = true;
break;
}
if (order != randomOrder) {
isRandomized = true;
break;
}
Assert.ok(!isRandomized, "options keep the same order per user");
// confirm that the order reverts to the default if pref flipped to false
Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
rbs.clickCancel();
await AppMenu().openReportBrokenSite();
Assert.deepEqual(
defaultOrder,
await getListItems(rbs),
"reverts to non-random order correctly"
);
rbs.clickCancel();
}
);
Assert.ok(!isRandomized, "options keep the same order per user");
// confirm that the order reverts to the default if pref flipped to false
Services.prefs.setBoolPref(RANDOMIZE_PREF, false);
rbs.clickCancel();
await AppMenu().openReportBrokenSite();
Assert.deepEqual(
defaultOrder,
await getListItems(rbs),
"reverts to non-random order correctly"
);
rbs.clickCancel();
});
Services.prefs.setCharPref(USER_ID_PREF, origNormandyUserID);
});

Просмотреть файл

@ -40,14 +40,11 @@ async function testEnabledForValidURLs(menu) {
ensureReportBrokenSitePreffedOff();
ensureReportSiteIssuePreffedOn();
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
await menu.open();
menu.isReportSiteIssueEnabled();
await menu.close();
}
);
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
await menu.open();
menu.isReportSiteIssueEnabled();
await menu.close();
});
}
// AppMenu help sub-menu

Просмотреть файл

@ -24,22 +24,19 @@ requestLongerTimeout(2);
add_task(async function testSendMoreInfoPref() {
ensureReportBrokenSitePreffedOn();
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
await changeTab(gBrowser.selectedTab, REPORTABLE_PAGE_URL);
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
await changeTab(gBrowser.selectedTab, REPORTABLE_PAGE_URL);
ensureSendMoreInfoDisabled();
let rbs = await AppMenu().openReportBrokenSite();
await rbs.isSendMoreInfoHidden();
await rbs.close();
ensureSendMoreInfoDisabled();
let rbs = await AppMenu().openReportBrokenSite();
await rbs.isSendMoreInfoHidden();
await rbs.close();
ensureSendMoreInfoEnabled();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isSendMoreInfoShown();
await rbs.close();
}
);
ensureSendMoreInfoEnabled();
rbs = await AppMenu().openReportBrokenSite();
await rbs.isSendMoreInfoShown();
await rbs.close();
});
});
add_task(async function testSendingMoreInfo() {

Просмотреть файл

@ -124,12 +124,9 @@ add_task(async function testTabOrdering() {
ensureReportBrokenSitePreffedOn();
ensureSendMoreInfoEnabled();
await BrowserTestUtils.withNewTab(
REPORTABLE_PAGE_URL,
async function (browser) {
await testTabOrder(AppMenu());
await testTabOrder(ProtectionsPanel());
await testTabOrder(HelpMenu());
}
);
await BrowserTestUtils.withNewTab(REPORTABLE_PAGE_URL, async function () {
await testTabOrder(AppMenu());
await testTabOrder(ProtectionsPanel());
await testTabOrder(HelpMenu());
});
});

Просмотреть файл

@ -833,7 +833,7 @@ async function tabTo(match, win = window) {
return undefined;
}
async function setupStrictETP(fn) {
async function setupStrictETP() {
await UrlClassifierTestUtils.addTestTrackers();
registerCleanupFunction(() => {
UrlClassifierTestUtils.cleanupTestTrackers();

Просмотреть файл

@ -339,7 +339,7 @@ async function testWorkerNavigator() {
// test in Fission.
if (SpecialPowers.useRemoteSubframes) {
await new Promise(resolve => {
let observer = (subject, topic, data) => {
let observer = (subject, topic) => {
if (topic === "ipc:content-shutdown") {
Services.obs.removeObserver(observer, "ipc:content-shutdown");
resolve();

Просмотреть файл

@ -2081,7 +2081,7 @@ async function testKeyEvent(aTab, aTestCase) {
// a custom event 'resultAvailable' for informing the script to check the
// result.
await new Promise(resolve => {
function eventHandler(aEvent) {
function eventHandler() {
verifyKeyboardEvent(
JSON.parse(resElement.value),
result,

Просмотреть файл

@ -2,7 +2,7 @@
<head>
<meta charset="utf8">
<script>
function waitForCondition(aCond, aCallback, aErrorMsg) {
function waitForCondition(aCond, aCallback) {
var tries = 0;
var interval = setInterval(() => {
if (tries >= 30) {

Просмотреть файл

@ -5,7 +5,7 @@
<title></title>
<script src="shared_test_funcs.js"></script>
<script>
async function runTheTest(iframe_domain, cross_origin_domain, extraData) {
async function runTheTest(iframe_domain, cross_origin_domain) {
const iframes = document.querySelectorAll("iframe");
iframes[0].src = `https://${iframe_domain}/browser/browser/components/resistfingerprinting/test/browser/file_animationapi_iframee.html`;
await waitForMessage("ready", `https://${iframe_domain}`);

Просмотреть файл

@ -33,7 +33,7 @@ function createPopup() {
window.addEventListener("load", createPopup);
console.log("TKTK: Adding initial load");
async function runTheTest(iframe_domain, cross_origin_domain, mode) {
async function runTheTest(iframe_domain, cross_origin_domain) {
await new Promise(r => setTimeout(r, 2000));
console.log("TKTK: runTheTest() popup =", (popup === undefined ? "undefined" : "something"));
if (document.readyState !== 'complete') {

Просмотреть файл

@ -3,7 +3,7 @@
<script src="shared_test_funcs.js"></script>
<script type="text/javascript">
var popup;
async function runTheTest(iframe_domain, cross_origin_domain, mode) {
async function runTheTest(iframe_domain, cross_origin_domain) {
let s = `<html><script>
console.log("TKTK: Loaded popup");
function give_result() {

Просмотреть файл

@ -5,7 +5,7 @@
<title></title>
<script src="shared_test_funcs.js"></script>
<script>
async function runTheTest(iframe_domain, cross_origin_domain) {
async function runTheTest(iframe_domain) {
// Set up the frame
const iframes = document.querySelectorAll("iframe");
iframes[0].src = `https://${iframe_domain}/browser/browser/components/resistfingerprinting/test/browser/file_hwconcurrency_blobcrossorigin_iframee.html`;

Просмотреть файл

@ -3,7 +3,7 @@
<script src="shared_test_funcs.js"></script>
<script type="text/javascript">
var popup;
async function runTheTest(iframe_domain, cross_origin_domain, mode) {
async function runTheTest(iframe_domain, cross_origin_domain) {
let s = `<!DOCTYPE html><html><script>
function give_result() {
return {

Просмотреть файл

@ -5,7 +5,7 @@
<title></title>
<script src="shared_test_funcs.js"></script>
<script>
async function runTheTest(iframe_domain, cross_origin_domain, mode) {
async function runTheTest(iframe_domain, cross_origin_domain) {
var child_reference;
let url = `https://${iframe_domain}/browser/browser/components/resistfingerprinting/test/browser/file_hwconcurrency_iframee.html?mode=`
let params = new URLSearchParams(document.location.search);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше