diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Object/seal | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/seal')
96 files changed, 3048 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/seal/abrupt-completion.js b/js/src/tests/test262/built-ins/Object/seal/abrupt-completion.js new file mode 100644 index 0000000000..46bea02399 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/abrupt-completion.js @@ -0,0 +1,31 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + O.[[PreventExtensions]]() returns abrupt completion. +info: | + Object.seal ( O ) + + ... + 2. Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + ... + 3. Let status be ? O.[[PreventExtensions]](). +features: [Proxy] +---*/ + +var p = new Proxy({}, { + preventExtensions: function() { + throw new Test262Error(); + }, +}); + +assert.throws(Test262Error, function() { + Object.seal(p); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/browser.js b/js/src/tests/test262/built-ins/Object/seal/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/browser.js diff --git a/js/src/tests/test262/built-ins/Object/seal/configurable-attribute-all-own-properties-set-from-true-to-false-property-are-unaltered.js b/js/src/tests/test262/built-ins/Object/seal/configurable-attribute-all-own-properties-set-from-true-to-false-property-are-unaltered.js new file mode 100644 index 0000000000..4b337ca128 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/configurable-attribute-all-own-properties-set-from-true-to-false-property-are-unaltered.js @@ -0,0 +1,60 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - the [[Configurable]] attribute of all own properties + of 'O' are set from true to false and other attributes of the + property are unaltered +includes: [propertyHelper.js] +---*/ + +var obj = {}; +obj.variableForHelpVerify = "data"; + +Object.defineProperty(obj, "foo1", { + value: 10, + writable: true, + enumerable: true, + configurable: true +}); + +function set_func(value) { + obj.variableForHelpVerify = value; +} + +function get_func() { + return 10; +} +Object.defineProperty(obj, "foo2", { + get: get_func, + set: set_func, + enumerable: true, + configurable: true +}); +var preCheck = Object.isExtensible(obj); +Object.seal(obj); + +if (!preCheck) { + throw new Test262Error('Expected preCheck to be true, actually ' + preCheck); +} + + +verifyEqualTo(obj, "foo1", 10); + +verifyWritable(obj, "foo1"); + +verifyEnumerable(obj, "foo1"); + +verifyNotConfigurable(obj, "foo1"); + +verifyEqualTo(obj, "foo2", get_func()); + +verifyWritable(obj, "foo2", "variableForHelpVerify"); + +verifyEnumerable(obj, "foo2"); + +verifyNotConfigurable(obj, "foo2"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/configurable-attribute-own-accessor-property-set-from-true-to-false-property-are-unaltered.js b/js/src/tests/test262/built-ins/Object/seal/configurable-attribute-own-accessor-property-set-from-true-to-false-property-are-unaltered.js new file mode 100644 index 0000000000..5c28cf68a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/configurable-attribute-own-accessor-property-set-from-true-to-false-property-are-unaltered.js @@ -0,0 +1,44 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - the [[Configurable]] attribute of own accessor + property of 'O' is set from true to false and other attributes of + the property are unaltered +includes: [propertyHelper.js] +---*/ + +var obj = {}; +obj.variableForHelpVerify = "data"; + +function setFunc(value) { + obj.variableForHelpVerify = value; +} + +function getFunc() { + return 10; +} +Object.defineProperty(obj, "foo", { + get: getFunc, + set: setFunc, + enumerable: true, + configurable: true +}); +var preCheck = Object.isExtensible(obj); +Object.seal(obj); + +if (!preCheck) { + throw new Test262Error('Expected preCheck to be true, actually ' + preCheck); +} + +verifyEqualTo(obj, "foo", getFunc()); + +verifyWritable(obj, "foo", "variableForHelpVerify"); + +verifyEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/length.js b/js/src/tests/test262/built-ins/Object/seal/length.js new file mode 100644 index 0000000000..114de5fd88 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/length.js @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: Object.seal '`length` property' +info: | + ECMAScript Standard Built-in Objects + + Every built-in function object, including constructors, has a "length" property whose value is an integer. Unless otherwise specified, this value is equal to the number of required parameters shown in the subclause headings for the function description. Optional parameters and rest parameters are not included in the parameter count. + + Unless otherwise specified, the "length" property of a built-in function object has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }. + +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Object.seal.length, 1); + +verifyNotEnumerable(Object.seal, "length"); +verifyNotWritable(Object.seal, "length"); +verifyConfigurable(Object.seal, "length"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/name.js b/js/src/tests/test262/built-ins/Object/seal/name.js new file mode 100644 index 0000000000..3b7047d2c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal.name is "seal". +info: | + Object.seal ( O ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Object.seal.name, "seal"); + +verifyNotEnumerable(Object.seal, "name"); +verifyNotWritable(Object.seal, "name"); +verifyConfigurable(Object.seal, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/not-a-constructor.js b/js/src/tests/test262/built-ins/Object/seal/not-a-constructor.js new file mode 100644 index 0000000000..97ade868fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Object.seal does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Object.seal), false, 'isConstructor(Object.seal) must return false'); + +assert.throws(TypeError, () => { + new Object.seal(); +}, '`new Object.seal()` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-all-own-properties-of-o-are-already-non-configurable.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-all-own-properties-of-o-are-already-non-configurable.js new file mode 100644 index 0000000000..563b4d318e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-all-own-properties-of-o-are-already-non-configurable.js @@ -0,0 +1,61 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - all own properties of 'O' are already + non-configurable +includes: [propertyHelper.js] +---*/ + +var obj = {}; +obj.variableForHelpVerify = "data"; + +Object.defineProperty(obj, "foo1", { + value: 10, + writable: true, + enumerable: true, + configurable: false +}); + +function set_func(value) { + obj.variableForHelpVerify = value; +} + +function get_func() { + return 10; +} +Object.defineProperty(obj, "foo2", { + get: get_func, + set: set_func, + enumerable: true, + configurable: false +}); + +if (!Object.isExtensible(obj)) { + throw new Test262Error('Expected obj to be extensible, actually ' + Object.isExtensible(obj)); +} + +Object.seal(obj); + +if (Object.isExtensible(obj)) { + throw new Test262Error('Expected obj NOT to be extensible, actually ' + Object.isExtensible(obj)); +} + +verifyEqualTo(obj, "foo1", 10); + +verifyWritable(obj, "foo1"); + +verifyEnumerable(obj, "foo1"); + +verifyNotConfigurable(obj, "foo1"); +verifyEqualTo(obj, "foo2", get_func()); + +verifyWritable(obj, "foo2", "variableForHelpVerify"); + +verifyEnumerable(obj, "foo2"); + +verifyNotConfigurable(obj, "foo2"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-configurable-attribute-of-own-data-property-of-o-is-set-from-true-to-false-and-other-attributes-of-the-property-are-unaltered.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-configurable-attribute-of-own-data-property-of-o-is-set-from-true-to-false-and-other-attributes-of-the-property-are-unaltered.js new file mode 100644 index 0000000000..0d59c51bca --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-configurable-attribute-of-own-data-property-of-o-is-set-from-true-to-false-and-other-attributes-of-the-property-are-unaltered.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - the [[Configurable]] attribute of own data property + of 'O' is set from true to false and other attributes of the + property are unaltered +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + writable: true, + enumerable: true, + configurable: true +}); +var preCheck = Object.isExtensible(obj); +Object.seal(obj); + +if (!preCheck) { + throw new Test262Error('Expected preCheck to be true, actually ' + preCheck); +} + +verifyEqualTo(obj, "foo", 10); + +verifyWritable(obj, "foo"); + +verifyEnumerable(obj, "foo"); + +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-extensible-of-o-is-set-as-false-even-if-o-has-no-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-extensible-of-o-is-set-as-false-even-if-o-has-no-own-property.js new file mode 100644 index 0000000000..3175f5757c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-extensible-of-o-is-set-as-false-even-if-o-has-no-own-property.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal - extensible of 'O' is set as false even if 'O' has no + own property +---*/ + +var obj = {}; + +var preCheck = Object.isExtensible(obj); + +Object.seal(obj); + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(Object.isExtensible(obj), false, 'Object.isExtensible(obj)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-inherited-accessor-properties-are-ignored.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-inherited-accessor-properties-are-ignored.js new file mode 100644 index 0000000000..39f5aaeaa8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-inherited-accessor-properties-are-ignored.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - inherited accessor properties are ignored +---*/ + +var proto = {}; + +Object.defineProperty(proto, "Father", { + get: function() { + return 10; + }, + configurable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var child = new ConstructFun(); +var preCheck = Object.isExtensible(child); +Object.seal(child); + +var beforeDeleted = proto.hasOwnProperty("Father"); +delete proto.Father; +var afterDeleted = proto.hasOwnProperty("Father"); + +assert(preCheck, 'preCheck !== true'); +assert(beforeDeleted, 'beforeDeleted !== true'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-inherited-data-properties-are-ignored.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-inherited-data-properties-are-ignored.js new file mode 100644 index 0000000000..03d3748c42 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-inherited-data-properties-are-ignored.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - inherited data properties are ignored +---*/ + +var proto = {}; + +Object.defineProperty(proto, "Father", { + value: 10, + configurable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var child = new ConstructFun(); +var preCheck = Object.isExtensible(child); +Object.seal(child); + +var beforeDeleted = proto.hasOwnProperty("Father"); +delete proto.Father; +var afterDeleted = proto.hasOwnProperty("Father"); + +assert(preCheck, 'preCheck !== true'); +assert(beforeDeleted, 'beforeDeleted !== true'); +assert.sameValue(afterDeleted, false, 'afterDeleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-is-a-function.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-is-a-function.js new file mode 100644 index 0000000000..0a596994e3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-is-a-function.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: Object.seal is a function +---*/ + +assert.sameValue(typeof Object.seal, "function", 'typeof(f)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-non-enumerable-own-property-of-o-is-sealed.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-non-enumerable-own-property-of-o-is-sealed.js new file mode 100644 index 0000000000..02501ec379 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-non-enumerable-own-property-of-o-is-sealed.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - non-enumerable own property of 'O' is sealed +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperty(obj, "foo", { + value: 10, + enumerable: false, + configurable: true +}); + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +assert(obj.hasOwnProperty("foo")); +verifyNotConfigurable(obj, "foo"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-boolean-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-boolean-object.js new file mode 100644 index 0000000000..0d26a332dc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-boolean-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is a Boolean object +---*/ + +var boolObj = new Boolean(false); +var preCheck = Object.isExtensible(boolObj); +Object.seal(boolObj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(boolObj), 'Object.isSealed(boolObj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-date-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-date-object.js new file mode 100644 index 0000000000..82fffe77d0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-date-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is a Date object +---*/ + +var dateObj = new Date(); +var preCheck = Object.isExtensible(dateObj); +Object.seal(dateObj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(dateObj), 'Object.isSealed(dateObj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-function-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-function-object.js new file mode 100644 index 0000000000..b64d9d06e4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-function-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is a Function object +---*/ + +var fun = function() {}; +var preCheck = Object.isExtensible(fun); +Object.seal(fun); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(fun), 'Object.isSealed(fun) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-number-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-number-object.js new file mode 100644 index 0000000000..5d9afc0199 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-number-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is a Number object +---*/ + +var numObj = new Number(3); +var preCheck = Object.isExtensible(numObj); +Object.seal(numObj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(numObj), 'Object.isSealed(numObj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-reg-exp-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-reg-exp-object.js new file mode 100644 index 0000000000..ef0965c89e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-reg-exp-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is a RegExp object +---*/ + +var regObj = new RegExp(); +var preCheck = Object.isExtensible(regObj); +Object.seal(regObj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(regObj), 'Object.isSealed(regObj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-string-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-string-object.js new file mode 100644 index 0000000000..ead6f43a93 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-a-string-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is a String object +---*/ + +var strObj = new String("a"); +var preCheck = Object.isExtensible(strObj); +Object.seal(strObj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(strObj), 'Object.isSealed(strObj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-arguments-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-arguments-object.js new file mode 100644 index 0000000000..80696cd34e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-arguments-object.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is an Arguments object +---*/ + +var argObj = (function() { + return arguments; +})(); + +var preCheck = Object.isExtensible(argObj); +Object.seal(argObj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(argObj), 'Object.isSealed(argObj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-array-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-array-object.js new file mode 100644 index 0000000000..d387979a78 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-array-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is an Array object +---*/ + +var arr = [0, 1]; +var preCheck = Object.isExtensible(arr); +Object.seal(arr); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(arr), 'Object.isSealed(arr) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-error-object.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-error-object.js new file mode 100644 index 0000000000..0d2c6c380d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-an-error-object.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is an Error object +---*/ + +var errObj = new Error(); +var preCheck = Object.isExtensible(errObj); +Object.seal(errObj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(errObj), 'Object.isSealed(errObj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-frozen-already.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-frozen-already.js new file mode 100644 index 0000000000..3649394ce8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-frozen-already.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is frozen already +---*/ + +var obj = {}; + +obj.foo = 10; // default value of attributes: writable: true, configurable: true, enumerable: true +var preCheck = Object.isExtensible(obj); +Object.freeze(obj); + +Object.seal(obj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(obj), 'Object.isSealed(obj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-sealed-already.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-sealed-already.js new file mode 100644 index 0000000000..a04eaf9c1e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-o-is-sealed-already.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'O' is sealed already +---*/ + +var obj = {}; + +obj.foo = 10; // default value of attributes: writable: true, configurable: true, enumerable: true +var preCheck = Object.isExtensible(obj); +Object.seal(obj); + +Object.seal(obj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(obj), 'Object.isSealed(obj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property-that-overrides-an-inherited-accessor-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property-that-overrides-an-inherited-accessor-property.js new file mode 100644 index 0000000000..7f5c68979e --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property-that-overrides-an-inherited-accessor-property.js @@ -0,0 +1,39 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own accessor property that overrides an + inherited accessor property +includes: [propertyHelper.js] +---*/ + +var proto = {}; + +Object.defineProperty(proto, "foo", { + get: function() { + return 0; + }, + configurable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var obj = new ConstructFun(); + +Object.defineProperty(obj, "foo", { + get: function() { + return 10; + }, + configurable: true +}); + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property-that-overrides-an-inherited-data-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property-that-overrides-an-inherited-data-property.js new file mode 100644 index 0000000000..e3a3707431 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property-that-overrides-an-inherited-data-property.js @@ -0,0 +1,37 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own accessor property that overrides an + inherited data property +includes: [propertyHelper.js] +---*/ + +var proto = {}; + +Object.defineProperty(proto, "foo", { + value: 0, + configurable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var obj = new ConstructFun(); + +Object.defineProperty(obj, "foo", { + get: function() { + return 10; + }, + configurable: true +}); + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property.js new file mode 100644 index 0000000000..3704d492ba --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-accessor-property.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'P' is own accessor property +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +Object.defineProperty(obj, "foo", { + get: function() { + return 10; + }, + configurable: true +}); + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property-that-overrides-an-inherited-accessor-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property-that-overrides-an-inherited-accessor-property.js new file mode 100644 index 0000000000..e146af8558 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property-that-overrides-an-inherited-accessor-property.js @@ -0,0 +1,36 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own data property that overrides an inherited + accessor property +includes: [propertyHelper.js] +---*/ + +var proto = {}; + +Object.defineProperty(proto, "foo", { + get: function() { + return 0; + }, + configurable: true +}); + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var obj = new ConstructFun(); +Object.defineProperty(obj, "foo", { + value: 10, + configurable: true +}); + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property-that-overrides-an-inherited-data-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property-that-overrides-an-inherited-data-property.js new file mode 100644 index 0000000000..e62e3fb902 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property-that-overrides-an-inherited-data-property.js @@ -0,0 +1,31 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own data property that overrides an inherited + data property +includes: [propertyHelper.js] +---*/ + +var proto = { + foo: 0 +}; + +var ConstructFun = function() {}; +ConstructFun.prototype = proto; + +var obj = new ConstructFun(); +Object.defineProperty(obj, "foo", { + value: 10, + configurable: true +}); + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property.js new file mode 100644 index 0000000000..d19e947979 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-data-property.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - 'P' is own data property +includes: [propertyHelper.js] +---*/ + +var obj = {}; + +obj.foo = 10; // default [[Configurable]] attribute value of foo: true + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-boolean-object-that-uses-object-s-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-boolean-object-that-uses-object-s-get-own-property.js new file mode 100644 index 0000000000..20d4898020 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-boolean-object-that-uses-object-s-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of a Boolean object that uses + Object's [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = new Boolean(false); + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-date-object-that-uses-object-s-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-date-object-that-uses-object-s-get-own-property.js new file mode 100644 index 0000000000..2517e70bc0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-date-object-that-uses-object-s-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of a Date object that uses + Object's [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = new Date(); + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-function-object-that-uses-object-s-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-function-object-that-uses-object-s-get-own-property.js new file mode 100644 index 0000000000..18c786075d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-function-object-that-uses-object-s-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of a Function object that uses + Object's [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = function() {}; + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-number-object-that-uses-object-s-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-number-object-that-uses-object-s-get-own-property.js new file mode 100644 index 0000000000..9db2104ff6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-number-object-that-uses-object-s-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of a Number object that uses + Object's [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = new Number(-1); + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-reg-exp-object-that-uses-object-s-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-reg-exp-object-that-uses-object-s-get-own-property.js new file mode 100644 index 0000000000..839ce7dd37 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-reg-exp-object-that-uses-object-s-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of a RegExp object that uses + Object's [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = new RegExp(); + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-string-object-which-implements-its-own-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-string-object-which-implements-its-own-get-own-property.js new file mode 100644 index 0000000000..7561754fd0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-a-string-object-which-implements-its-own-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of a String object which + implements its own [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = new String("abc"); + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-arguments-object-which-implements-its-own-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-arguments-object-which-implements-its-own-get-own-property.js new file mode 100644 index 0000000000..39853c155f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-arguments-object-which-implements-its-own-get-own-property.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of an Arguments object which + implements its own [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = (function() { + return arguments; +})(); + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-array-object-that-uses-object-s-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-array-object-that-uses-object-s-get-own-property.js new file mode 100644 index 0000000000..26e19643df --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-array-object-that-uses-object-s-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of an Array object that uses + Object's [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = []; + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-error-object-that-uses-object-s-get-own-property.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-error-object-that-uses-object-s-get-own-property.js new file mode 100644 index 0000000000..045b2c0248 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-p-is-own-property-of-an-error-object-that-uses-object-s-get-own-property.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: > + Object.seal - 'P' is own property of an Error object that uses + Object's [[GetOwnProperty]] +includes: [propertyHelper.js] +---*/ + +var obj = new Error(); + +obj.foo = 10; + +assert(Object.isExtensible(obj)); +Object.seal(obj); + +verifyNotConfigurable(obj, "foo"); +assert.sameValue(obj.foo, 10); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-returned-object-is-not-extensible.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-returned-object-is-not-extensible.js new file mode 100644 index 0000000000..6179bb9c60 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-returned-object-is-not-extensible.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - returned object is not extensible +---*/ + +var obj = {}; +var preCheck = Object.isExtensible(obj); +Object.seal(obj); + +assert(preCheck, 'preCheck !== true'); +assert.sameValue(Object.isExtensible(obj), false, 'Object.isExtensible(obj)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/object-seal-the-extension-of-o-is-prevented-already.js b/js/src/tests/test262/built-ins/Object/seal/object-seal-the-extension-of-o-is-prevented-already.js new file mode 100644 index 0000000000..1393ff78d5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/object-seal-the-extension-of-o-is-prevented-already.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-setintegritylevel +description: Object.seal - the extension of 'O' is prevented already +---*/ + +var obj = {}; + +obj.foo = 10; // default value of attributes: writable: true, configurable: true, enumerable: true +var preCheck = Object.isExtensible(obj); +Object.preventExtensions(obj); +Object.seal(obj); + +assert(preCheck, 'preCheck !== true'); +assert(Object.isSealed(obj), 'Object.isSealed(obj) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/proxy-no-ownkeys-returned-keys-order.js b/js/src/tests/test262/built-ins/Object/seal/proxy-no-ownkeys-returned-keys-order.js new file mode 100644 index 0000000000..691ee9af86 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/proxy-no-ownkeys-returned-keys-order.js @@ -0,0 +1,54 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.seal +description: > + If Proxy "ownKeys" trap is missing, keys are sorted by type in ascending + chronological order. +info: | + SetIntegrityLevel ( O, level ) + + [...] + 5. Let keys be ? O.[[OwnPropertyKeys]](). + 6. If level is sealed, then + a. For each element k of keys, do + i. Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + + [[OwnPropertyKeys]] ( ) + + [...] + 6. If trap is undefined, then + a. Return ? target.[[OwnPropertyKeys]](). + + OrdinaryOwnPropertyKeys ( O ) + + [...] + 3. For each own property key P of O such that Type(P) is String and P is + not an array index, in ascending chronological order of property creation, do + a. Add P as the last element of keys. + 4. For each own property key P of O such that Type(P) is Symbol, + in ascending chronological order of property creation, do + a. Add P as the last element of keys. + 5. Return keys. +features: [Proxy, Symbol, Reflect] +includes: [compareArray.js] +---*/ + +var target = {}; +var sym = Symbol(); +target[sym] = 1; +target.foo = 2; +target[0] = 3; + +var definePropertyKeys = []; +var proxy = new Proxy(target, { + defineProperty: function(target, key, descriptor) { + definePropertyKeys.push(key); + return Reflect.defineProperty(target, key, descriptor); + }, +}); + +Object.seal(proxy); +assert.compareArray(definePropertyKeys, ["0", "foo", sym]); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/proxy-with-defineProperty-handler.js b/js/src/tests/test262/built-ins/Object/seal/proxy-with-defineProperty-handler.js new file mode 100644 index 0000000000..ef3480de65 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/proxy-with-defineProperty-handler.js @@ -0,0 +1,43 @@ +// Copyright (C) 2021 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.seal +description: > + [[DefineOwnProperty]] is called with partial descriptor with only [[Configurable]] field present. +info: | + SetIntegrityLevel ( O, level ) + + [...] + 5. Let keys be ? O.[[OwnPropertyKeys]](). + 6. If level is sealed, then + a. For each element k of keys, do + i. Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). +features: [Symbol, Proxy, Reflect] +---*/ + +var sym = Symbol(); +var seenDescriptors = {}; +var proxy = new Proxy({ + [sym]: 1, + get foo() {}, + set foo(_v) {}, +}, { + defineProperty: function(target, key, descriptor) { + seenDescriptors[key] = descriptor; + return Reflect.defineProperty(target, key, descriptor); + }, +}); + +Object.seal(proxy); + +assert.sameValue(seenDescriptors[sym].value, undefined, "value"); +assert.sameValue(seenDescriptors[sym].writable, undefined, "writable"); +assert.sameValue(seenDescriptors[sym].enumerable, undefined, "enumerable"); +assert.sameValue(seenDescriptors[sym].configurable, false, "configurable"); + +assert.sameValue(seenDescriptors.foo.get, undefined, "get"); +assert.sameValue(seenDescriptors.foo.set, undefined, "set"); +assert.sameValue(seenDescriptors.foo.enumerable, undefined, "enumerable"); +assert.sameValue(seenDescriptors.foo.configurable, false, "configurable"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-aggregateerror.js b/js/src/tests/test262/built-ins/Object/seal/seal-aggregateerror.js new file mode 100644 index 0000000000..909979f3fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-aggregateerror.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal AggregateError +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +features: [AggregateError] +---*/ + +Object.seal(new AggregateError([])); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-arraybuffer.js b/js/src/tests/test262/built-ins/Object/seal/seal-arraybuffer.js new file mode 100644 index 0000000000..168d8fe135 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-arraybuffer.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal ArrayBuffer +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new ArrayBuffer()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-arrowfunction.js b/js/src/tests/test262/built-ins/Object/seal/seal-arrowfunction.js new file mode 100644 index 0000000000..318716f0dd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-arrowfunction.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal ArrowFunction +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new (Object.getPrototypeOf(() => {}).constructor)()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-asyncarrowfunction.js b/js/src/tests/test262/built-ins/Object/seal/seal-asyncarrowfunction.js new file mode 100644 index 0000000000..72122b12a8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-asyncarrowfunction.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal AsyncArrowFunction +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new (Object.getPrototypeOf(async () => {}).constructor)()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-asyncfunction.js b/js/src/tests/test262/built-ins/Object/seal/seal-asyncfunction.js new file mode 100644 index 0000000000..1908f4a34b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-asyncfunction.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal AsyncFunction +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new (Object.getPrototypeOf(async function() {}).constructor)()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-asyncgeneratorfunction.js b/js/src/tests/test262/built-ins/Object/seal/seal-asyncgeneratorfunction.js new file mode 100644 index 0000000000..d92e188b5d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-asyncgeneratorfunction.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal AsyncGeneratorFunction +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new (Object.getPrototypeOf(async function * () {}).constructor)()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-bigint64array.js b/js/src/tests/test262/built-ins/Object/seal/seal-bigint64array.js new file mode 100644 index 0000000000..4ef09db623 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-bigint64array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal BigInt64Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new BigInt64Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-biguint64array.js b/js/src/tests/test262/built-ins/Object/seal/seal-biguint64array.js new file mode 100644 index 0000000000..42c0b001fa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-biguint64array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal BigUint64Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new BigUint64Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-boolean-literal.js b/js/src/tests/test262/built-ins/Object/seal/seal-boolean-literal.js new file mode 100644 index 0000000000..60e4db96a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-boolean-literal.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal boolean literal +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-boolean.js b/js/src/tests/test262/built-ins/Object/seal/seal-boolean.js new file mode 100644 index 0000000000..fae83d7a21 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-boolean.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Boolean +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Boolean()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-dataview.js b/js/src/tests/test262/built-ins/Object/seal/seal-dataview.js new file mode 100644 index 0000000000..4840652567 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-dataview.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal DataView +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new DataView(new ArrayBuffer(4))); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-date.js b/js/src/tests/test262/built-ins/Object/seal/seal-date.js new file mode 100644 index 0000000000..f383c96c5f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-date.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Date +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Date()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-error.js b/js/src/tests/test262/built-ins/Object/seal/seal-error.js new file mode 100644 index 0000000000..1a9a6fcedf --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-error.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Error +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Error()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-evalerror.js b/js/src/tests/test262/built-ins/Object/seal/seal-evalerror.js new file mode 100644 index 0000000000..0b5fb1ce4c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-evalerror.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal EvalError +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new EvalError()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-finalizationregistry.js b/js/src/tests/test262/built-ins/Object/seal/seal-finalizationregistry.js new file mode 100644 index 0000000000..cf6207190c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-finalizationregistry.js @@ -0,0 +1,39 @@ +// |reftest| skip-if(!this.hasOwnProperty('FinalizationRegistry')) -- FinalizationRegistry is not enabled unconditionally +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal FinalizationRegistry +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. +features: [FinalizationRegistry] +---*/ + +Object.seal(new FinalizationRegistry(() => {})); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-float32array.js b/js/src/tests/test262/built-ins/Object/seal/seal-float32array.js new file mode 100644 index 0000000000..280a43c4f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-float32array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Float32Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Float32Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-float64array.js b/js/src/tests/test262/built-ins/Object/seal/seal-float64array.js new file mode 100644 index 0000000000..cd1da089d5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-float64array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Float64Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Float64Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-function.js b/js/src/tests/test262/built-ins/Object/seal/seal-function.js new file mode 100644 index 0000000000..4cabc36195 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-function.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Function +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Function()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-generatorfunction.js b/js/src/tests/test262/built-ins/Object/seal/seal-generatorfunction.js new file mode 100644 index 0000000000..953ce21fc6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-generatorfunction.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal GeneratorFunction +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new (Object.getPrototypeOf(function * () {}).constructor)()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-infinity.js b/js/src/tests/test262/built-ins/Object/seal/seal-infinity.js new file mode 100644 index 0000000000..51681fe70f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-infinity.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Infinity +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(Infinity); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-int16array.js b/js/src/tests/test262/built-ins/Object/seal/seal-int16array.js new file mode 100644 index 0000000000..9997d78cc4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-int16array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Int16Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Int16Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-int32array.js b/js/src/tests/test262/built-ins/Object/seal/seal-int32array.js new file mode 100644 index 0000000000..0d7fb971c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-int32array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Int32Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Int32Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-int8array.js b/js/src/tests/test262/built-ins/Object/seal/seal-int8array.js new file mode 100644 index 0000000000..6aeb1d8250 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-int8array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Int8Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Int8Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-map.js b/js/src/tests/test262/built-ins/Object/seal/seal-map.js new file mode 100644 index 0000000000..1c02f213c1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-map.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Map +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Map()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-nan.js b/js/src/tests/test262/built-ins/Object/seal/seal-nan.js new file mode 100644 index 0000000000..3256719209 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-nan.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal NaN +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(NaN); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-null.js b/js/src/tests/test262/built-ins/Object/seal/seal-null.js new file mode 100644 index 0000000000..244576211a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-null.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal null +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(null); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-number.js b/js/src/tests/test262/built-ins/Object/seal/seal-number.js new file mode 100644 index 0000000000..33331c93ee --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-number.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Number +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Number(1)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-object.js b/js/src/tests/test262/built-ins/Object/seal/seal-object.js new file mode 100644 index 0000000000..cccd2b1212 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-object.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Object +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Object()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-promise.js b/js/src/tests/test262/built-ins/Object/seal/seal-promise.js new file mode 100644 index 0000000000..5db80ce789 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-promise.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Promise +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Promise(() => {})); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-proxy.js b/js/src/tests/test262/built-ins/Object/seal/seal-proxy.js new file mode 100644 index 0000000000..0eb080e73b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-proxy.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Proxy +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Proxy({}, {})); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-rangeerror.js b/js/src/tests/test262/built-ins/Object/seal/seal-rangeerror.js new file mode 100644 index 0000000000..0db3c96158 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-rangeerror.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal RangeError +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new RangeError()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-referenceerror.js b/js/src/tests/test262/built-ins/Object/seal/seal-referenceerror.js new file mode 100644 index 0000000000..51dc89f29f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-referenceerror.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal ReferenceError +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new ReferenceError()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-regexp.js b/js/src/tests/test262/built-ins/Object/seal/seal-regexp.js new file mode 100644 index 0000000000..b8a29e4647 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-regexp.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal RegExp +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new RegExp("")); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-set.js b/js/src/tests/test262/built-ins/Object/seal/seal-set.js new file mode 100644 index 0000000000..1df01af338 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-set.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Set +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Set()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-sharedarraybuffer.js b/js/src/tests/test262/built-ins/Object/seal/seal-sharedarraybuffer.js new file mode 100644 index 0000000000..b89bd0cbc2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-sharedarraybuffer.js @@ -0,0 +1,39 @@ +// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal SharedArrayBuffer +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. +features: [SharedArrayBuffer] +---*/ + +Object.seal(new SharedArrayBuffer(4)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-string.js b/js/src/tests/test262/built-ins/Object/seal/seal-string.js new file mode 100644 index 0000000000..419de2065f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-string.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal String +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new String("")); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-symbol.js b/js/src/tests/test262/built-ins/Object/seal/seal-symbol.js new file mode 100644 index 0000000000..e925ab8458 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-symbol.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Symbol +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(Symbol()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-syntaxerror.js b/js/src/tests/test262/built-ins/Object/seal/seal-syntaxerror.js new file mode 100644 index 0000000000..882196bf8f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-syntaxerror.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal SyntaxError +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new SyntaxError()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-typeerror.js b/js/src/tests/test262/built-ins/Object/seal/seal-typeerror.js new file mode 100644 index 0000000000..2c121a83c9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-typeerror.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal TypeError +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new TypeError()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-uint16array.js b/js/src/tests/test262/built-ins/Object/seal/seal-uint16array.js new file mode 100644 index 0000000000..ff2fe2423b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-uint16array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Uint16Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Uint16Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-uint32array.js b/js/src/tests/test262/built-ins/Object/seal/seal-uint32array.js new file mode 100644 index 0000000000..09bd1068d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-uint32array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Uint32Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Uint32Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-uint8array.js b/js/src/tests/test262/built-ins/Object/seal/seal-uint8array.js new file mode 100644 index 0000000000..6a246b9f1b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-uint8array.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Uint8Array +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Uint8Array()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-uint8clampedarray.js b/js/src/tests/test262/built-ins/Object/seal/seal-uint8clampedarray.js new file mode 100644 index 0000000000..de2afe8695 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-uint8clampedarray.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal Uint8ClampedArray +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new Uint8ClampedArray()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-undefined.js b/js/src/tests/test262/built-ins/Object/seal/seal-undefined.js new file mode 100644 index 0000000000..248bb4938d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-undefined.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal undefined +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-urierror.js b/js/src/tests/test262/built-ins/Object/seal/seal-urierror.js new file mode 100644 index 0000000000..45f073929d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-urierror.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal URIError +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new URIError()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-weakmap.js b/js/src/tests/test262/built-ins/Object/seal/seal-weakmap.js new file mode 100644 index 0000000000..cd6d5867fa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-weakmap.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal WeakMap +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new WeakMap()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-weakref.js b/js/src/tests/test262/built-ins/Object/seal/seal-weakref.js new file mode 100644 index 0000000000..5ae7ae0cea --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-weakref.js @@ -0,0 +1,39 @@ +// |reftest| skip-if(!this.hasOwnProperty('WeakRef')) -- WeakRef is not enabled unconditionally +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal WeakRef +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. +features: [WeakRef] +---*/ + +Object.seal(new WeakRef({})); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/seal-weakset.js b/js/src/tests/test262/built-ins/Object/seal/seal-weakset.js new file mode 100644 index 0000000000..0670e68857 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/seal-weakset.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal WeakSet +info: | + If Type(O) is not Object, return O. + Let status be ? SetIntegrityLevel(O, sealed). + + SetIntegrityLevel ( O, level ) + + Assert: Type(O) is Object. + Assert: level is either sealed or frozen. + Let status be ? O.[[PreventExtensions]](). + If status is false, return false. + Let keys be ? O.[[OwnPropertyKeys]](). + If level is sealed, then + For each element k of keys, do + Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }). + Else, + Assert: level is frozen. + For each element k of keys, do + Let currentDesc be ? O.[[GetOwnProperty]](k). + If currentDesc is not undefined, then + If IsAccessorDescriptor(currentDesc) is true, then + Let desc be the PropertyDescriptor { [[Configurable]]: false }. + Else, + Let desc be the PropertyDescriptor { [[Configurable]]: false, [[Writable]]: false }. + Perform ? DefinePropertyOrThrow(O, k, desc). + Return true. + +---*/ + +Object.seal(new WeakSet()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/shell.js b/js/src/tests/test262/built-ins/Object/seal/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/shell.js diff --git a/js/src/tests/test262/built-ins/Object/seal/symbol-object-contains-symbol-properties-non-strict.js b/js/src/tests/test262/built-ins/Object/seal/symbol-object-contains-symbol-properties-non-strict.js new file mode 100644 index 0000000000..8ac06f108c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/symbol-object-contains-symbol-properties-non-strict.js @@ -0,0 +1,22 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.seal +description: > + Object.seal(obj) where obj contains symbol properties. +flags: [noStrict] +features: [Symbol] +---*/ +var symA = Symbol("A"); +var symB = Symbol("B"); +var obj = {}; +obj[symA] = 1; +Object.seal(obj); +obj[symA] = 2; +obj[symB] = 1; + +assert.sameValue(obj[symA], 2, "The value of `obj[symA]` is `2`"); +assert.sameValue(delete obj[symA], false, "`delete obj[symA]` is `false`"); +assert.sameValue(obj[symB], undefined, "The value of `obj[symB]` is `undefined`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/symbol-object-contains-symbol-properties-strict-strict.js b/js/src/tests/test262/built-ins/Object/seal/symbol-object-contains-symbol-properties-strict-strict.js new file mode 100644 index 0000000000..1c2715e311 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/symbol-object-contains-symbol-properties-strict-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.seal +description: > + Object.seal(obj) where obj contains symbol properties. +flags: [onlyStrict] +features: [Symbol] +---*/ +var symA = Symbol("A"); +var symB = Symbol("B"); +var obj = {}; +obj[symA] = 1; +Object.seal(obj); +obj[symA] = 2; + +assert.sameValue(obj[symA], 2, "The value of `obj[symA]` is `2`"); + +assert.throws(TypeError, function() { + delete obj[symA]; +}); + +assert.throws(TypeError, function() { + obj[symB] = 1; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/seal/throws-when-false.js b/js/src/tests/test262/built-ins/Object/seal/throws-when-false.js new file mode 100644 index 0000000000..810fcb590d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/seal/throws-when-false.js @@ -0,0 +1,30 @@ +// Copyright (C) 2019 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.seal +description: > + Object.seal throws if SetIntegrityLevel(O, sealed) returns false. +info: | + Object.seal ( O ) + ... + 2. Let status be ? SetIntegrityLevel(O, sealed). + 3. If status is false, throw a TypeError exception. + + SetIntegrityLevel ( O, level ) + ... + 3. Let status be ? O.[[PreventExtensions]](). + 4. If status is false, return false. +---*/ + +const p = new Proxy({}, { + preventExtensions() { + return false; + }, +}); + +assert.throws(TypeError, () => { + Object.seal(p); +}); + +reportCompare(0, 0); |