Debian Codegraph @

js/src/tests/test262/built-ins/Promise/all/resolve-element-function-property-order.js

raw
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.all resolve element function property order
6 info: |
7 Set order: "length", "name"
8 ---*/
9
10 var resolveElementFunction;
11 var thenable = {
12 then: function(fulfill) {
13 resolveElementFunction = fulfill;
14 }
15 };
16
17 function NotPromise(executor) {
18 executor(function() {}, function() {});
19 }
20 NotPromise.resolve = function(v) {
21 return v;
22 };
23 Promise.all.call(NotPromise, [thenable]);
24
25 var propNames = Object.getOwnPropertyNames(resolveElementFunction);
26 var lengthIndex = propNames.indexOf("length");
27 var nameIndex = propNames.indexOf("name");
28
29 assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
30 "The `length` property comes before the `name` property on built-in functions");
31
32 reportCompare(0, 0);