Fix attributes of length property for builtin objects (#3556)

* length property has the attributes {[[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true} based on ECMA-262 v6, 19.2.4.1

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
This commit is contained in:
Hyukwoo Park
2020-02-14 18:25:26 +09:00
committed by GitHub
parent 4d67ac3225
commit 54e4de39ab
34 changed files with 140 additions and 58 deletions
@@ -13,4 +13,4 @@
* limitations under the License.
*/
assert (Promise.prototype.length === 1);
assert (Promise.length === 1);
-1
View File
@@ -1110,7 +1110,6 @@
./15/15.03/15.03.03/15.03.03.01/15.03.03.01-002.js
./15/15.03/15.03.03/15.03.03.01/15.03.03.01-003.js
./15/15.03/15.03.03/15.03.03.01/15.03.03.01-004.js
./15/15.03/15.03.03/15.03.03.02/15.03.03.02-001.js
./15/15.03/15.03.04/15.03.04.02/15.03.04.02-001.js
./15/15.03/15.03.04/15.03.04.02/15.03.04.02-002.js
./15/15.03/15.03.04/15.03.04.02/15.03.04.02-003.js
+102
View File
@@ -0,0 +1,102 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var builtin_objects = [
Array,
ArrayBuffer,
Boolean,
DataView,
Date,
Error,
EvalError,
Function,
Map,
Number,
Object,
Promise,
RangeError,
ReferenceError,
RegExp,
Set,
String,
Symbol,
SyntaxError,
TypeError,
URIError,
WeakMap,
WeakSet,
];
var builtin_prototypes = [Function.prototype]
var builtin_typedArrays = [
Float32Array,
Float64Array,
Int16Array,
Int32Array,
Int8Array,
Uint16Array,
Uint32Array,
Uint8Array,
Uint8ClampedArray,
];
(function () {
/* each length property is configurable */
var desc;
for (obj of builtin_objects) {
desc = Object.getOwnPropertyDescriptor(obj, 'length');
assert(desc.writable === false);
assert(desc.enumerable === false);
assert(desc.configurable === true);
}
for (proto of builtin_prototypes) {
desc = Object.getOwnPropertyDescriptor(proto, 'length');
assert(desc.writable === false);
assert(desc.enumerable === false);
assert(desc.configurable === true);
}
for (ta of builtin_typedArrays) {
desc = Object.getOwnPropertyDescriptor(ta, 'length');
assert(desc.writable === false);
assert(desc.enumerable === false);
assert(desc.configurable === true);
}
})();
(function () {
/* each length property can be deleted */
for (obj of builtin_objects) {
assert(obj.hasOwnProperty('length') === true);
assert(delete obj.length);
assert(obj.hasOwnProperty('length') === false);
}
for (proto of builtin_prototypes) {
assert(proto.hasOwnProperty('length') === true);
assert(delete proto.length);
assert(proto.hasOwnProperty('length') === false);
}
for (ta of builtin_typedArrays) {
assert(ta.hasOwnProperty('length') === true);
assert(delete ta.length);
assert(ta.hasOwnProperty('length') === false);
}
})();
@@ -16,4 +16,4 @@ var desc = Object.getOwnPropertyDescriptor(Function, "length");
assert(desc.value === 1 &&
desc.writable === false &&
desc.enumerable === false &&
desc.configurable === false);
desc.configurable === false);