tor-browser

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

iter-step-err-no-close.js (1354B)


      1 // Copyright (C) 2019 Leo Balter. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-promise.allsettled
      6 description: >
      7  Error when advancing the provided iterable (not closing iterator)
      8 info: |
      9  Promise.allSettled ( iterable )
     10 
     11  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
     12  7. If result is an abrupt completion, then
     13    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
     14    b. IfAbruptRejectPromise(result, promiseCapability).
     15 
     16  Runtime Semantics: PerformPromiseAllSettled
     17 
     18  6. Repeat
     19    a. Let next be IteratorStep(iteratorRecord).
     20    b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
     21    c. ReturnIfAbrupt(next).
     22 features: [Promise.allSettled, Symbol.iterator]
     23 ---*/
     24 
     25 var iterStepThrows = {};
     26 var poisonedDone = {};
     27 var returnCount = 0;
     28 var error = new Test262Error();
     29 Object.defineProperty(poisonedDone, 'done', {
     30  get() {
     31    throw error;
     32  }
     33 });
     34 Object.defineProperty(poisonedDone, 'value', {
     35  get() {}
     36 });
     37 
     38 iterStepThrows[Symbol.iterator] = function() {
     39  return {
     40    next() {
     41      return poisonedDone;
     42    },
     43    return() {
     44      returnCount += 1;
     45      return {};
     46    }
     47  };
     48 };
     49 
     50 Promise.allSettled(iterStepThrows);
     51 
     52 assert.sameValue(returnCount, 0);
     53 
     54 reportCompare(0, 0);