Debian Codegraph @

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