summaryrefslogtreecommitdiffstats
path: root/testing/mochitest/tests/browser/browser_fail_uncaught_rejection.js
blob: 86d3e77b7f3c0ac9aa352c34c2de44dce7d02869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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(() => {});
}