1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch12/12.10/S12.10_A3.3_T4.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +// Copyright 2009 the Sputnik authors. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * No matter how control leaves the embedded 'Statement', the scope chain is always restored to its former state 1.9 + * 1.10 + * @path ch12/12.10/S12.10_A3.3_T4.js 1.11 + * @description Declaring "with" statement within a function constructor, leading to completion by exception 1.12 + * @noStrict 1.13 + */ 1.14 + 1.15 +this.p1 = 1; 1.16 + 1.17 +var result = "result"; 1.18 + 1.19 +var myObj = { 1.20 + p1: 'a', 1.21 + value: 'myObj_value', 1.22 + valueOf : function(){return 'obj_valueOf';} 1.23 +}; 1.24 + 1.25 +function __FACTORY(){ 1.26 + with(myObj){ 1.27 + var p1 = 'x1'; 1.28 + throw value; 1.29 + } 1.30 +} 1.31 + 1.32 +try { 1.33 + var obj = new __FACTORY(); 1.34 +} catch(e){ 1.35 + result = p1; 1.36 +} 1.37 + 1.38 +////////////////////////////////////////////////////////////////////////////// 1.39 +//CHECK#1 1.40 +if (result !== 1) { 1.41 + $ERROR('#1: result === 1. Actual: result ==='+ result ); 1.42 +} 1.43 +// 1.44 +////////////////////////////////////////////////////////////////////////////// 1.45 + 1.46 +////////////////////////////////////////////////////////////////////////////// 1.47 +//CHECK#2 1.48 +if (p1 !== 1) { 1.49 + $ERROR('#2: p1 === 1. Actual: p1 ==='+ p1 ); 1.50 +} 1.51 +// 1.52 +////////////////////////////////////////////////////////////////////////////// 1.53 + 1.54 +////////////////////////////////////////////////////////////////////////////// 1.55 +//CHECK#3 1.56 +if (myObj.p1 !== "x1") { 1.57 + $ERROR('#3: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); 1.58 +} 1.59 +// 1.60 +////////////////////////////////////////////////////////////////////////////// 1.61 +