js/src/tests/test262/ch12/12.10/S12.10_A3.6_T2.js

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:176d3571d977
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 * 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.6_T2.js
9 * @description Using "with" statement within another "with" statement, leading to completion by exception
10 * @noStrict
11 */
12
13 this.p1 = 1;
14
15 var result = "result";
16
17 var myObj = {
18 p1: 'a',
19 value: 'myObj_value',
20 valueOf : function(){return 'obj_valueOf';}
21 }
22
23 var theirObj = {
24 p1: true,
25 value: 'theirObj_value',
26 valueOf : function(){return 'thr_valueOf';}
27 }
28
29
30 try {
31 with(myObj){
32 with(theirObj){
33 p1 = 'x1';
34 throw value;
35 }
36 }
37 } catch(e){
38 result = p1;
39 }
40
41 //////////////////////////////////////////////////////////////////////////////
42 //CHECK#1
43 if(p1 !== 1){
44 $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 );
45 }
46 //
47 //////////////////////////////////////////////////////////////////////////////
48
49 //////////////////////////////////////////////////////////////////////////////
50 //CHECK#2
51 if(myObj.p1 !== "a"){
52 $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
53 }
54 //
55 //////////////////////////////////////////////////////////////////////////////
56
57 //////////////////////////////////////////////////////////////////////////////
58 //CHECK#3
59 if(theirObj.p1 !== "x1"){
60 $ERROR('#3: theirObj.p1 === "x1". Actual: theirObj.p1 ==='+ theirObj.p1 );
61 }
62 //
63 //////////////////////////////////////////////////////////////////////////////
64
65

mercurial