| 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.5-4-14 |
| 6 |
description: > |
| 7 |
Object.create - argument 'Properties' is an Error object (15.2.3.7 |
| 8 |
step 2) |
| 9 |
---*/ |
| 10 |
|
| 11 |
var props = new Error("test"); |
| 12 |
var result = false; |
| 13 |
|
| 14 |
(Object.getOwnPropertyNames(props)).forEach(function(name) { |
| 15 |
props[name] = { |
| 16 |
value: 11, |
| 17 |
configurable: true |
| 18 |
} |
| 19 |
}); |
| 20 |
|
| 21 |
Object.defineProperty(props, "prop15_2_3_5_4_14", { |
| 22 |
get: function() { |
| 23 |
result = this instanceof Error; |
| 24 |
return {}; |
| 25 |
}, |
| 26 |
enumerable: true |
| 27 |
}); |
| 28 |
var newObj = Object.create({}, props); |
| 29 |
|
| 30 |
assert(result, 'result !== true'); |
| 31 |
assert(newObj.hasOwnProperty("prop15_2_3_5_4_14"), 'newObj.hasOwnProperty("prop15_2_3_5_4_14") !== true'); |