js/src/tests/test262/ch12/12.10/S12.10_A3.3_T4.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:d62436d12d95
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', the scope chain is always restored to its former state
6 *
7 * @path ch12/12.10/S12.10_A3.3_T4.js
8 * @description Declaring "with" statement within a function constructor, leading to completion by exception
9 * @noStrict
10 */
11
12 this.p1 = 1;
13
14 var result = "result";
15
16 var myObj = {
17 p1: 'a',
18 value: 'myObj_value',
19 valueOf : function(){return 'obj_valueOf';}
20 };
21
22 function __FACTORY(){
23 with(myObj){
24 var p1 = 'x1';
25 throw value;
26 }
27 }
28
29 try {
30 var obj = new __FACTORY();
31 } catch(e){
32 result = p1;
33 }
34
35 //////////////////////////////////////////////////////////////////////////////
36 //CHECK#1
37 if (result !== 1) {
38 $ERROR('#1: result === 1. Actual: result ==='+ result );
39 }
40 //
41 //////////////////////////////////////////////////////////////////////////////
42
43 //////////////////////////////////////////////////////////////////////////////
44 //CHECK#2
45 if (p1 !== 1) {
46 $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 );
47 }
48 //
49 //////////////////////////////////////////////////////////////////////////////
50
51 //////////////////////////////////////////////////////////////////////////////
52 //CHECK#3
53 if (myObj.p1 !== "x1") {
54 $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
55 }
56 //
57 //////////////////////////////////////////////////////////////////////////////
58

mercurial