Debian Codegraph @

js/src/tests/test262/built-ins/Object/defineProperty/15.2.3.6-4-310.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-310
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 [[Set]] attribute value of 'name' which is not configurable
11 (10.6 [[DefineOwnProperty]] step 4)
12 includes: [propertyHelper.js]
13 ---*/
14
15 (function() {
16 function getFunc() {
17 return 0;
18 }
19 Object.defineProperty(arguments, "0", {
20 get: getFunc,
21 set: undefined,
22 enumerable: false,
23 configurable: false
24 });
25
26 function setFunc(value) {
27 this.setVerifyHelpProp = value;
28 }
29 try {
30 Object.defineProperty(arguments, "0", {
31 set: setFunc
32 });
33 throw new Test262Error("Expected an exception.");
34 } catch (e) {
35 verifyEqualTo(arguments, "0", getFunc());
36
37 if (!(e instanceof TypeError)) {
38 throw new Test262Error("Expected TypeError, got " + e);
39 }
40 }
41
42 verifyProperty(arguments, "0", {
43 enumerable: false,
44 configurable: false,
45 });
46 }());
47
48 reportCompare(0, 0);