tor-browser

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

async-meth-dflt-params-abrupt.js (1400B)


      1 // |reftest| async
      2 // This file was procedurally generated from the following sources:
      3 // - src/function-forms/dflt-params-abrupt.case
      4 // - src/function-forms/error/async-meth.template
      5 /*---
      6 description: Abrupt completion returned by evaluation of initializer (async method)
      7 esid: sec-async-function-definitions
      8 features: [default-parameters, async-functions]
      9 flags: [generated, async]
     10 info: |
     11    14.6 Async Function Definitions
     12 
     13    AsyncMethod :
     14     async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
     15 
     16 
     17    14.1.19 Runtime Semantics: IteratorBindingInitialization
     18 
     19    FormalsList : FormalsList , FormalParameter
     20 
     21    1. Let status be the result of performing IteratorBindingInitialization for
     22       FormalsList using iteratorRecord and environment as the arguments.
     23    2. ReturnIfAbrupt(status).
     24    3. Return the result of performing IteratorBindingInitialization for
     25       FormalParameter using iteratorRecord and environment as the arguments.
     26 
     27 ---*/
     28 
     29 
     30 var callCount = 0;
     31 
     32 var obj = {
     33  async method(_ = (function() { throw new Test262Error(); }())) {
     34    
     35    callCount = callCount + 1;
     36  }
     37 };
     38 
     39 obj.method()
     40  .then(_ => {
     41    throw new Test262Error('function should not be resolved');
     42  }, error => assert.sameValue(error.constructor, Test262Error))
     43  .then(() => {
     44    assert.sameValue(callCount, 0, 'function body is not evaluated');
     45  }, $DONE)
     46  .then($DONE, $DONE);