summaryrefslogtreecommitdiffstats
path: root/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js')
-rw-r--r--testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js b/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js
new file mode 100644
index 0000000000..86d3e77b7f
--- /dev/null
+++ b/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js
@@ -0,0 +1,14 @@
+setExpectedFailuresForSelfTest(2);
+
+function test() {
+ Promise.reject(new Error("Promise rejection."));
+ (async () => {
+ throw new Error("Synchronous rejection from async function.");
+ })();
+
+ // The following rejections are caught, so they won't result in failures.
+ Promise.reject(new Error("Promise rejection.")).catch(() => {});
+ (async () => {
+ throw new Error("Synchronous rejection from async function.");
+ })().catch(() => {});
+}