tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit ff5c473041f83e1a6e51585ab07880596e6b682b
parent 806fd1a148a17ab5a3e2f7e69f008417d7798486
Author: Florian Quèze <florian@queze.net>
Date:   Mon, 17 Nov 2025 21:58:42 +0000

Bug 2000248 - Remove setExpectedFailuresForSelfTest, r=ahal,frontend-codestyle-reviewers.

Differential Revision: https://phabricator.services.mozilla.com/D272662

Diffstat:
Mtesting/mochitest/browser-test.js | 45+++++++++++++--------------------------------
Mtesting/mochitest/tests/browser/browser.toml | 8++++++++
Mtesting/mochitest/tests/browser/browser_fail.js | 2--
Mtesting/mochitest/tests/browser/browser_fail_add_task.js | 2--
Mtesting/mochitest/tests/browser/browser_fail_add_task_uncaught_rejection.js | 2--
Mtesting/mochitest/tests/browser/browser_fail_async.js | 2--
Mtesting/mochitest/tests/browser/browser_fail_throw.js | 2--
Mtesting/mochitest/tests/browser/browser_fail_uncaught_rejection.js | 2--
Mtesting/mochitest/tests/browser/browser_fail_uncaught_rejection_expected.js | 2--
Mtesting/mochitest/tests/browser/browser_fail_uncaught_rejection_expected_multi.js | 2--
Mtools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.mjs | 1-
11 files changed, 21 insertions(+), 49 deletions(-)

diff --git a/testing/mochitest/browser-test.js b/testing/mochitest/browser-test.js @@ -1087,32 +1087,19 @@ Tester.prototype = { } } - if (this.currentTest.allowFailure) { - if (this.currentTest.expectedAllowedFailureCount) { - this.currentTest.addResult( - new testResult({ - name: - "Expected " + - this.currentTest.expectedAllowedFailureCount + - " failures in this file, got " + - this.currentTest.allowedFailureCount + - ".", - pass: - this.currentTest.expectedAllowedFailureCount == - this.currentTest.allowedFailureCount, - }) - ); - } else if (this.currentTest.allowedFailureCount == 0) { - this.currentTest.addResult( - new testResult({ - name: - "We expect at least one assertion to fail because this" + - " test file is marked as fail-if in the manifest.", - todo: true, - knownFailure: this.currentTest.allowFailure, - }) - ); - } + if ( + this.currentTest.allowFailure && + this.currentTest.allowedFailureCount == 0 + ) { + this.currentTest.addResult( + new testResult({ + name: + "We expect at least one assertion to fail because this" + + " test file is marked as fail-if in the manifest.", + todo: true, + knownFailure: this.currentTest.allowFailure, + }) + ); } // Dump memory stats for main thread. @@ -1970,12 +1957,6 @@ function testScope(aTester, aTest, expected) { self.__expectedMaxAsserts = max; }; - this.setExpectedFailuresForSelfTest = - function test_setExpectedFailuresForSelfTest(expectedAllowedFailureCount) { - aTest.allowFailure = true; - aTest.expectedAllowedFailureCount = expectedAllowedFailureCount; - }; - this.finish = function test_finish() { self.__done = true; if (self.__waitTimer) { diff --git a/testing/mochitest/tests/browser/browser.toml b/testing/mochitest/tests/browser/browser.toml @@ -24,38 +24,46 @@ https_first_disabled = true ["browser_document_builder_sjs.js"] ["browser_fail.js"] +fail-if = ["true"] skip-if = ["verify-standalone"] ["browser_fail_add_task.js"] +fail-if = ["true"] skip-if = ["os == 'linux' && os_version == '24.04' && arch == 'x86_64' && debug && socketprocess_networking && verify-standalone"] ["browser_fail_add_task_uncaught_rejection.js"] +fail-if = ["true"] skip-if = [ "os == 'win' && os_version == '11.26100' && arch == 'x86' && debug && verify-standalone", "os == 'win' && os_version == '11.26100' && arch == 'x86_64' && opt && verify-standalone", ] ["browser_fail_async.js"] +fail-if = ["true"] ["browser_fail_if.js"] fail-if = ["true"] ["browser_fail_throw.js"] +fail-if = ["true"] skip-if = ["os == 'win' && os_version == '11.26100' && arch == 'x86_64' && opt && socketprocess_networking && verify-standalone"] ["browser_fail_timeout.js"] disabled = "Disabled beacuse it takes too long (bug 1178959)" ["browser_fail_uncaught_rejection.js"] +fail-if = ["true"] skip-if = ["verify-standalone"] ["browser_fail_uncaught_rejection_expected.js"] +fail-if = ["true"] skip-if = [ "os == 'linux' && os_version == '24.04' && arch == 'x86_64' && debug && swgl && verify-standalone", "os == 'win' && os_version == '11.26100' && arch == 'x86_64' && debug && socketprocess_networking && verify-standalone", ] ["browser_fail_uncaught_rejection_expected_multi.js"] +fail-if = ["true"] skip-if = ["os == 'win' && os_version == '11.26100' && arch == 'x86_64' && debug && verify-standalone"] ["browser_fail_unexpectedTimeout.js"] diff --git a/testing/mochitest/tests/browser/browser_fail.js b/testing/mochitest/tests/browser/browser_fail.js @@ -1,5 +1,3 @@ -setExpectedFailuresForSelfTest(6); - function test() { ok(false, "fail ok"); is(true, false, "fail is"); diff --git a/testing/mochitest/tests/browser/browser_fail_add_task.js b/testing/mochitest/tests/browser/browser_fail_add_task.js @@ -3,8 +3,6 @@ "use strict"; -setExpectedFailuresForSelfTest(5); - function rejectOnNextTick(error) { return new Promise((resolve, reject) => executeSoon(() => reject(error))); } diff --git a/testing/mochitest/tests/browser/browser_fail_add_task_uncaught_rejection.js b/testing/mochitest/tests/browser/browser_fail_add_task_uncaught_rejection.js @@ -3,8 +3,6 @@ "use strict"; -setExpectedFailuresForSelfTest(4); - async function rejectOnNextTick(error) { await Promise.resolve(); diff --git a/testing/mochitest/tests/browser/browser_fail_async.js b/testing/mochitest/tests/browser/browser_fail_async.js @@ -1,5 +1,3 @@ -setExpectedFailuresForSelfTest(1); - function test() { waitForExplicitFinish(); executeSoon(() => { diff --git a/testing/mochitest/tests/browser/browser_fail_throw.js b/testing/mochitest/tests/browser/browser_fail_throw.js @@ -1,5 +1,3 @@ -setExpectedFailuresForSelfTest(1); - function test() { throw new Error("thrown exception"); } diff --git a/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js b/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js @@ -1,5 +1,3 @@ -setExpectedFailuresForSelfTest(2); - function test() { Promise.reject(new Error("Promise rejection.")); (async () => { diff --git a/testing/mochitest/tests/browser/browser_fail_uncaught_rejection_expected.js b/testing/mochitest/tests/browser/browser_fail_uncaught_rejection_expected.js @@ -1,5 +1,3 @@ -setExpectedFailuresForSelfTest(1); - // The test will fail because there is only one of two expected rejections. const { PromiseTestUtils } = ChromeUtils.importESModule( "resource://testing-common/PromiseTestUtils.sys.mjs" diff --git a/testing/mochitest/tests/browser/browser_fail_uncaught_rejection_expected_multi.js b/testing/mochitest/tests/browser/browser_fail_uncaught_rejection_expected_multi.js @@ -1,5 +1,3 @@ -setExpectedFailuresForSelfTest(1); - // The test will fail because an expected uncaught rejection is actually caught. const { PromiseTestUtils } = ChromeUtils.importESModule( "resource://testing-common/PromiseTestUtils.sys.mjs" diff --git a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.mjs b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/browser-test.mjs @@ -51,7 +51,6 @@ export default { record: "readonly", registerCleanupFunction: "readonly", requestLongerTimeout: "readonly", - setExpectedFailuresForSelfTest: "readonly", stringContains: "readonly", stringMatches: "readonly", testSignal: "readonly",