tor-browser

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

ary-ptrn-elem-id-iter-val-err.js (1562B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case
      3 // - src/dstr-binding/error/try.template
      4 /*---
      5 description: Error forwarding when IteratorValue returns an abrupt completion (try statement)
      6 esid: sec-runtime-semantics-catchclauseevaluation
      7 features: [Symbol.iterator, destructuring-binding]
      8 flags: [generated]
      9 info: |
     10    Catch : catch ( CatchParameter ) Block
     11 
     12    [...]
     13    5. Let status be the result of performing BindingInitialization for
     14       CatchParameter passing thrownValue and catchEnv as arguments.
     15    [...]
     16 
     17    13.3.3.6 Runtime Semantics: IteratorBindingInitialization
     18 
     19    SingleNameBinding : BindingIdentifier Initializeropt
     20 
     21    [...]
     22    4. If iteratorRecord.[[done]] is false, then
     23       a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
     24       b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
     25       c. ReturnIfAbrupt(next).
     26       d. If next is false, set iteratorRecord.[[done]] to true.
     27       e. Else,
     28          i. Let v be IteratorValue(next).
     29          ii. If v is an abrupt completion, set iteratorRecord.[[done]] to
     30              true.
     31          iii. ReturnIfAbrupt(v).
     32 
     33 ---*/
     34 var poisonedValue = Object.defineProperty({}, 'value', {
     35  get: function() {
     36    throw new Test262Error();
     37  }
     38 });
     39 var g = {};
     40 g[Symbol.iterator] = function() {
     41  return {
     42    next: function() {
     43      return poisonedValue;
     44    }
     45  };
     46 };
     47 
     48 assert.throws(Test262Error, function() {
     49  try {
     50    throw g;
     51  } catch ([x]) {}
     52 });
     53 
     54 reportCompare(0, 0);