Debian Codegraph @

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