-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set function
length
and name
in CreateBuiltinFunction
- Loading branch information
Showing
17 changed files
with
347 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Function constructor property order | ||
info: | | ||
Set order: "length", "name", ... | ||
---*/ | ||
|
||
var propNames = Object.getOwnPropertyNames(Function); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Function constructor property order | ||
info: | | ||
Set order: "length", "name", ... | ||
---*/ | ||
|
||
var propNames = Object.getOwnPropertyNames(Function.prototype); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Object constructor property order | ||
info: | | ||
Set order: "length", "name", ... | ||
---*/ | ||
|
||
var propNames = Object.getOwnPropertyNames(Object); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
30 changes: 30 additions & 0 deletions
30
test/built-ins/Promise/all/resolve-element-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise.all resolve element function property order | ||
info: | | ||
Set order: "length", "name" | ||
---*/ | ||
|
||
var resolveElementFunction; | ||
var thenable = { | ||
then: function(fulfill) { | ||
resolveElementFunction = fulfill; | ||
} | ||
}; | ||
|
||
function NotPromise(executor) { | ||
executor(function() {}, function() {}); | ||
} | ||
NotPromise.resolve = function(v) { | ||
return v; | ||
}; | ||
Promise.all.call(NotPromise, [thenable]); | ||
|
||
var propNames = Object.getOwnPropertyNames(resolveElementFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
31 changes: 31 additions & 0 deletions
31
test/built-ins/Promise/allSettled/reject-element-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise.allSettled reject element function property order | ||
info: | | ||
Set order: "length", "name" | ||
features: [Promise.allSettled] | ||
---*/ | ||
|
||
var rejectElementFunction; | ||
var thenable = { | ||
then: function(_, reject) { | ||
rejectElementFunction = reject; | ||
} | ||
}; | ||
|
||
function NotPromise(executor) { | ||
executor(function() {}, function() {}); | ||
} | ||
NotPromise.resolve = function(v) { | ||
return v; | ||
}; | ||
Promise.allSettled.call(NotPromise, [thenable]); | ||
|
||
var propNames = Object.getOwnPropertyNames(rejectElementFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
31 changes: 31 additions & 0 deletions
31
test/built-ins/Promise/allSettled/resolve-element-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise.allSettled resolve element function property order | ||
info: | | ||
Set order: "length", "name" | ||
features: [Promise.allSettled] | ||
---*/ | ||
|
||
var resolveElementFunction; | ||
var thenable = { | ||
then: function(fulfill) { | ||
resolveElementFunction = fulfill; | ||
} | ||
}; | ||
|
||
function NotPromise(executor) { | ||
executor(function() {}, function() {}); | ||
} | ||
NotPromise.resolve = function(v) { | ||
return v; | ||
}; | ||
Promise.allSettled.call(NotPromise, [thenable]); | ||
|
||
var propNames = Object.getOwnPropertyNames(resolveElementFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
31 changes: 31 additions & 0 deletions
31
test/built-ins/Promise/any/reject-element-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise.any resolve element function property order | ||
info: | | ||
Set order: "length", "name" | ||
features: [Promise.any] | ||
---*/ | ||
|
||
var rejectElementFunction; | ||
var thenable = { | ||
then: function(_, reject) { | ||
rejectElementFunction = reject; | ||
} | ||
}; | ||
|
||
function NotPromise(executor) { | ||
executor(function() {}, function() {}); | ||
} | ||
NotPromise.resolve = function(v) { | ||
return v; | ||
}; | ||
Promise.any.call(NotPromise, [thenable]); | ||
|
||
var propNames = Object.getOwnPropertyNames(rejectElementFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
23 changes: 23 additions & 0 deletions
23
test/built-ins/Promise/executor-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise executor function property order | ||
info: | | ||
Set order: "length", "name" | ||
---*/ | ||
|
||
var executorFunction; | ||
|
||
function NotPromise(executor) { | ||
executorFunction = executor; | ||
executor(function() {}, function() {}); | ||
} | ||
Promise.resolve.call(NotPromise); | ||
|
||
var propNames = Object.getOwnPropertyNames(executorFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise constructor property order | ||
info: | | ||
Set order: "length", "name", ... | ||
---*/ | ||
|
||
var propNames = Object.getOwnPropertyNames(Promise); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise reject function property order | ||
info: | | ||
Set order: "length", "name" | ||
---*/ | ||
|
||
var rejectFunction; | ||
new Promise(function(_, reject) { | ||
rejectFunction = reject; | ||
}); | ||
|
||
var propNames = Object.getOwnPropertyNames(rejectFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Promise resolve function property order | ||
info: | | ||
Set order: "length", "name" | ||
---*/ | ||
|
||
var resolveFunction; | ||
new Promise(function(resolve) { | ||
resolveFunction = resolve; | ||
}); | ||
|
||
var propNames = Object.getOwnPropertyNames(resolveFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Proxy constructor property order | ||
info: | | ||
Set order: "length", "name", ... | ||
features: [Proxy] | ||
---*/ | ||
|
||
var propNames = Object.getOwnPropertyNames(Proxy); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
17 changes: 17 additions & 0 deletions
17
test/built-ins/Proxy/revocable/revocation-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Proxy revocation function property order | ||
info: | | ||
Set order: "length", "name" | ||
---*/ | ||
|
||
var revocationFunction = Proxy.revocable({}, {}).revoke; | ||
|
||
var propNames = Object.getOwnPropertyNames(revocationFunction); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: "%ThrowTypeError% function property order" | ||
info: | | ||
Set order: "length", "name" | ||
---*/ | ||
|
||
var ThrowTypeError = Object.getOwnPropertyDescriptor(function() { | ||
"use strict"; | ||
return arguments; | ||
}(), "callee").get; | ||
|
||
var propNames = Object.getOwnPropertyNames(ThrowTypeError); | ||
var lengthIndex = propNames.indexOf("length"); | ||
var nameIndex = propNames.indexOf("name"); | ||
|
||
assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1, | ||
"The `length` property comes before the `name` property on built-in functions"); |
16 changes: 16 additions & 0 deletions
16
test/intl402/Collator/prototype/compare/compare-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: Collator bound compare function property order | ||
info: | | ||
Set order: "length", "name" | ||
includes: [compareArray.js] | ||
---*/ | ||
|
||
var compareFn = new Intl.Collator().compare; | ||
|
||
assert.compareArray( | ||
Object.getOwnPropertyNames(compareFn), | ||
['length', 'name'] | ||
); |
16 changes: 16 additions & 0 deletions
16
test/intl402/DateTimeFormat/prototype/format/format-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: DateTimeFormat bound format function property order | ||
info: | | ||
Set order: "length", "name" | ||
includes: [compareArray.js] | ||
---*/ | ||
|
||
var formatFn = new Intl.DateTimeFormat().format; | ||
|
||
assert.compareArray( | ||
Object.getOwnPropertyNames(formatFn), | ||
['length', 'name'] | ||
); |
16 changes: 16 additions & 0 deletions
16
test/intl402/NumberFormat/prototype/format/format-function-property-order.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (C) 2020 ExE Boss. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
esid: sec-createbuiltinfunction | ||
description: NumberFormat bound format function property order | ||
info: | | ||
Set order: "length", "name" | ||
includes: [compareArray.js] | ||
---*/ | ||
|
||
var formatFn = new Intl.NumberFormat().format; | ||
|
||
assert.compareArray( | ||
Object.getOwnPropertyNames(formatFn), | ||
['length', 'name'] | ||
); |