| 1 |
// Copyright (C) 2016 Jordan Harband. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: > |
| 6 |
Object.getOwnPropertyDescriptors should not have its behavior impacted by modifications to Object.getOwnPropertyDescriptor |
| 7 |
esid: sec-object.getownpropertydescriptors |
| 8 |
author: Jordan Harband |
| 9 |
---*/ |
| 10 |
|
| 11 |
function fakeObjectGetOwnPropertyDescriptor() { |
| 12 |
$ERROR('The overriden version of Object.getOwnPropertyDescriptor was called!'); |
| 13 |
} |
| 14 |
Object.getOwnPropertyDescriptor = fakeObjectGetOwnPropertyDescriptor; |
| 15 |
|
| 16 |
assert.sameValue( |
| 17 |
Object.getOwnPropertyDescriptor, |
| 18 |
fakeObjectGetOwnPropertyDescriptor, |
| 19 |
'Sanity check failed: could not modify the global Object.getOwnPropertyDescriptor' |
| 20 |
); |
| 21 |
|
| 22 |
assert.sameValue(Object.keys(Object.getOwnPropertyDescriptors({ |
| 23 |
a: 1 |
| 24 |
})).length, 1, 'Expected object with 1 key to have 1 descriptor'); |