Bug 1864896: Autofix unused function arguments (remote). r=webdriver-reviewers,jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D202981
This commit is contained in:
Dave Townsend 2024-03-01 23:43:51 +00:00
Родитель 781b2008f8
Коммит 049e4fc37a
36 изменённых файлов: 78 добавлений и 90 удалений

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

@ -613,7 +613,7 @@ export class Runtime extends ContentProcessDomain {
* @param {nsIConsoleMessage} subject
* Console message.
*/
observe(subject, topic, data) {
observe(subject) {
if (subject instanceof Ci.nsIScriptError && subject.hasException) {
let entry = fromScriptError(subject);
this._emitExceptionThrown(entry);

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

@ -151,7 +151,7 @@ export class Network extends Domain {
* @returns {Array<Cookie>}
* Array of cookie objects.
*/
async getAllCookies(options = {}) {
async getAllCookies() {
const cookies = [];
for (const cookie of Services.cookies.cookies) {
cookies.push(_buildCookie(cookie));

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

@ -677,7 +677,7 @@ export class Page extends Domain {
* @param {boolean=} options.enabled
* Enabled state of file chooser interception.
*/
setInterceptFileChooserDialog(options = {}) {}
setInterceptFileChooserDialog() {}
_getCurrentHistoryIndex() {
const { window } = this.session.target;

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

@ -121,7 +121,7 @@ export class ContextObserver {
}
}
observe(subject, topic, data) {
observe(subject, topic) {
switch (topic) {
case "document-element-inserted":
const window = subject.defaultView;

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

@ -186,7 +186,7 @@ export class NetworkObserver {
this._redirectMap.set(newChannel, oldChannel);
}
_onRequest(channel, topic) {
_onRequest(channel) {
const httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
const loadContext = getLoadContext(httpChannel);
const browser = loadContext?.topFrameElement;
@ -242,7 +242,7 @@ export class NetworkObserver {
});
}
_onResponse(fromCache, httpChannel, topic) {
_onResponse(fromCache, httpChannel) {
const loadContext = getLoadContext(httpChannel);
if (
!loadContext ||

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

@ -94,7 +94,7 @@ export class TabTarget extends Target {
/** @returns {Promise<string|null>} */
get faviconUrl() {
return new Promise((resolve, reject) => {
return new Promise(resolve => {
lazy.Favicons.getFaviconURLForPage(this.browser.currentURI, url => {
if (url) {
resolve(url.spec);
@ -143,7 +143,7 @@ export class TabTarget extends Target {
// nsIObserver
observe(subject, topic, data) {
observe(subject) {
if (subject === this.mm && subject == "message-manager-disconnect") {
// disconnect debugging target if <browser> is disconnected,
// otherwise this is just a host process change

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

@ -188,7 +188,7 @@ add_task(async function json_activate_target({ client, tab }) {
is(invalidResponse, "No such target id: does-not-exist");
});
add_task(async function json_close_target({ CDP, client, tab }) {
add_task(async function json_close_target({ CDP, client }) {
const { Target } = client;
const { targetInfo, newTab } = await openTab(Target);

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

@ -100,7 +100,7 @@ add_task(async function eventsForScriptErrorContent({ client }) {
is(events[0].lineNumber, 2, "Got expected line number");
});
async function runEntryAddedTest(client, eventCount, callback, options = {}) {
async function runEntryAddedTest(client, eventCount, callback) {
const { Log } = client;
const EVENT_ENTRY_ADDED = "Log.entryAdded";
@ -109,7 +109,7 @@ async function runEntryAddedTest(client, eventCount, callback, options = {}) {
history.addRecorder({
event: Log.entryAdded,
eventName: EVENT_ENTRY_ADDED,
messageFn: payload => `Received "${EVENT_ENTRY_ADDED}"`,
messageFn: () => `Received "${EVENT_ENTRY_ADDED}"`,
});
const timeBefore = Date.now();

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

@ -18,7 +18,7 @@ add_task(async function cacheEnabledAfterDisabled({ client }) {
await waitForLoadFlags();
});
add_task(async function cacheEnabledByDefault({ Network }) {
add_task(async function cacheEnabledByDefault() {
await watchLoadFlags(LOAD_NORMAL, TEST_PAGE);
await loadURL(TEST_PAGE);
await waitForLoadFlags();
@ -67,7 +67,7 @@ function watchLoadFlags(flags, url) {
);
},
onStateChange(webProgress, request, flags, status) {
onStateChange(webProgress, request, flags) {
// We are checking requests - if there isn't one, ignore it.
if (!request) {
return;

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

@ -178,7 +178,7 @@ async function runPageLifecycleTest(client, expectedEventSets, callback) {
// Check data as exposed by each of these events
let lastTimestamp = frameEvents[0].payload.timestamp;
frameEvents.forEach(({ payload }, index) => {
frameEvents.forEach(({ payload }) => {
Assert.greaterOrEqual(
payload.timestamp,
lastTimestamp,

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

@ -76,12 +76,7 @@ add_task(async function eventsForScriptErrorWithException({ client }) {
is(callFrames[1].url, PAGE_CONSOLE_EVENTS, "Got expected url");
});
async function runExceptionThrownTest(
client,
eventCount,
callback,
options = {}
) {
async function runExceptionThrownTest(client, eventCount, callback) {
const { Runtime } = client;
const EVENT_EXCEPTION_THROWN = "Runtime.exceptionThrown";

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

@ -68,7 +68,7 @@ function isSecurityState(browser, expectedState) {
);
}
add_task(async function testDefault({ Security }) {
add_task(async function testDefault() {
for (const url of BAD_CERTS) {
info(`Navigating to ${url}`);
const loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);

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

@ -3,7 +3,7 @@
"use strict";
add_task(async function raisesWithoutArguments({ client, tab }) {
add_task(async function raisesWithoutArguments({ client }) {
const { Target } = client;
await Assert.rejects(
@ -13,7 +13,7 @@ add_task(async function raisesWithoutArguments({ client, tab }) {
);
});
add_task(async function raisesWithUnknownTargetId({ client, tab }) {
add_task(async function raisesWithUnknownTargetId({ client }) {
const { Target } = client;
await Assert.rejects(

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

@ -3,7 +3,7 @@
"use strict";
add_task(async function raisesWithoutArguments({ client, tab }) {
add_task(async function raisesWithoutArguments({ client }) {
const { Target } = client;
await Assert.rejects(
@ -13,7 +13,7 @@ add_task(async function raisesWithoutArguments({ client, tab }) {
);
});
add_task(async function raisesWithUnknownTargetId({ client, tab }) {
add_task(async function raisesWithUnknownTargetId({ client }) {
const { Target } = client;
await Assert.rejects(

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

@ -3,7 +3,7 @@
"use strict";
add_task(async function raisesWithoutArguments({ client, tab }) {
add_task(async function raisesWithoutArguments({ client }) {
const { Target } = client;
await Assert.rejects(
@ -13,7 +13,7 @@ add_task(async function raisesWithoutArguments({ client, tab }) {
);
});
add_task(async function raisesWithUnknownTargetId({ client, tab }) {
add_task(async function raisesWithUnknownTargetId({ client }) {
const { Target } = client;
await Assert.rejects(
@ -23,7 +23,7 @@ add_task(async function raisesWithUnknownTargetId({ client, tab }) {
);
});
add_task(async function triggersTargetDestroyed({ client, tab }) {
add_task(async function triggersTargetDestroyed({ client }) {
const { Target } = client;
const { targetInfo, newTab } = await openTab(Target);

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

@ -3,7 +3,7 @@
"use strict";
add_task(async function eventFiredWhenTabIsClosed({ client, tab }) {
add_task(async function eventFiredWhenTabIsClosed({ client }) {
const { Target } = client;
const { newTab } = await openTab(Target);

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

@ -37,7 +37,7 @@ async function installAddon(file) {
throw new lazy.error.UnknownError(ERRORS[install.error]);
}
return install.install().catch(err => {
return install.install().catch(() => {
throw new lazy.error.UnknownError(ERRORS[install.error]);
});
}

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

@ -328,7 +328,7 @@ browser.Context = class {
* @param {XULBrowser} target
* The <xul:browser> that was the target of the originating message.
*/
register(target) {
register() {
if (!this.tabBrowser) {
return;
}

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

@ -540,7 +540,7 @@ GeckoDriver.prototype.handleEvent = function ({ target, type }) {
}
};
GeckoDriver.prototype.observe = async function (subject, topic, data) {
GeckoDriver.prototype.observe = async function (subject, topic) {
switch (topic) {
case TOPIC_BROWSER_READY:
this.registerWindow(subject);

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

@ -265,7 +265,7 @@ navigate.waitForNavigationCompleted = async function waitForNavigationCompleted(
checkDone({ finished: true });
};
const onTimer = timer => {
const onTimer = () => {
// For the command "Element Click" we want to detect a potential navigation
// as early as possible. The `beforeunload` event is an indication for that
// but could still cause the navigation to get aborted by the user. As such
@ -356,7 +356,7 @@ navigate.waitForNavigationCompleted = async function waitForNavigationCompleted(
}
};
const onUnload = event => {
const onUnload = () => {
lazy.logger.trace(
"Canceled page load listener " +
"because the top-browsing context has been closed"

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

@ -30,26 +30,19 @@ BrowserDOMWindow.prototype = {
return null;
},
createContentWindow(
aURI,
aOpenWindowInfo,
aWhere,
aFlags,
aTriggeringPrincipal,
aCsp
) {
createContentWindow(aURI, aOpenWindowInfo, aWhere) {
return this._maybeOpen(aOpenWindowInfo, aWhere)?.browsingContext;
},
openURI(aURI, aOpenWindowInfo, aWhere, aFlags, aTriggeringPrincipal, aCsp) {
openURI(aURI, aOpenWindowInfo, aWhere) {
return this._maybeOpen(aOpenWindowInfo, aWhere)?.browsingContext;
},
createContentWindowInFrame(aURI, aParams, aWhere, aFlags, aName) {
createContentWindowInFrame(aURI, aParams, aWhere) {
return this._maybeOpen(aParams.openWindowInfo, aWhere);
},
openURIInFrame(aURI, aParams, aWhere, aFlags, aName) {
openURIInFrame(aURI, aParams, aWhere) {
return this._maybeOpen(aParams.openWindowInfo, aWhere);
},

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

@ -28,7 +28,7 @@ class MessageManager {
this.message = message;
}
removeMessageListener(message) {
removeMessageListener() {
this.func = null;
this.message = null;
}
@ -55,7 +55,7 @@ class MockTimer {
this.cancelled = false;
}
initWithCallback(cb, timeout, type) {
initWithCallback(cb) {
this.ticks++;
if (this.ticks >= this.goal) {
cb();
@ -216,7 +216,7 @@ add_task(function test_TimedPromise_timeoutTypes() {
add_task(async function test_TimedPromise_errorMessage() {
try {
await new TimedPromise(resolve => {}, { timeout: 0 });
await new TimedPromise(() => {}, { timeout: 0 });
ok(false, "Expected Timeout error not raised");
} catch (e) {
ok(
@ -226,7 +226,7 @@ add_task(async function test_TimedPromise_errorMessage() {
}
try {
await new TimedPromise(resolve => {}, {
await new TimedPromise(() => {}, {
errorMessage: "Not found",
timeout: 0,
});

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

@ -68,7 +68,7 @@ function writeString(output, data) {
}
output.asyncWait(
stream => {
() => {
try {
const written = output.write(data, data.length);
data = data.slice(written);

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

@ -24,7 +24,7 @@ const ID_THUNDERBIRD = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
export const AppInfo = new Proxy(
{},
{
get(target, prop, receiver) {
get(target, prop) {
if (target.hasOwnProperty(prop)) {
return target[prop];
}

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

@ -89,7 +89,7 @@ export class WebSocketConnection {
* @param {Session} session
* The session to register.
*/
registerSession(session) {
registerSession() {
throw new Error("Not implemented");
}
@ -140,7 +140,7 @@ export class WebSocketConnection {
/**
* Called by the `transport` when the connection is closed.
*/
onConnectionClose(status) {
onConnectionClose() {
lazy.logger.debug(`${this.constructor.name} ${this.id} closed`);
}

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

@ -56,12 +56,12 @@ export class NavigationListenerChild extends JSWindowActorChild {
/**
* See note above
*/
handleEvent(event) {}
handleEvent() {}
/**
* See note above
*/
receiveMessage(message) {}
receiveMessage() {}
/**
* A browsing context might be replaced before reaching the parent process,

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

@ -49,7 +49,7 @@ export class ContextualIdentityListener {
this.stopListening();
}
observe(subject, topic, data) {
observe(subject, topic) {
switch (topic) {
case OBSERVER_TOPIC_CREATED:
this.emit("created", { identity: subject.wrappedJSObject });

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

@ -169,7 +169,7 @@ export class NetworkEventRecord {
* @param {boolean} isRacing
* True if the corresponding channel raced the cache and network requests.
*/
addSecurityInfo(info, isRacing) {}
addSecurityInfo() {}
/**
* Add network event timings.
@ -185,7 +185,7 @@ export class NetworkEventRecord {
* @param {object} offsets
* The har-like timings, but as offset from the request start.
*/
addEventTimings(total, timings, offsets) {}
addEventTimings() {}
/**
* Add response cache entry.
@ -197,7 +197,7 @@ export class NetworkEventRecord {
* @param {object} options
* An object which contains a single responseCache property.
*/
addResponseCache(options) {}
addResponseCache() {}
/**
* Add response content.
@ -237,7 +237,7 @@ export class NetworkEventRecord {
* @param {Array} serverTimings
* The server timings.
*/
addServerTimings(serverTimings) {}
addServerTimings() {}
/**
* Add service worker timings.
@ -249,7 +249,7 @@ export class NetworkEventRecord {
* @param {object} serviceWorkerTimings
* The server timings.
*/
addServiceWorkerTimings(serviceWorkerTimings) {}
addServiceWorkerTimings() {}
onAuthPrompt(authDetails, authCallbacks) {
this.#emitAuthRequired(authCallbacks);

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

@ -271,7 +271,7 @@ export class MessageHandler extends EventEmitter {
* @param {Array<SessionDataItem>} sessionDataItems
* Initial session data items for this MessageHandler.
*/
async initialize(sessionDataItems) {}
async initialize() {}
/**
* Returns the module path corresponding to this MessageHandler class.
@ -297,7 +297,7 @@ export class MessageHandler extends EventEmitter {
*
* Needs to be implemented in the sub class.
*/
static getIdFromContext(context) {
static getIdFromContext() {
throw new Error("Not implemented");
}
@ -306,7 +306,7 @@ export class MessageHandler extends EventEmitter {
*
* Needs to be implemented in the sub class.
*/
forwardCommand(command) {
forwardCommand() {
throw new Error("Not implemented");
}
@ -316,7 +316,7 @@ export class MessageHandler extends EventEmitter {
*
* Needs to be implemented in the sub class.
*/
matchesContext(contextDescriptor) {
matchesContext() {
throw new Error("Not implemented");
}

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

@ -66,7 +66,7 @@ export class Module {
* @returns {object}
* The modified event payload.
*/
interceptEvent(name, payload) {
interceptEvent(name) {
throw new Error(
`Could not intercept event ${name}, interceptEvent is not implemented in windowglobal-in-root module`
);

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

@ -51,7 +51,7 @@ export class RootMessageHandler extends MessageHandler {
* The ROOT MessageHandler is unique for a given MessageHandler network
* (ie for a given sessionId). Reuse the type as context id here.
*/
static getIdFromContext(context) {
static getIdFromContext() {
return RootMessageHandler.type;
}

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

@ -27,7 +27,7 @@ class RetryModule extends Module {
// processes.
const uri = this.messageHandler.window.document.baseURI;
if (!uri.includes("example.net")) {
await new Promise(r => {});
await new Promise(() => {});
}
return { ...params };
@ -37,7 +37,7 @@ class RetryModule extends Module {
async blockedOneTime(params) {
callsToBlockedOneTime++;
if (callsToBlockedOneTime < 2) {
await new Promise(r => {});
await new Promise(() => {});
}
// Return:
@ -51,7 +51,7 @@ class RetryModule extends Module {
async blockedTenTimes(params) {
callsToBlockedTenTimes++;
if (callsToBlockedTenTimes < 11) {
await new Promise(r => {});
await new Promise(() => {});
}
// Return:
@ -65,7 +65,7 @@ class RetryModule extends Module {
async blockedElevenTimes(params) {
callsToBlockedElevenTimes++;
if (callsToBlockedElevenTimes < 12) {
await new Promise(r => {});
await new Promise(() => {});
}
// Return:

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

@ -17,7 +17,7 @@ class WindowGlobalToRootModule extends Module {
* Commands
*/
testHandleCommandToRoot(params, destination) {
testHandleCommandToRoot() {
return this.messageHandler.handleCommand({
moduleName: "windowglobaltoroot",
commandName: "getValueFromRoot",
@ -27,7 +27,7 @@ class WindowGlobalToRootModule extends Module {
});
}
testSendRootCommand(params, destination) {
testSendRootCommand() {
return this.messageHandler.sendRootCommand({
moduleName: "windowglobaltoroot",
commandName: "getValueFromRoot",

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

@ -50,14 +50,14 @@ class MockElement {
}
}
dispatchEvent(event) {
dispatchEvent() {
if (this.wantUntrusted) {
this.untrusted = true;
}
this.click();
}
removeEventListener(name, func) {
removeEventListener() {
this.capture = false;
this.eventName = null;
this.func = null;
@ -213,12 +213,12 @@ add_task(async function test_EventPromise_checkFnCallback() {
{ checkFn: null, expected_count: 0 },
{ checkFn: undefined, expected_count: 0 },
{
checkFn: event => {
checkFn: () => {
throw new Error("foo");
},
expected_count: 0,
},
{ checkFn: event => count++ > 0, expected_count: 2 },
{ checkFn: () => count++ > 0, expected_count: 2 },
];
for (const { checkFn, expected_count } of data) {
@ -417,7 +417,7 @@ add_task(async function test_PollPromise_resolve() {
const timeout = 100;
await new PollPromise(
(resolve, reject) => {
resolve => {
resolve();
},
{ timeout, errorMessage }

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

@ -512,7 +512,7 @@ class Origin {
* @param {InputSource} inputSource - State of current input device.
* @param {WindowProxy} win - Current window global
*/
getOriginCoordinates(inputSource, win) {
getOriginCoordinates() {
throw new Error(
`originCoordinates not defined for ${this.constructor.name}`
);
@ -559,13 +559,13 @@ class Origin {
}
class ViewportOrigin extends Origin {
getOriginCoordinates(inputSource, win) {
getOriginCoordinates() {
return { x: 0, y: 0 };
}
}
class PointerOrigin extends Origin {
getOriginCoordinates(inputSource, win) {
getOriginCoordinates(inputSource) {
return { x: inputSource.x, y: inputSource.y };
}
}
@ -630,7 +630,7 @@ class Action {
* @param {WindowProxy} win - Current window global.
* @returns {Promise} - Promise that is resolved once the action is complete.
*/
dispatch(state, inputSource, tickDuration, win) {
dispatch() {
throw new Error(
`Action subclass ${this.constructor.name} must override dispatch()`
);
@ -711,7 +711,7 @@ class PauseAction extends NullAction {
* @param {WindowProxy} win - Current window global.
* @returns {Promise} - Promise that is resolved once the action is complete.
*/
dispatch(state, inputSource, tickDuration, win) {
dispatch(state, inputSource, tickDuration) {
const ms = this.duration ?? tickDuration;
lazy.logger.trace(
@ -1424,7 +1424,7 @@ class TouchActionGroup {
* @param {WindowProxy} win - Current window global.
* @returns {Promise} - Promise that is resolved once the action is complete.
*/
dispatch(state, inputSource, tickDuration, win) {
dispatch() {
throw new Error(
"TouchActionGroup subclass missing dispatch implementation"
);
@ -1622,7 +1622,7 @@ class PointerMoveTouchActionGroup extends TouchActionGroup {
}
);
const reachedTarget = perPointerData.every(
([inputSource, action, target]) =>
([inputSource, , target]) =>
target[0] === inputSource.x && target[1] === inputSource.y
);
@ -1784,7 +1784,7 @@ class Pointer {
* @param {Action} action - The Action object invoking the pointer
* @param {WindowProxy} win - Current window global.
*/
pointerDown(state, inputSource, action, win) {
pointerDown() {
throw new Error(`Unimplemented pointerDown for pointerType ${this.type}`);
}
@ -1796,7 +1796,7 @@ class Pointer {
* @param {Action} action - The Action object invoking the pointer
* @param {WindowProxy} win - Current window global.
*/
pointerUp(state, inputSource, action, win) {
pointerUp() {
throw new Error(`Unimplemented pointerUp for pointerType ${this.type}`);
}
@ -1809,7 +1809,7 @@ class Pointer {
* @param {number} targetY - Target Y coordinate of the pointer move
* @param {WindowProxy} win - Current window global.
*/
pointerMove(state, inputSource, targetX, targetY, win) {
pointerMove() {
throw new Error(`Unimplemented pointerMove for pointerType ${this.type}`);
}
@ -2142,7 +2142,7 @@ class InputEventData {
* @param {State} state - Actions state.
* @param {InputSource} inputSource - State of the current input device.
*/
update(state, inputSource) {}
update() {}
toString() {
return `${this.constructor.name} ${JSON.stringify(this)}`;

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

@ -17,7 +17,7 @@ class BrowsingContextObserver {
this.actor = actor;
}
async observe(subject, topic, data) {
async observe(subject, topic) {
if (topic === "browsing-context-discarded") {
this.actor.cleanUp({ browsingContext: subject });
}