resolve-element-function-property-order.js (927B)
1 // Copyright (C) 2020 ExE Boss. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-createbuiltinfunction 5 description: Promise.allSettled resolve element function property order 6 info: | 7 Set order: "length", "name" 8 features: [Promise.allSettled] 9 ---*/ 10 11 var resolveElementFunction; 12 var thenable = { 13 then: function(fulfill) { 14 resolveElementFunction = fulfill; 15 } 16 }; 17 18 function NotPromise(executor) { 19 executor(function() {}, function() {}); 20 } 21 NotPromise.resolve = function(v) { 22 return v; 23 }; 24 Promise.allSettled.call(NotPromise, [thenable]); 25 26 var propNames = Object.getOwnPropertyNames(resolveElementFunction); 27 var lengthIndex = propNames.indexOf("length"); 28 var nameIndex = propNames.indexOf("name"); 29 30 assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, 31 "The `length` property comes before the `name` property on built-in functions"); 32 33 reportCompare(0, 0);