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