From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../built-ins/Reflect/deleteProperty/browser.js | 0 .../Reflect/deleteProperty/delete-properties.js | 23 ++++++++++++++ .../deleteProperty/delete-symbol-properties.js | 32 ++++++++++++++++++++ .../Reflect/deleteProperty/deleteProperty.js | 20 +++++++++++++ .../built-ins/Reflect/deleteProperty/length.js | 20 +++++++++++++ .../built-ins/Reflect/deleteProperty/name.js | 25 ++++++++++++++++ .../Reflect/deleteProperty/not-a-constructor.js | 35 ++++++++++++++++++++++ .../return-abrupt-from-property-key.js | 27 +++++++++++++++++ .../deleteProperty/return-abrupt-from-result.js | 27 +++++++++++++++++ .../Reflect/deleteProperty/return-boolean.js | 26 ++++++++++++++++ .../built-ins/Reflect/deleteProperty/shell.js | 24 +++++++++++++++ .../deleteProperty/target-is-not-object-throws.js | 31 +++++++++++++++++++ .../deleteProperty/target-is-symbol-throws.js | 19 ++++++++++++ 13 files changed, 309 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/browser.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-properties.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-symbol-properties.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/deleteProperty.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/length.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/name.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/not-a-constructor.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-property-key.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-result.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/return-boolean.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/shell.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-not-object-throws.js create mode 100644 js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-symbol-throws.js (limited to 'js/src/tests/test262/built-ins/Reflect/deleteProperty') diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/browser.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-properties.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-properties.js new file mode 100644 index 0000000000..9e3dd1d19a --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-properties.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Delete property. +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + ... + 4. Return target.[[Delete]](key). +features: [Reflect] +---*/ + +var o = { + prop: 42 +}; + +Reflect.deleteProperty(o, 'prop'); + +assert.sameValue(o.hasOwnProperty('prop'), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-symbol-properties.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-symbol-properties.js new file mode 100644 index 0000000000..a2c933074d --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/delete-symbol-properties.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Delete a symbol property. +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + ... + 2. Let key be ToPropertyKey(propertyKey). + ... + + 7.1.14 ToPropertyKey ( argument ) + + ... + 3. If Type(key) is Symbol, then + a. Return key. + ... +features: [Reflect, Symbol] +---*/ + +var s = Symbol('1'); +var o = {}; +o[s] = 42; + +Reflect.deleteProperty(o, s); + +assert.sameValue(o.hasOwnProperty(s), false); +assert.sameValue(o[s], undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/deleteProperty.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/deleteProperty.js new file mode 100644 index 0000000000..6f6a9fa1e4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/deleteProperty.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Reflect.deleteProperty is configurable, writable and not enumerable. +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +features: [Reflect] +---*/ + +verifyNotEnumerable(Reflect, 'deleteProperty'); +verifyWritable(Reflect, 'deleteProperty'); +verifyConfigurable(Reflect, 'deleteProperty'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/length.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/length.js new file mode 100644 index 0000000000..f340de07b5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/length.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Reflect.deleteProperty.length value and property descriptor +includes: [propertyHelper.js] +features: [Reflect] +---*/ + +assert.sameValue( + Reflect.deleteProperty.length, 2, + 'The value of `Reflect.deleteProperty.length` is `2`' +); + +verifyNotEnumerable(Reflect.deleteProperty, 'length'); +verifyNotWritable(Reflect.deleteProperty, 'length'); +verifyConfigurable(Reflect.deleteProperty, 'length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/name.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/name.js new file mode 100644 index 0000000000..8f6a2ead5b --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/name.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Reflect.deleteProperty.name value and property descriptor +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +features: [Reflect] +---*/ + +assert.sameValue( + Reflect.deleteProperty.name, 'deleteProperty', + 'The value of `Reflect.deleteProperty.name` is `"deleteProperty"`' +); + +verifyNotEnumerable(Reflect.deleteProperty, 'name'); +verifyNotWritable(Reflect.deleteProperty, 'name'); +verifyConfigurable(Reflect.deleteProperty, 'name'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/not-a-constructor.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/not-a-constructor.js new file mode 100644 index 0000000000..afbc5ae119 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/not-a-constructor.js @@ -0,0 +1,35 @@ +// 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: > + Reflect.deleteProperty 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, Reflect, arrow-function] +---*/ + +assert.sameValue( + isConstructor(Reflect.deleteProperty), + false, + 'isConstructor(Reflect.deleteProperty) must return false' +); + +assert.throws(TypeError, () => { + new Reflect.deleteProperty({}, ''); +}, '`new Reflect.deleteProperty({}, \'\')` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-property-key.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-property-key.js new file mode 100644 index 0000000000..538adf082b --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-property-key.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Return abrupt from ToPropertyKey(propertyKey) +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + ... + 2. Let key be ToPropertyKey(propertyKey). + 3. ReturnIfAbrupt(key). + ... +features: [Reflect] +---*/ + +var p = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + Reflect.deleteProperty({}, p); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-result.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-result.js new file mode 100644 index 0000000000..7a217bd3d9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-abrupt-from-result.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Return abrupt result from deleting a property. +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + ... + 6. Return target.[[DefineOwnProperty]](key, desc). + ... +features: [Proxy, Reflect] +---*/ + +var o = {}; +var p = new Proxy(o, { + deleteProperty: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + Reflect.deleteProperty(p, 'p1'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-boolean.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-boolean.js new file mode 100644 index 0000000000..88631bfdee --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/return-boolean.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Return boolean result. +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + ... + 4. Return target.[[Delete]](key). +features: [Reflect] +---*/ + +var o = {}; + +o.p1 = 'foo'; +assert.sameValue(Reflect.deleteProperty(o, 'p1'), true); +assert.sameValue(o.hasOwnProperty('p1'), false); + +o.p2 = 'foo'; +Object.freeze(o); +assert.sameValue(Reflect.deleteProperty(o, 'p2'), false); +assert.sameValue(o.hasOwnProperty('p2'), true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/shell.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/shell.js new file mode 100644 index 0000000000..eda1477282 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/shell.js @@ -0,0 +1,24 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-not-object-throws.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-not-object-throws.js new file mode 100644 index 0000000000..658422d575 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-not-object-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Throws a TypeError if target is not an Object. +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + 1. If Type(target) is not Object, throw a TypeError exception. + ... +features: [Reflect] +---*/ + +assert.throws(TypeError, function() { + Reflect.deleteProperty(1, 'p'); +}); + +assert.throws(TypeError, function() { + Reflect.deleteProperty(null, 'p'); +}); + +assert.throws(TypeError, function() { + Reflect.deleteProperty(undefined, 'p'); +}); + +assert.throws(TypeError, function() { + Reflect.deleteProperty('', 'p'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-symbol-throws.js b/js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-symbol-throws.js new file mode 100644 index 0000000000..987c39364f --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/deleteProperty/target-is-symbol-throws.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.4 +description: > + Throws a TypeError if target is a Symbol +info: | + 26.1.4 Reflect.deleteProperty ( target, propertyKey ) + + 1. If Type(target) is not Object, throw a TypeError exception. + ... +features: [Reflect, Symbol] +---*/ + +assert.throws(TypeError, function() { + Reflect.deleteProperty(Symbol(1), 'p'); +}); + +reportCompare(0, 0); -- cgit v1.2.3