Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperty/15.2.3.6-4-297.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.6-4-297
6 description: >
7 Object.defineProperty - 'O' is an Arguments object, 'name' is own
8 accessor property of 'O', test TypeError is thrown when updating
9 the [[Get]] attribute value of 'name' which is defined as
10 non-configurable (10.6 [[DefineOwnProperty]] step 4)
11 includes: [propertyHelper.js]
12 ---*/
13
14 (function() {
15 function getFunc1() {
16 return 10;
17 }
18 Object.defineProperty(arguments, "0", {
19 get: getFunc1,
20 enumerable: false,
21 configurable: false
22 });
23
24 function getFunc2() {
25 return 20;
26 }
27 try {
28 Object.defineProperty(arguments, "0", {
29 get: getFunc2
30 });
31 throw new Test262Error("Expected an exception.");
32 } catch (e) {
33 verifyEqualTo(arguments, "0", getFunc1());
34
35 if (!(e instanceof TypeError)) {
36 throw new Test262Error("Expected TypeError, got " + e);
37 }
38 }
39
40 verifyProperty(arguments, "0", {
41 enumerable: false,
42 configurable: false,
43 });
44 }(0, 1, 2));
45
46 reportCompare(0, 0);