tor-browser

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

await-using-null-undef.js (479B)


      1 // |jit-test| skip-if: !getBuildConfiguration("explicit-resource-management"); --enable-explicit-resource-management
      2 
      3 load(libdir + "asserts.js");
      4 
      5 {
      6  const disposed = [];
      7  async function testAllowedNullAndUndefInitialisers() {
      8    await using x = null;
      9    await using y = undefined;
     10    await using z = {
     11      [Symbol.asyncDispose]() {
     12        disposed.push(1);
     13      }
     14    }
     15  }
     16  testAllowedNullAndUndefInitialisers();
     17  drainJobQueue();
     18  assertArrayEq(disposed, [1]);
     19 }