diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 21:49:04 +0200 |
commit | 39dac57259cff8b61db0b22cb2ad0a8adb02692e (patch) | |
tree | 52a026cc8c22793eb17fd0f5e22adce1ae08a1dd /toolkit/components/asyncshutdown/tests/xpcshell/test_AsyncShutdown_leave_uncaught.js | |
parent | a1cce3b2b00bbd9f4983013ddd8934a7bccb9e99 (diff) | |
parent | c2d9ab62f3d097c9e0e00184cab1f546554f5eaa (diff) | |
download | UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.gz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.lz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.tar.xz UXP-39dac57259cff8b61db0b22cb2ad0a8adb02692e.zip |
Merge branch 'redwood' into 28.9-platform
Diffstat (limited to 'toolkit/components/asyncshutdown/tests/xpcshell/test_AsyncShutdown_leave_uncaught.js')
-rw-r--r-- | toolkit/components/asyncshutdown/tests/xpcshell/test_AsyncShutdown_leave_uncaught.js | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/toolkit/components/asyncshutdown/tests/xpcshell/test_AsyncShutdown_leave_uncaught.js b/toolkit/components/asyncshutdown/tests/xpcshell/test_AsyncShutdown_leave_uncaught.js deleted file mode 100644 index 33da1f53f..000000000 --- a/toolkit/components/asyncshutdown/tests/xpcshell/test_AsyncShutdown_leave_uncaught.js +++ /dev/null @@ -1,96 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ -"use strict"; - -// -// This file contains tests that need to leave uncaught asynchronous -// errors. If your test catches all its asynchronous errors, please -// put it in another file. -// - -Promise.Debugging.clearUncaughtErrorObservers(); - -function run_test() { - run_next_test(); -} - -add_task(function* test_phase_simple_async() { - do_print("Testing various combinations of a phase with a single condition"); - for (let kind of ["phase", "barrier", "xpcom-barrier", "xpcom-barrier-unwrapped"]) { - for (let arg of [undefined, null, "foo", 100, new Error("BOOM")]) { - for (let resolution of [arg, Promise.reject(arg)]) { - for (let success of [false, true]) { - for (let state of [[null], - [], - [() => "some state"], - [function() { - throw new Error("State BOOM"); }], - [function() { - return { - toJSON: function() { - throw new Error("State.toJSON BOOM"); - } - }; - }]]) { - // Asynchronous phase - do_print("Asynchronous test with " + arg + ", " + resolution + ", " + kind); - let lock = makeLock(kind); - let outParam = { isFinished: false }; - lock.addBlocker( - "Async test", - function() { - if (success) { - return longRunningAsyncTask(resolution, outParam); - } - throw resolution; - }, - ...state - ); - do_check_false(outParam.isFinished); - yield lock.wait(); - do_check_eq(outParam.isFinished, success); - } - } - - // Synchronous phase - just test that we don't throw/freeze - do_print("Synchronous test with " + arg + ", " + resolution + ", " + kind); - let lock = makeLock(kind); - lock.addBlocker( - "Sync test", - resolution - ); - yield lock.wait(); - } - } - } -}); - -add_task(function* test_phase_many() { - do_print("Testing various combinations of a phase with many conditions"); - for (let kind of ["phase", "barrier", "xpcom-barrier", "xpcom-barrier-unwrapped"]) { - let lock = makeLock(kind); - let outParams = []; - for (let arg of [undefined, null, "foo", 100, new Error("BOOM")]) { - for (let resolve of [true, false]) { - do_print("Testing with " + kind + ", " + arg + ", " + resolve); - let resolution = resolve ? arg : Promise.reject(arg); - let outParam = { isFinished: false }; - lock.addBlocker( - "Test " + Math.random(), - () => longRunningAsyncTask(resolution, outParam) - ); - } - } - do_check_true(outParams.every((x) => !x.isFinished)); - yield lock.wait(); - do_check_true(outParams.every((x) => x.isFinished)); - } -}); - - - - -add_task(function*() { - Services.prefs.clearUserPref("toolkit.asyncshutdown.testing"); -}); - |