tor-browser

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

does-not-invoke-array-setters.js (1428B)


      1 // |reftest| async
      2 // Copyright (C) 2019 Leo Balter. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-performpromiseallsettled
      7 description: >
      8  Indexed setter properties on Array.prototype are not invoked.
      9 info: |
     10  Promise.allSettled ( iterable )
     11 
     12  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
     13  7. If result is an abrupt completion, then
     14    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
     15    b, IfAbruptRejectPromise(result, promiseCapability).
     16 
     17  Runtime Semantics: PerformPromiseAllSettled ( iteratorRecord, constructor, resultCapability )
     18 
     19  ...
     20  4. Let remainingElementsCount be a new Record { [[value]]: 1 }.
     21  ...
     22  6.d ...
     23    ii. Set remainingElementsCount.[[value]] to remainingElementsCount.[[value]] − 1.
     24    iii. If remainingElementsCount.[[value]] is 0,
     25      1. Let valuesArray be CreateArrayFromList(values).
     26      ...
     27  ...
     28 
     29  7.3.16 CreateArrayFromList (elements)
     30    ...
     31    4. For each element e of elements
     32      a. Let status be CreateDataProperty(array, ToString(n), e).
     33      b. Assert: status is true.
     34    ...
     35 flags: [async]
     36 features: [Promise.allSettled]
     37 ---*/
     38 
     39 Object.defineProperty(Array.prototype, 0, {
     40  set() {
     41    throw new Test262Error('Setter on Array.prototype called');
     42  }
     43 });
     44 
     45 Promise.allSettled([42]).then(function() {
     46  $DONE();
     47 }, $DONE);