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