From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../properties-arg-to-object-non-empty-string.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js (limited to 'js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js') diff --git a/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js new file mode 100644 index 0000000000..d14c034557 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/create/properties-arg-to-object-non-empty-string.js @@ -0,0 +1,37 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.create +description: > + Throws a TypeError if the Properties argument is a non-empty string +info: | + Object.create ( O, Properties ) + + 3. If Properties is not undefined, then + a. Return ? ObjectDefineProperties(obj, Properties). + + Runtime Semantics: ObjectDefineProperties ( O, Properties ) + + 2. Let props be ? ToObject(Properties). + 3. Let keys be ? props.[[OwnPropertyKeys]](). + 4. Let descriptors be a new empty List. + 5. For each element nextKey of keys in List order, do + a. Let propDesc be ? props.[[GetOwnProperty]](nextKey). + b. If propDesc is not undefined and propDesc.[[Enumerable]] is true, then + i. Let descObj be ? Get(props, nextKey). + ii. Let desc be ? ToPropertyDescriptor(descObj). + + ToPropertyDescriptor ( Obj ) + + 1. If Type(Obj) is not Object, throw a TypeError exception. +---*/ + +// The first nextKey is 'h' and its OwnProperty in the String object is enumerable +// Get(props, nextKey) is an equivalent of Object('hello')[nextKey] +// The first descObj will be 'h', so it will throw in ToPropertyDescriptor +assert.throws(TypeError, function() { + Object.create({}, 'hello'); +}); + +reportCompare(0, 0); -- cgit v1.2.3