resolves-to-array.js (1046B)
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-promise.allsettled 7 description: Promise.allSettled returned a promise resolves into an array 8 info: | 9 Runtime Semantics: PerformPromiseAllSettled ( iteratorRecord, constructor, resultCapability ) 10 11 4. Let remainingElementsCount be a new Record { [[Value]]: 1 }. 12 ... 13 6.d ... 14 ii. Set remainingElementsCount.[[value]] to remainingElementsCount.[[value]] − 1. 15 iii. If remainingElementsCount.[[value]] is 0, then 16 1. Let valuesArray be CreateArrayFromList(values). 17 2. Perform ? Call(resultCapability.[[Resolve]], undefined, « valuesArray »). 18 ... 19 flags: [async] 20 features: [Promise.allSettled] 21 ---*/ 22 23 var arg = []; 24 25 Promise.allSettled([]).then(function(result) { 26 assert(Array.isArray(result)); 27 assert.sameValue(Object.getPrototypeOf(result), Array.prototype); 28 assert.notSameValue(result, arg, 'the resolved array is a new array'); 29 }).then($DONE, $DONE);