tor-browser

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

await-using-throw-cases.js (545B)


      1 // |jit-test| skip-if: !getBuildConfiguration("explicit-resource-management"); --enable-explicit-resource-management
      2 
      3 load(libdir + "asserts.js");
      4 
      5 async function throwsOnNonObjectDisposable() {
      6  await using a = 1;
      7 }
      8 throwsOnNonFunctionDispose().catch(e => {
      9  assertEq(e instanceof TypeError, true);
     10 });
     11 
     12 async function throwsOnNonFunctionDispose() {
     13  await using a = { [Symbol.asyncDispose]: 1 };
     14 }
     15 
     16 let reason = null;
     17 throwsOnNonFunctionDispose().catch(e => {
     18  reason = e;
     19 });
     20 drainJobQueue();
     21 assertEq(reason instanceof TypeError, true);