blob: d14c0345575e26ad25ca561b3ee7fde3de98ac0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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);
|