fune/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js
Victor Porof 2b036e45c5 Bug 1561435 - Format testing/, a=automatic-formatting
# ignore-this-changeset

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

--HG--
extra : source : c0948f31e520ca087279cf429ca5f1db5a8341b8
2019-07-05 11:01:24 +02:00

20 lines
750 B
JavaScript

setExpectedFailuresForSelfTest(3);
// Keep "JSMPromise" separate so "Promise" still refers to native Promises.
let JSMPromise = ChromeUtils.import("resource://gre/modules/Promise.jsm", {})
.Promise;
function test() {
Promise.reject(new Error("Promise rejection."));
JSMPromise.reject(new Error("Promise.jsm 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(() => {});
JSMPromise.reject(new Error("Promise.jsm rejection.")).catch(() => {});
(async () => {
throw new Error("Synchronous rejection from async function.");
})().catch(() => {});
}