Debian Codegraph @

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