| 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-321 |
| 6 |
description: > |
| 7 |
Object.defineProperty - 'O' is an Arguments object, 'P' is own |
| 8 |
accessor property of 'O', test TypeError is thrown when updating |
| 9 |
the [[Get]] attribute value of 'P' which is not configurable (10.6 |
| 10 |
[[DefineOwnProperty]] step 4) |
| 11 |
includes: [propertyHelper.js] |
| 12 |
---*/ |
| 13 |
|
| 14 |
(function() { |
| 15 |
function getFunc() { |
| 16 |
return "genericPropertyString"; |
| 17 |
} |
| 18 |
|
| 19 |
function setFunc(value) { |
| 20 |
this.helpVerifyGet = value; |
| 21 |
} |
| 22 |
Object.defineProperty(arguments, "genericProperty", { |
| 23 |
get: getFunc, |
| 24 |
set: setFunc, |
| 25 |
configurable: false |
| 26 |
}); |
| 27 |
try { |
| 28 |
Object.defineProperty(arguments, "genericProperty", { |
| 29 |
get: function() { |
| 30 |
return "overideGenericPropertyString"; |
| 31 |
} |
| 32 |
}); |
| 33 |
$ERROR("Expected an exception."); |
| 34 |
} catch (e) { |
| 35 |
verifyEqualTo(arguments, "genericProperty", getFunc()); |
| 36 |
|
| 37 |
verifyWritable(arguments, "genericProperty", "helpVerifyGet"); |
| 38 |
|
| 39 |
verifyNotEnumerable(arguments, "genericProperty"); |
| 40 |
|
| 41 |
verifyNotConfigurable(arguments, "genericProperty"); |
| 42 |
|
| 43 |
if (!(e instanceof TypeError)) { |
| 44 |
$ERROR("Expected TypeError, got " + e); |
| 45 |
} |
| 46 |
|
| 47 |
} |
| 48 |
}(1, 2, 3)); |