| 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.7-6-a-286 |
| 6 |
description: > |
| 7 |
Object.defineProperties - 'O' is an Arguments object, 'P' is own |
| 8 |
accessor property of 'O' which is also defined in [[ParameterMap]] |
| 9 |
of 'O', test TypeError is thrown when updating the [[Get]] |
| 10 |
attribute value of 'P' which is defined as non-configurable (10.6 |
| 11 |
[[DefineOwnProperty]] step 4) |
| 12 |
---*/ |
| 13 |
|
| 14 |
var arg; |
| 15 |
|
| 16 |
(function fun(a, b, c) { |
| 17 |
arg = arguments; |
| 18 |
}(0, 1, 2)); |
| 19 |
|
| 20 |
function get_func1() { |
| 21 |
return 0; |
| 22 |
} |
| 23 |
|
| 24 |
Object.defineProperty(arg, "0", { |
| 25 |
get: get_func1, |
| 26 |
enumerable: false, |
| 27 |
configurable: false |
| 28 |
}); |
| 29 |
|
| 30 |
function get_func2() { |
| 31 |
return 10; |
| 32 |
} |
| 33 |
assert.throws(TypeError, function() { |
| 34 |
Object.defineProperties(arg, { |
| 35 |
"0": { |
| 36 |
get: get_func2 |
| 37 |
} |
| 38 |
}); |
| 39 |
}); |
| 40 |
var desc = Object.getOwnPropertyDescriptor(arg, "0"); |
| 41 |
assert.sameValue(desc.get, get_func1, 'desc.get'); |
| 42 |
assert.sameValue(typeof desc.set, "undefined", 'typeof desc.set'); |
| 43 |
assert.sameValue(desc.enumerable, false, 'desc.enumerable'); |
| 44 |
assert.sameValue(desc.configurable, false, 'desc.configurable'); |