diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /toolkit/modules/tests | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/tests')
18 files changed, 149 insertions, 83 deletions
diff --git a/toolkit/modules/tests/browser/browser_Finder.js b/toolkit/modules/tests/browser/browser_Finder.js index 7bcf7e8a00..03724d2548 100644 --- a/toolkit/modules/tests/browser/browser_Finder.js +++ b/toolkit/modules/tests/browser/browser_Finder.js @@ -44,7 +44,7 @@ add_task(async function () { findResult = await promiseFind; is(findResult.result, Ci.nsITypeAheadFind.FIND_FOUND, "should find link"); - await SpecialPowers.spawn(tab.linkedBrowser, [], async function (arg) { + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { Assert.ok( !!content.document.getElementsByTagName("a")[0].style.outline, "outline set" @@ -61,7 +61,7 @@ add_task(async function () { "should find link again" ); - await SpecialPowers.spawn(tab.linkedBrowser, [], async function (arg) { + await SpecialPowers.spawn(tab.linkedBrowser, [], async function () { Assert.ok( !content.document.getElementsByTagName("a")[0].style.outline, "outline not set" diff --git a/toolkit/modules/tests/browser/browser_FinderHighlighter.js b/toolkit/modules/tests/browser/browser_FinderHighlighter.js index 7e377e47d1..be4f0fefef 100644 --- a/toolkit/modules/tests/browser/browser_FinderHighlighter.js +++ b/toolkit/modules/tests/browser/browser_FinderHighlighter.js @@ -33,7 +33,7 @@ add_task(async function testModalResults() { insertCalls: [5, 6], removeCalls: [4, 5], // eslint-disable-next-line object-shorthand - extraTest: function (maskNode, outlineNode, rects) { + extraTest: function (maskNode, outlineNode) { Assert.equal( outlineNode.getElementsByTagName("div").length, 2, diff --git a/toolkit/modules/tests/browser/browser_Troubleshoot.js b/toolkit/modules/tests/browser/browser_Troubleshoot.js index d627f175e4..dbfbe69909 100644 --- a/toolkit/modules/tests/browser/browser_Troubleshoot.js +++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js @@ -1288,6 +1288,27 @@ const SNAPSHOT_SCHEMA = { }, }, }, + contentAnalysis: { + type: "object", + properties: { + active: { + required: true, + type: "boolean", + }, + connected: { + type: "boolean", + }, + agentPath: { + type: "string", + }, + failedSignatureVerification: { + type: "boolean", + }, + requestCount: { + type: "number", + }, + }, + }, }, }; @@ -1346,9 +1367,9 @@ function validateObject_array(array, schema) { array.forEach(elt => validateObject(elt, schema.items)); } -function validateObject_string(str, schema) {} -function validateObject_boolean(bool, schema) {} -function validateObject_number(num, schema) {} +function validateObject_string() {} +function validateObject_boolean() {} +function validateObject_number() {} function validationErr(msg, obj, schema) { return new Error( diff --git a/toolkit/modules/tests/browser/browser_web_channel.js b/toolkit/modules/tests/browser/browser_web_channel.js index 9dfa59485b..289e4d1d14 100644 --- a/toolkit/modules/tests/browser/browser_web_channel.js +++ b/toolkit/modules/tests/browser/browser_web_channel.js @@ -23,10 +23,10 @@ var gTests = [ { desc: "WebChannel generic message", run() { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { let tab; let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH)); - channel.listen(function (id, message, target) { + channel.listen(function (id, message) { is(id, "generic"); is(message.something.nested, "hello"); channel.stopListening(); @@ -44,9 +44,9 @@ var gTests = [ { desc: "WebChannel generic message in a private window.", async run() { - let promiseTestDone = new Promise(function (resolve, reject) { + let promiseTestDone = new Promise(function (resolve) { let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH)); - channel.listen(function (id, message, target) { + channel.listen(function (id, message) { is(id, "generic"); is(message.something.nested, "hello"); channel.stopListening(); @@ -66,7 +66,7 @@ var gTests = [ { desc: "WebChannel two way communication", run() { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { let tab; let channel = new WebChannel("twoway", Services.io.newURI(HTTP_PATH)); @@ -102,7 +102,7 @@ var gTests = [ Services.io.newURI(HTTP_IFRAME_PATH) ); let promiseTestDone = new Promise(function (resolve, reject) { - parentChannel.listen(function (id, message, sender) { + parentChannel.listen(function () { reject(new Error("WebChannel message incorrectly sent to parent")); }); @@ -218,14 +218,14 @@ var gTests = [ { desc: "WebChannel multichannel", run() { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { let tab; let channel = new WebChannel( "multichannel", Services.io.newURI(HTTP_PATH) ); - channel.listen(function (id, message, sender) { + channel.listen(function (id) { is(id, "multichannel"); gBrowser.removeTab(tab); resolve(); @@ -246,8 +246,8 @@ var gTests = [ // an unsolicted message is sent from Chrome->Content which is then // echoed back. If the echo is received here, then the content // received the message. - let messagePromise = new Promise(function (resolve, reject) { - channel.listen(function (id, message, sender) { + let messagePromise = new Promise(function (resolve) { + channel.listen(function (id, message) { is(id, "echo"); is(message.command, "unsolicited"); @@ -283,8 +283,8 @@ var gTests = [ // an unsolicted message is sent from Chrome->Content which is then // echoed back. If the echo is received here, then the content // received the message. - let messagePromise = new Promise(function (resolve, reject) { - channel.listen(function (id, message, sender) { + let messagePromise = new Promise(function (resolve) { + channel.listen(function (id, message) { is(id, "echo"); is(message.command, "unsolicited"); @@ -326,7 +326,7 @@ var gTests = [ // and should not be echoed back. The second, `done`, is sent to the // correct principal and should be echoed back. let messagePromise = new Promise(function (resolve, reject) { - channel.listen(function (id, message, sender) { + channel.listen(function (id, message) { is(id, "echo"); if (message.command === "done") { @@ -435,8 +435,8 @@ var gTests = [ * message. */ let channel = new WebChannel("objects", Services.io.newURI(HTTP_PATH)); - let testDonePromise = new Promise((resolve, reject) => { - channel.listen((id, message, sender) => { + let testDonePromise = new Promise(resolve => { + channel.listen((id, message) => { is(id, "objects"); is(message.type, "string"); resolve(); @@ -466,7 +466,7 @@ var gTests = [ let testDonePromise = new Promise((resolve, reject) => { let sawObject = false; let sawString = false; - channel.listen((id, message, sender) => { + channel.listen((id, message) => { is(id, "objects"); if (message.type === "object") { ok(!sawObject); @@ -509,9 +509,9 @@ var gTests = [ // The channel where we see the response when the content sees the error let echoChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH)); - let testDonePromise = new Promise((resolve, reject) => { + let testDonePromise = new Promise(resolve => { // listen for the confirmation that content saw the error. - echoChannel.listen((id, message, sender) => { + echoChannel.listen((id, message) => { is(id, "echo"); is(message.error, "oh no"); is(message.errno, ERRNO_UNKNOWN_ERROR); @@ -519,7 +519,7 @@ var gTests = [ }); // listen for a message telling us to simulate an error. - channel.listen((id, message, sender) => { + channel.listen((id, message) => { is(id, "error"); is(message.command, "oops"); throw new Error("oh no"); @@ -545,9 +545,9 @@ var gTests = [ // The channel where we see the response when the content sees the error let echoChannel = new WebChannel("echo", Services.io.newURI(HTTP_PATH)); - let testDonePromise = new Promise((resolve, reject) => { + let testDonePromise = new Promise(resolve => { // listen for the confirmation that content saw the error. - echoChannel.listen((id, message, sender) => { + echoChannel.listen((id, message) => { is(id, "echo"); is(message.error, "No Such Channel"); is(message.errno, ERRNO_NO_SUCH_CHANNEL); diff --git a/toolkit/modules/tests/browser/head.js b/toolkit/modules/tests/browser/head.js index 7c3f75b106..84bfad9328 100644 --- a/toolkit/modules/tests/browser/head.js +++ b/toolkit/modules/tests/browser/head.js @@ -87,7 +87,7 @@ function promiseTestHighlighterOutput( browser, [{ word, expectedResult, extraTest: extraTest.toSource() }], async function ({ word, expectedResult, extraTest }) { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let stubbed = {}; let callCounts = { insertCalls: [], diff --git a/toolkit/modules/tests/modules/MockDocument.sys.mjs b/toolkit/modules/tests/modules/MockDocument.sys.mjs index 163beb8450..d4c2b07205 100644 --- a/toolkit/modules/tests/modules/MockDocument.sys.mjs +++ b/toolkit/modules/tests/modules/MockDocument.sys.mjs @@ -40,7 +40,7 @@ export const MockDocument = { // Mock the document.location object so we can unit test without a frame. We use a proxy // instead of just assigning to the property since it's not configurable or writable. let document = new Proxy(aDoc, { - get(target, property, receiver) { + get(target, property) { // document.location is normally null when a document is outside of a "browsing context". // See https://html.spec.whatwg.org/#the-location-interface if (property == "location") { diff --git a/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs b/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs index 2286ac03da..ffdb8c37d6 100644 --- a/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs +++ b/toolkit/modules/tests/modules/PromiseTestUtils.sys.mjs @@ -11,8 +11,8 @@ import { Assert } from "resource://testing-common/Assert.sys.mjs"; export var PromiseTestUtils = { /** * Array of objects containing the details of the Promise rejections that are - * currently left uncaught. This includes DOM Promise and Promise.jsm. When - * rejections in DOM Promises are consumed, they are removed from this list. + * currently left uncaught. When rejections in DOM Promises are consumed, they + * are removed from this list. * * The objects contain at least the following properties: * { diff --git a/toolkit/modules/tests/xpcshell/test_DeferredTask.js b/toolkit/modules/tests/xpcshell/test_DeferredTask.js index e6c58e03db..cb1cc2d600 100644 --- a/toolkit/modules/tests/xpcshell/test_DeferredTask.js +++ b/toolkit/modules/tests/xpcshell/test_DeferredTask.js @@ -389,7 +389,7 @@ add_test(function test_finalize() { let finalized = false; // Let idleDispatch take longer. - replaceIdleDispatch((callback, timeout) => { + replaceIdleDispatch(callback => { Assert.ok(!idleStarted); idleStarted = true; do_timeout(T, callback); diff --git a/toolkit/modules/tests/xpcshell/test_FinderIterator.js b/toolkit/modules/tests/xpcshell/test_FinderIterator.js index fcbe97ba5f..5125740c55 100644 --- a/toolkit/modules/tests/xpcshell/test_FinderIterator.js +++ b/toolkit/modules/tests/xpcshell/test_FinderIterator.js @@ -7,7 +7,7 @@ let finderIterator = new FinderIterator(); var gFindResults = []; // Stub the method that instantiates nsIFind and does all the interaction with // the docShell to be searched through. -finderIterator._iterateDocument = function* (word, window, finder) { +finderIterator._iterateDocument = function* () { for (let range of gFindResults) { yield range; } @@ -117,7 +117,7 @@ add_task(async function test_valid_arguments() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -136,7 +136,7 @@ add_task(async function test_valid_arguments() { finderIterator.start({ entireWord: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -154,7 +154,7 @@ add_task(async function test_valid_arguments() { caseSensitive: false, entireWord: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -170,7 +170,7 @@ add_task(async function test_valid_arguments() { finderIterator.start({ caseSensitive: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -188,7 +188,7 @@ add_task(async function test_valid_arguments() { caseSensitive: false, entireWord: false, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -221,7 +221,7 @@ add_task(async function test_valid_arguments() { entireWord: true, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -246,7 +246,7 @@ add_task(async function test_stop() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -274,7 +274,7 @@ add_task(async function test_reset() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -317,7 +317,7 @@ add_task(async function test_parallel_starts() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -334,7 +334,7 @@ add_task(async function test_parallel_starts() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count2; }, }, @@ -385,7 +385,7 @@ add_task(async function test_allowDistance() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count; }, }, @@ -399,7 +399,7 @@ add_task(async function test_allowDistance() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count2; }, }, @@ -414,7 +414,7 @@ add_task(async function test_allowDistance() { entireWord: false, finder: gMockFinder, listener: { - onIteratorRangeFound(range) { + onIteratorRangeFound() { ++count3; }, }, diff --git a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js index a0d12b8a6a..be1be93968 100644 --- a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js +++ b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js @@ -837,6 +837,60 @@ add_task(async function test_checkForAddons_contentSignatureFailure() { }); /** + * Tests that the signature verification URL is as expected. + */ +add_task(async function test_checkForAddons_get_verifier_url() { + const previousUrlOverride = setupContentSigTestPrefs(); + + let installManager = new GMPInstallManager(); + // checkForAddons() calls _getContentSignatureRootForURL() with the return + // value of _getURL(), which is effectively KEY_URL_OVERRIDE or KEY_URL + // followed by some normalization. + const rootForUrl = async () => { + const url = await installManager._getURL(); + return installManager._getContentSignatureRootForURL(url); + }; + + Assert.equal( + await rootForUrl(), + Ci.nsIX509CertDB.AppXPCShellRoot, + "XPCShell root used by default in xpcshell test" + ); + + const defaultPrefs = Services.prefs.getDefaultBranch(""); + const defaultUrl = defaultPrefs.getStringPref(GMPPrefs.KEY_URL); + Preferences.set(GMPPrefs.KEY_URL_OVERRIDE, defaultUrl); + Assert.equal( + await rootForUrl(), + Ci.nsIContentSignatureVerifier.ContentSignatureProdRoot, + "Production cert should be used for the default Balrog URL: " + defaultUrl + ); + + // The current Balrog endpoint is at aus5.mozilla.org. Confirm that the prod + // cert is used even if we bump the version (e.g. aus6): + const potentialProdUrl = "https://aus1337.mozilla.org/potential/prod/URL"; + Preferences.set(GMPPrefs.KEY_URL_OVERRIDE, potentialProdUrl); + Assert.equal( + await rootForUrl(), + Ci.nsIContentSignatureVerifier.ContentSignatureProdRoot, + "Production cert should be used for: " + potentialProdUrl + ); + + // Stage URL documented at https://mozilla-balrog.readthedocs.io/en/latest/infrastructure.html + const stageUrl = "https://stage.balrog.nonprod.cloudops.mozgcp.net/etc."; + Preferences.set(GMPPrefs.KEY_URL_OVERRIDE, stageUrl); + Assert.equal( + await rootForUrl(), + Ci.nsIContentSignatureVerifier.ContentSignatureStageRoot, + "Stage cert should be used with the stage URL: " + stageUrl + ); + + installManager.uninit(); + + revertContentSigTestPrefs(previousUrlOverride); +}); + +/** * Tests that checkForAddons() works as expected when certificate pinning * checking is enabled. We plan to move away from cert pinning in favor of * content signature checks, but part of doing this is comparing the telemetry @@ -1175,7 +1229,7 @@ add_test(function test_installAddon_noServer() { GMPInstallManager.overrideLeaveDownloadedZip = true; let installPromise = installManager.installAddon(gmpAddon); installPromise.then( - extractedPaths => { + () => { do_throw("No server for install should reject"); }, err => { @@ -1324,8 +1378,8 @@ function mockRequest(inputStatus, inputResponse, options) { this._options = options || {}; } mockRequest.prototype = { - overrideMimeType(aMimetype) {}, - setRequestHeader(aHeader, aValue) {}, + overrideMimeType() {}, + setRequestHeader() {}, status: null, channel: { set notificationCallbacks(aVal) {} }, open(aMethod, aUrl) { @@ -1339,7 +1393,7 @@ mockRequest.prototype = { }, responseXML: null, responseText: null, - send(aBody) { + send() { executeSoon(() => { try { if (this._options.dropRequest) { @@ -1427,9 +1481,8 @@ mockRequest.prototype = { } } }, - addEventListener(aEvent, aValue, aCapturing) { - // eslint-disable-next-line no-eval - eval("this._on" + aEvent + " = aValue"); + addEventListener(aEvent, aValue) { + this[`_on${aEvent}`] = aValue; }, get wrappedJSObject() { return this; diff --git a/toolkit/modules/tests/xpcshell/test_Integration.js b/toolkit/modules/tests/xpcshell/test_Integration.js index 8213e32592..d0f53cc22a 100644 --- a/toolkit/modules/tests/xpcshell/test_Integration.js +++ b/toolkit/modules/tests/xpcshell/test_Integration.js @@ -170,7 +170,7 @@ add_task(async function test_override_super_multiple() { * ensures that this does not block other functions from being registered. */ add_task(async function test_override_error() { - let errorOverrideFn = base => { + let errorOverrideFn = () => { throw new Error("Expected error."); }; diff --git a/toolkit/modules/tests/xpcshell/test_Log.js b/toolkit/modules/tests/xpcshell/test_Log.js index c9fc367dc3..5989dbb78f 100644 --- a/toolkit/modules/tests/xpcshell/test_Log.js +++ b/toolkit/modules/tests/xpcshell/test_Log.js @@ -362,7 +362,6 @@ add_task(async function log_template_literal_message() { /* * Check that we format JS Errors reasonably. - * This needs to stay a generator to exercise Task.jsm's stack rewriting. */ add_task(async function format_errors() { let pFormat = new Log.ParameterFormatter(); @@ -386,8 +385,6 @@ add_task(async function format_errors() { // lineNumber:columnNumber. Assert.ok(str.includes(":1:12)")); // Make sure that we use human-readable stack traces - // Check that the error doesn't contain any reference to "Task.jsm" - Assert.ok(!str.includes("Task.jsm")); Assert.ok(str.includes("format_errors")); } }); diff --git a/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js b/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js index a712044359..80154a0c67 100644 --- a/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js +++ b/toolkit/modules/tests/xpcshell/test_PermissionsUtils.js @@ -2,7 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Tests that PerrmissionsUtils.jsm works as expected, including: +// Tests that PerrmissionsUtils.sys.mjs works as expected, including: // * PermissionsUtils.importfromPrefs() // <ROOT>.[whitelist|blacklist].add preferences are emptied when // converted into permissions on startup. diff --git a/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js b/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js index 81db867ba4..2dc4654492 100644 --- a/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js +++ b/toolkit/modules/tests/xpcshell/test_UpdateUtils_updatechannel.js @@ -25,6 +25,7 @@ add_task(async function test_updatechannel() { Assert.equal(UpdateUtils.getUpdateChannel(true), currentChannel); Assert.equal(UpdateUtils.getUpdateChannel(false), currentChannel); + defaultPrefs.unlock(PREF_APP_UPDATE_CHANNEL); defaultPrefs.set(PREF_APP_UPDATE_CHANNEL, TEST_CHANNEL); Assert.equal(UpdateUtils.UpdateChannel, TEST_CHANNEL); Assert.equal(UpdateUtils.getUpdateChannel(true), TEST_CHANNEL); diff --git a/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js b/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js index 00176a5f3a..b8618291f8 100644 --- a/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js +++ b/toolkit/modules/tests/xpcshell/test_UpdateUtils_url.js @@ -34,6 +34,7 @@ const gAppInfo = getAppInfo(); const gDefaultPrefBranch = Services.prefs.getDefaultBranch(null); function setUpdateChannel(aChannel) { + gDefaultPrefBranch.unlockPref(PREF_APP_UPDATE_CHANNEL); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, aChannel); } diff --git a/toolkit/modules/tests/xpcshell/test_sqlite.js b/toolkit/modules/tests/xpcshell/test_sqlite.js index e0a79e137d..bea349ded4 100644 --- a/toolkit/modules/tests/xpcshell/test_sqlite.js +++ b/toolkit/modules/tests/xpcshell/test_sqlite.js @@ -334,12 +334,9 @@ add_task(async function test_execute_invalid_statement() { await new Promise(resolve => { Assert.equal(c._connectionData._anonymousStatements.size, 0); - c.execute("SELECT invalid FROM unknown").then( - do_throw, - function onError(error) { - resolve(); - } - ); + c.execute("SELECT invalid FROM unknown").then(do_throw, function onError() { + resolve(); + }); }); // Ensure we don't leak the statement instance. @@ -366,15 +363,11 @@ add_task(async function test_on_row_exception_ignored() { } let i = 0; - let hasResult = await c.execute( - "SELECT * FROM DIRS", - null, - function onRow(row) { - i++; + let hasResult = await c.execute("SELECT * FROM DIRS", null, function onRow() { + i++; - throw new Error("Some silly error."); - } - ); + throw new Error("Some silly error."); + }); Assert.equal(hasResult, true); Assert.equal(i, 10); @@ -418,7 +411,7 @@ add_task(async function test_on_row_stop_iteration() { let hasResult = await c.execute( `SELECT * FROM dirs WHERE path="nonexistent"`, null, - function onRow(row) { + function onRow() { i++; } ); @@ -473,7 +466,7 @@ add_task(async function test_execute_transaction_rollback() { // We should never get here. do_throw(); - }).then(do_throw, function onError(error) { + }).then(do_throw, function onError() { deferred.resolve(); }); @@ -490,7 +483,7 @@ add_task(async function test_close_during_transaction() { await c.execute("INSERT INTO dirs (path) VALUES ('foo')"); - let promise = c.executeTransaction(async function transaction(conn) { + let promise = c.executeTransaction(async function transaction() { await c.execute("INSERT INTO dirs (path) VALUES ('bar')"); }); await c.close(); @@ -801,7 +794,7 @@ add_task(async function test_discard_while_active() { let discarded = -1; let first = true; let sql = "SELECT * FROM dirs"; - await c.executeCached(sql, null, function onRow(row) { + await c.executeCached(sql, null, function onRow() { if (!first) { return; } @@ -1010,7 +1003,7 @@ add_task(async function test_direct() { let deferred = Promise.withResolvers(); begin.executeAsync({ - handleCompletion(reason) { + handleCompletion() { deferred.resolve(); }, }); @@ -1021,7 +1014,7 @@ add_task(async function test_direct() { deferred = Promise.withResolvers(); print("Executing async."); statement.executeAsync({ - handleResult(resultSet) {}, + handleResult() {}, handleError(error) { print( @@ -1031,7 +1024,7 @@ add_task(async function test_direct() { deferred.reject(); }, - handleCompletion(reason) { + handleCompletion() { print("Completed."); deferred.resolve(); }, @@ -1041,7 +1034,7 @@ add_task(async function test_direct() { deferred = Promise.withResolvers(); end.executeAsync({ - handleCompletion(reason) { + handleCompletion() { deferred.resolve(); }, }); diff --git a/toolkit/modules/tests/xpcshell/test_web_channel.js b/toolkit/modules/tests/xpcshell/test_web_channel.js index 6d62762e97..a45f52efde 100644 --- a/toolkit/modules/tests/xpcshell/test_web_channel.js +++ b/toolkit/modules/tests/xpcshell/test_web_channel.js @@ -37,7 +37,7 @@ var MockWebChannelBroker = { * Test channel listening with originOrPermission being an nsIURI. */ add_task(function test_web_channel_listen() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { let channel = new WebChannel( VALID_WEB_CHANNEL_ID, VALID_WEB_CHANNEL_ORIGIN, @@ -94,7 +94,7 @@ add_task(function test_web_channel_listen() { * Test channel listening with originOrPermission being a permission string. */ add_task(function test_web_channel_listen_permission() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { // add a new permission PermissionTestUtils.add( VALID_WEB_CHANNEL_ORIGIN, diff --git a/toolkit/modules/tests/xpcshell/test_web_channel_broker.js b/toolkit/modules/tests/xpcshell/test_web_channel_broker.js index 232e02e935..3e3d4efc0e 100644 --- a/toolkit/modules/tests/xpcshell/test_web_channel_broker.js +++ b/toolkit/modules/tests/xpcshell/test_web_channel_broker.js @@ -44,7 +44,7 @@ add_test(function test_web_channel_broker_channel_map() { * Test WebChannelBroker _listener test */ add_task(function test_web_channel_broker_listener() { - return new Promise((resolve, reject) => { + return new Promise(resolve => { var channel = { id: VALID_WEB_CHANNEL_ID, _originCheckCallback: requestPrincipal => { |