js/src/tests/test262/ch12/12.10/S12.10_A3.8_T5.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Copyright 2009 the Sputnik authors.  All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * No matter how control leaves the embedded 'Statement',
     6  * the scope chain is always restored to its former state
     7  *
     8  * @path ch12/12.10/S12.10_A3.8_T5.js
     9  * @description Declaring function constructor within "with" statement, leading to completion by exception
    10  * @noStrict
    11  */
    13 this.p1 = 1;
    15 var result = "result";
    17 var myObj = {
    18     p1: 'a', 
    19     value: 'myObj_value',
    20     valueOf : function(){return 'obj_valueOf';}
    21 }
    23 try {
    24     with(myObj){
    25         var __FACTORY = function(){
    26             throw value;
    27             p1 = 'x1';
    28         }
    29         var obj = new __FACTORY;
    30     }
    31 } catch(e){
    32     result = p1;
    33 }
    35 //////////////////////////////////////////////////////////////////////////////
    36 //CHECK#1
    37 if(result !== 1){
    38   $ERROR('#1: result === 1. Actual:  result ==='+ result  );
    39 }
    40 //
    41 //////////////////////////////////////////////////////////////////////////////
    43 //////////////////////////////////////////////////////////////////////////////
    44 //CHECK#2
    45 if(p1 !== 1){
    46   $ERROR('#2: p1 === 1. Actual:  p1 ==='+ p1  );
    47 }
    48 //
    49 //////////////////////////////////////////////////////////////////////////////
    51 //////////////////////////////////////////////////////////////////////////////
    52 //CHECK#3
    53 if(myObj.p1 !== "a"){
    54   $ERROR('#3: myObj.p1 === "a". Actual:  myObj.p1 ==='+ myObj.p1  );
    55 }
    56 //
    57 //////////////////////////////////////////////////////////////////////////////

mercurial