| 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-360 |
| 6 |
description: > |
| 7 |
ES5 Attributes - success to update the data property ([[Writable]] |
| 8 |
is false, [[Enumerable]] is true, [[Configurable]] is true) to an |
| 9 |
accessor property |
| 10 |
---*/ |
| 11 |
|
| 12 |
var obj = {}; |
| 13 |
|
| 14 |
Object.defineProperty(obj, "prop", { |
| 15 |
value: 2010, |
| 16 |
writable: false, |
| 17 |
enumerable: true, |
| 18 |
configurable: true |
| 19 |
}); |
| 20 |
var desc1 = Object.getOwnPropertyDescriptor(obj, "prop"); |
| 21 |
|
| 22 |
function getFunc() { |
| 23 |
return 20; |
| 24 |
} |
| 25 |
Object.defineProperty(obj, "prop", { |
| 26 |
get: getFunc |
| 27 |
}); |
| 28 |
var desc2 = Object.getOwnPropertyDescriptor(obj, "prop"); |
| 29 |
|
| 30 |
assert(desc1.hasOwnProperty("value"), 'desc1.hasOwnProperty("value") !== true'); |
| 31 |
assert(desc2.hasOwnProperty("get"), 'desc2.hasOwnProperty("get") !== true'); |