Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperties/15.2.3.7-6-a-176.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-176
6 description: >
7 Object.defineProperties - 'O' is an Array, 'P' is the length
8 property of 'O', the [[Value]] field of 'desc' is less than value
9 of the length property, test the [[Writable]] attribute of the
10 length property is set to false at last when the [[Writable]]
11 field of 'desc' is false and 'O' contains non-configurable large
12 index named property (15.4.5.1 step 3.l.iii.2)
13 includes: [propertyHelper.js]
14 ---*/
15
16
17 var arr = [0, 1];
18
19 try {
20 Object.defineProperty(arr, "1", {
21 configurable: false
22 });
23
24 Object.defineProperties(arr, {
25 length: {
26 value: 1,
27 writable: false
28 }
29 });
30
31 $ERROR("Expected to throw TypeError");
32 } catch (e) {
33 assert(e instanceof TypeError);
34 assert(arr.hasOwnProperty("1"));
35 verifyNotWritable(arr, "length");
36 assert.sameValue(arr[0], 0);
37 assert.sameValue(arr[1], 1);
38 assert.sameValue(arr.length, 2)
39 }