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

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:8747f6b2ee68
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.2_T5.js
9 * @description Declaring "with" statement within a function body, 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 try {
24 var f = function(){
25 with(myObj){
26 throw value;
27 p1 = 'x1';
28 }
29 };
30 f();
31 } catch(e){
32 result = p1;
33 }
34
35
36 //////////////////////////////////////////////////////////////////////////////
37 //CHECK#1
38 if(result !== 1){
39 $ERROR('#1: result === 1. Actual: result ==='+ result );
40 }
41 //
42 //////////////////////////////////////////////////////////////////////////////
43
44 //////////////////////////////////////////////////////////////////////////////
45 //CHECK#2
46 if(p1 !== 1){
47 $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 );
48 }
49 //
50 //////////////////////////////////////////////////////////////////////////////
51
52 //////////////////////////////////////////////////////////////////////////////
53 //CHECK#3
54 if(myObj.p1 !== "a"){
55 $ERROR('#3: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
56 }
57 //
58 //////////////////////////////////////////////////////////////////////////////
59
60
61
62
63

mercurial