tamper-with-global-object.js (734B)
1 // Copyright (C) 2015 Jordan Harband. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-object.entries 6 description: > 7 Object.entries should not have its behavior impacted by modifications to the global property Object 8 author: Jordan Harband 9 ---*/ 10 11 function fakeObject() { 12 throw new Test262Error('The overriden version of Object was called!'); 13 } 14 fakeObject.entries = Object.entries; 15 16 var global = Function('return this;')(); 17 global.Object = fakeObject; 18 19 assert.sameValue(Object, fakeObject, 'Sanity check failed: could not modify the global Object'); 20 assert.sameValue(Object.entries(1).length, 0, 'Expected number primitive to have zero entries'); 21 22 reportCompare(0, 0);