blob: 7f7529087d8c837d73fcabe12550a5ccfaa992e5 [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.1_T1
9description: Using "with" statement within global context - normal completion
10flags: [noStrict]
11---*/
12
13this.p1 = 1;
14
15var result = "result";
16
17var myObj = {
18 p1: 'a',
19 value: 'myObj_value',
20 valueOf : function(){return 'obj_valueOf';}
21}
22
23
24with(myObj){
25 p1 = 'x1';
26}
27
28//////////////////////////////////////////////////////////////////////////////
29//CHECK#1
30if(p1 !== 1){
31 $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 );
32}
33//
34//////////////////////////////////////////////////////////////////////////////
35
36//////////////////////////////////////////////////////////////////////////////
37//CHECK#2
38if(myObj.p1 !== "x1"){
39 $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
40}
41//
42//////////////////////////////////////////////////////////////////////////////