tor-browser

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

eval-realm-indirect.js (754B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 esid: sec-function-calls-runtime-semantics-evaluation
      5 es6id: 12.3.4.1
      6 description: >
      7    An eval function from another realm is not a candidate for direct eval
      8 info: |
      9    [...]
     10    3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then
     11       a. If SameValue(func, %eval%) is true, then
     12          [...]
     13 flags: [noStrict]
     14 features: [cross-realm]
     15 ---*/
     16 
     17 var x = 'outside';
     18 var result;
     19 
     20 (function() {
     21  var eval = $262.createRealm().global.eval;
     22 
     23  eval('var x = "inside";');
     24 
     25  result = x;
     26 }());
     27 
     28 assert.sameValue(result, 'outside');
     29 
     30 reportCompare(0, 0);