Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-306.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.7-6-a-306
6 description: >
7 Object.defineProperties - 'O' is an Arguments object, 'P' is
8 generic own data property of 'O', test TypeError is thrown when
9 updating the [[Value]] attribute value of 'P' which is not
10 writable and not configurable (10.6 [[DefineOwnProperty]] step 4)
11 includes: [propertyHelper.js]
12 ---*/
13
14 var arg = (function() {
15 return arguments;
16 }(1, 2, 3));
17
18 Object.defineProperty(arg, "genericProperty", {
19 value: 1001,
20 writable: false,
21 configurable: false
22 });
23
24 try {
25 Object.defineProperties(arg, {
26 "genericProperty": {
27 value: 1002
28 }
29 });
30
31 $ERROR("Expected an exception.");
32 } catch (e) {
33 verifyEqualTo(arg, "genericProperty", 1001);
34
35 verifyNotWritable(arg, "genericProperty");
36
37 verifyNotEnumerable(arg, "genericProperty");
38
39 verifyNotConfigurable(arg, "genericProperty");
40
41 if (!(e instanceof TypeError)) {
42 $ERROR("Expected TypeError, got " + e);
43 }
44
45 }