tor-browser

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

asyncHelpers-throwsAsync-native.js (1295B)


      1 // |reftest| async
      2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 /*---
      5 description: |
      6    Thenables that reject with instances of the specified native Error constructor
      7    satisfy the assertion.
      8 flags: [async]
      9 includes: [asyncHelpers.js]
     10 ---*/
     11 
     12 asyncTest(async function () {
     13  var p = assert.throwsAsync(Error, async function () {
     14    throw new Error();
     15  });
     16  assert(p instanceof Promise);
     17  await p;
     18  p = assert.throwsAsync(EvalError, async function () {
     19    throw new EvalError();
     20  });
     21  assert(p instanceof Promise);
     22  await p;
     23  p = assert.throwsAsync(RangeError, async function () {
     24    throw new RangeError();
     25  });
     26  assert(p instanceof Promise);
     27  await p;
     28  p = assert.throwsAsync(ReferenceError, async function () {
     29    throw new ReferenceError();
     30  });
     31  assert(p instanceof Promise);
     32  await p;
     33  p = assert.throwsAsync(SyntaxError, async function () {
     34    throw new SyntaxError();
     35  });
     36  assert(p instanceof Promise);
     37  await p;
     38  p = assert.throwsAsync(TypeError, async function () {
     39    throw new TypeError();
     40  });
     41  assert(p instanceof Promise);
     42  await p;
     43  p = assert.throwsAsync(URIError, async function () {
     44    throw new URIError();
     45  });
     46  assert(p instanceof Promise);
     47  await p;
     48 });