Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-192.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-192
6 description: >
7 Object.defineProperty - 'O' is an Array, 'name' is an array index
8 named property, 'name' is own data property that overrides an
9 inherited data property, test TypeError is thrown on updating the
10 [[Configurable]] attribute from false to true (15.4.5.1 step 4.c)
11 ---*/
12
13 var arrObj = [];
14
15 assert.throws(TypeError, function() {
16 Object.defineProperty(Array.prototype, "0", {
17 value: 11,
18 configurable: true
19 });
20
21 Object.defineProperty(arrObj, "0", {
22 value: 12,
23 configurable: false
24 });
25
26 Object.defineProperty(arrObj, "0", {
27 configurable: true
28 });
29 });
30 assert.sameValue(Array.prototype[0], 11, 'Array.prototype[0]');
31 assert.sameValue(arrObj[0], 12, 'arrObj[0]');