tor-browser

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

S12.10_A3.6_T1.js (1583B)


      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    No matter how control leaves the embedded 'Statement',
      7    the scope chain is always restored to its former state
      8 es5id: 12.10_A3.6_T1
      9 description: >
     10    Using "with" statement within another "with" statement, leading to
     11    normal completion
     12 flags: [noStrict]
     13 ---*/
     14 
     15 this.p1 = 1;
     16 
     17 var result = "result";
     18 
     19 var myObj = {
     20    p1: 'a', 
     21    value: 'myObj_value',
     22    valueOf : function(){return 'obj_valueOf';}
     23 }
     24 
     25 var theirObj = {
     26    p1: true, 
     27    value: 'theirObj_value',
     28    valueOf : function(){return 'thr_valueOf';}
     29 }
     30 
     31 with(myObj){
     32    with(theirObj){
     33        p1 = 'x1';
     34  }
     35 }
     36 
     37 //////////////////////////////////////////////////////////////////////////////
     38 //CHECK#1
     39 if(p1 !== 1){
     40  throw new Test262Error('#1: p1 === 1. Actual:  p1 ==='+ p1  );
     41 }
     42 //
     43 //////////////////////////////////////////////////////////////////////////////
     44 
     45 //////////////////////////////////////////////////////////////////////////////
     46 //CHECK#2
     47 if(myObj.p1 !== "a"){
     48  throw new Test262Error('#2: myObj.p1 === "a". Actual:  myObj.p1 ==='+ myObj.p1  );
     49 }
     50 //
     51 //////////////////////////////////////////////////////////////////////////////
     52 
     53 //////////////////////////////////////////////////////////////////////////////
     54 //CHECK#3
     55 if(theirObj.p1 !== "x1"){
     56  throw new Test262Error('#3: theirObj.p1 === "x1". Actual:  theirObj.p1 ==='+ theirObj.p1  );
     57 }
     58 //
     59 //////////////////////////////////////////////////////////////////////////////
     60 
     61 reportCompare(0, 0);