blob: 533d1a79423e3ce3bc2438fce4d2b88a5ec518f8 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// Copyright 2009 the Sputnik authors. All rights reserved.
2// This code is governed by the BSD license found in the LICENSE file.
3
4/*---
5info: >
6 No matter how control leaves the embedded 'Statement',
7 the scope chain is always restored to its former state
8es5id: 12.10_A3.10_T2
9description: >
10 Using iteration statement within "with" statement, leading
11 completion by exception
12flags: [noStrict]
13---*/
14
15this.p1 = 1;
16
17var result = "result";
18
19var myObj = {
20 p1: 'a',
21 value: 'myObj_value',
22 valueOf : function(){return 'obj_valueOf';}
23}
24
25try {
26 with(myObj){
27 do{
28 p1 = 'x1';
29 throw value;
30 } while(false);
31 }
32} catch(e){
33 result = p1;
34}
35
36//////////////////////////////////////////////////////////////////////////////
37//CHECK#1
38if(result !== 1){
39 $ERROR('#1: result === 1. Actual: result ==='+ result );
40}
41//
42//////////////////////////////////////////////////////////////////////////////
43
44//////////////////////////////////////////////////////////////////////////////
45//CHECK#2
46if(p1 !== 1){
47 $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 );
48}
49//
50//////////////////////////////////////////////////////////////////////////////
51
52//////////////////////////////////////////////////////////////////////////////
53//CHECK#3
54if(myObj.p1 !== "x1"){
55 $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
56}
57//
58//////////////////////////////////////////////////////////////////////////////