tor-browser

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

S12.10_A3.1_T3.js (1492B)


      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.1_T3
      9 description: >
     10    Using "with" statement within global context, leading to
     11    completion by exception
     12 flags: [noStrict]
     13 ---*/
     14 
     15 this.p1 = 1;
     16 var result = "result";
     17 var myObj = {p1: 'a', 
     18             value: 'myObj_value',
     19             valueOf : function(){return 'obj_valueOf';}
     20 }
     21 
     22 try {
     23 
     24  with(myObj){
     25  
     26    throw value;
     27    p1 = 'x1'
     28  }
     29 } catch(e){
     30  result = p1;
     31 }
     32 
     33 //////////////////////////////////////////////////////////////////////////////
     34 //CHECK#1
     35 if(!(result === 1)){
     36  throw new Test262Error('#1: result === 1. Actual:  result ==='+ result  );
     37 }
     38 //
     39 //////////////////////////////////////////////////////////////////////////////
     40 
     41 //////////////////////////////////////////////////////////////////////////////
     42 //CHECK#2
     43 if(!(p1 === 1)){
     44  throw new Test262Error('#2: p1 === 1. Actual:  p1 ==='+ p1  );
     45 }
     46 //
     47 //////////////////////////////////////////////////////////////////////////////
     48 
     49 //////////////////////////////////////////////////////////////////////////////
     50 //CHECK#3
     51 if(!(myObj.p1 === "a")){
     52  throw new Test262Error('#3: myObj.p1 === "a". Actual:  myObj.p1 ==='+ myObj.p1  );
     53 }
     54 //
     55 //////////////////////////////////////////////////////////////////////////////
     56 
     57 reportCompare(0, 0);