tor-browser

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

await-using-not-allowed-at-top-level-of-eval.js (1250B)


      1 // |reftest| shell-option(--enable-explicit-resource-management) skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('explicit-resource-management'))||!xulRuntime.shell) async -- explicit-resource-management is not enabled unconditionally, requires shell-options
      2 // Copyright (C) 2023 Ron Buckton. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-let-const-using-and-await-using-declarations-static-semantics-early-errors
      7 description: >
      8    await using declarations not allowed at the top level of eval. Note that Eval parses text using the Script goal.
      9 info: |
     10  AwaitUsingDeclaration : CoverAwaitExpressionAndAwaitUsingDeclarationHead BindingList ;
     11 
     12  - It is a Syntax Error if the goal symbol is Script and UsingDeclaration is not contained, either directly or 
     13    indirectly, within a Block, ForStatement, ForInOfStatement, FunctionBody, GeneratorBody, 
     14    AsyncGeneratorBody, AsyncFunctionBody, ClassStaticBlockBody, or ClassBody.
     15 
     16 flags: [async]
     17 includes: [asyncHelpers.js]
     18 features: [explicit-resource-management]
     19 ---*/
     20 
     21 asyncTest(async function () {
     22  await assert.throwsAsync(SyntaxError, async function () {
     23    eval('await using x = null;')
     24  });
     25 });