Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
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.2_T4.js
9 * @description Declaring "with" statement within a function body, 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 var f = function(){
25 with(myObj){
26 p1 = 'x1';
27 throw value;
28 }
29 };
31 f();
32 } catch(e){
33 result = p1;
34 }
37 //////////////////////////////////////////////////////////////////////////////
38 //CHECK#1
39 if(result !== 1){
40 $ERROR('#1: result === 1. Actual: result ==='+ result );
41 }
42 //
43 //////////////////////////////////////////////////////////////////////////////
45 //////////////////////////////////////////////////////////////////////////////
46 //CHECK#2
47 if(p1 !== 1){
48 $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 );
49 }
50 //
51 //////////////////////////////////////////////////////////////////////////////
53 //////////////////////////////////////////////////////////////////////////////
54 //CHECK#3
55 if(myObj.p1 !== "x1"){
56 $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
57 }
58 //
59 //////////////////////////////////////////////////////////////////////////////