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