| 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 the global property Object |
| 7 |
esid: sec-object.getownpropertydescriptors |
| 8 |
author: Jordan Harband |
| 9 |
---*/ |
| 10 |
|
| 11 |
function fakeObject() { |
| 12 |
$ERROR('The overriden version of Object was called!'); |
| 13 |
} |
| 14 |
fakeObject.getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors; |
| 15 |
fakeObject.keys = Object.keys; |
| 16 |
|
| 17 |
var global = this; |
| 18 |
global.Object = fakeObject; |
| 19 |
|
| 20 |
assert.sameValue(Object, fakeObject, 'Sanity check failed: could not modify the global Object'); |
| 21 |
assert.sameValue(Object.keys(Object.getOwnPropertyDescriptors('a')).length, 2, 'Expected string primitive to have 2 descriptors'); |