Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperties/15.2.3.7-6-a-85.js

raw
1 // Copyright (c) 2012 Ecma International. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es5id: 15.2.3.7-6-a-85
6 description: >
7 Object.defineProperties throws TypeError when P.configurable is
8 false, P.writalbe is false, properties.value and P.value are two
9 objects with different values (8.12.9 step 10.a.ii.1)
10 includes: [propertyHelper.js]
11 ---*/
12
13
14 var obj = {};
15
16 var obj1 = {
17 length: 10
18 };
19
20 Object.defineProperty(obj, "foo", {
21 value: obj1,
22 writable: false,
23 configurable: false
24 });
25
26 var obj2 = {
27 length: 20
28 };
29
30 try {
31 Object.defineProperties(obj, {
32 foo: {
33 value: obj2
34 }
35 });
36 throw new Test262Error("Expected an exception.");
37 } catch (e) {
38 if (!(e instanceof TypeError)) {
39 throw new Test262Error("Expected TypeError, got " + e);
40 }
41 }
42
43 verifyProperty(obj, "foo", {
44 value: obj1,
45 writable: false,
46 enumerable: false,
47 configurable: false,
48 });
49
50 reportCompare(0, 0);