tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

tamper-with-global-object.js (728B)


      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.values
      6 description: >
      7    Object.values 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.values = Object.values;
     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.values(1).length, 0, 'Expected number primitive to have zero values');
     21 
     22 reportCompare(0, 0);