ctx-ctor.js (887B)
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 description: > 6 Promise.allSettled invoked on a constructor value 7 esid: sec-promise.allsettled 8 info: | 9 3. Let promiseCapability be ? NewPromiseCapability(C). 10 ... 11 6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability). 12 ... 13 8. Return Completion(result). 14 features: [Promise.allSettled, class] 15 ---*/ 16 17 var executor = null; 18 var callCount = 0; 19 20 class SubPromise extends Promise { 21 constructor(a) { 22 super(a); 23 executor = a; 24 callCount += 1; 25 } 26 } 27 28 var instance = Promise.allSettled.call(SubPromise, []); 29 30 assert.sameValue(instance.constructor, SubPromise); 31 assert.sameValue(instance instanceof SubPromise, true); 32 33 assert.sameValue(callCount, 1); 34 assert.sameValue(typeof executor, 'function'); 35 36 reportCompare(0, 0);