tor-browser

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

S10.2.2_A1_T8.js (675B)


      1 // Copyright 2009 the Sputnik authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    Every execution context has associated with it a scope chain.
      7    A scope chain is a list of objects that are searched when evaluating an
      8    Identifier
      9 es5id: 10.2.2_A1_T8
     10 description: Checking scope chain containing function declarations and "with"
     11 flags: [noStrict]
     12 ---*/
     13 
     14 var x = 0;
     15 
     16 var myObj = {x : "obj"};
     17 
     18 function f1(){
     19  function f2(){
     20    with(myObj){
     21      return x;
     22    }
     23  };
     24 
     25  var x = 1;
     26  return f2();
     27 }
     28 
     29 if(!(f1() === "obj")){
     30  throw new Test262Error("#1: Scope chain disturbed");
     31 }
     32 
     33 reportCompare(0, 0);