Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
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 * The with statement adds a computed object to the front of the
6 * scope chain of the current execution context
7 *
8 * @path ch12/12.10/S12.10_A1.10_T3.js
9 * @description Using iteration statment withing "with" statement leading to completion by exception
10 * iteration statement inside with statement - exception completion
11 * @noStrict
12 */
14 this.p1 = 1;
15 this.p2 = 2;
16 this.p3 = 3;
17 var result = "result";
18 var myObj = {p1: 'a',
19 p2: 'b',
20 p3: 'c',
21 value: 'myObj_value',
22 valueOf : function(){return 'obj_valueOf';},
23 parseInt : function(){return 'obj_parseInt';},
24 NaN : 'obj_NaN',
25 Infinity : 'obj_Infinity',
26 eval : function(){return 'obj_eval';},
27 parseFloat : function(){return 'obj_parseFloat';},
28 isNaN : function(){return 'obj_isNaN';},
29 isFinite : function(){return 'obj_isFinite';}
30 }
31 var del;
32 var st_p1 = "p1";
33 var st_p2 = "p2";
34 var st_p3 = "p3";
35 var st_parseInt = "parseInt";
36 var st_NaN = "NaN";
37 var st_Infinity = "Infinity";
38 var st_eval = "eval";
39 var st_parseFloat = "parseFloat";
40 var st_isNaN = "isNaN";
41 var st_isFinite = "isFinite";
43 try {
44 with(myObj){
45 do{
46 throw value;
47 st_p1 = p1;
48 st_p2 = p2;
49 st_p3 = p3;
50 st_parseInt = parseInt;
51 st_NaN = NaN;
52 st_Infinity = Infinity;
53 st_eval = eval;
54 st_parseFloat = parseFloat;
55 st_isNaN = isNaN;
56 st_isFinite = isFinite;
57 p1 = 'x1';
58 this.p2 = 'x2';
59 del = delete p3;
60 var p4 = 'x4';
61 p5 = 'x5';
62 var value = 'value';
63 }
64 while(false);
65 }
66 } catch(e){
67 result = e;
68 }
70 if(!(result === "myObj_value")){
71 $ERROR('#0: result === "myObj_value". Actual: result ==='+ result );
72 }
74 if(!(p1 === 1)){
75 $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 );
76 }
78 if(!(p2 === 2)){
79 $ERROR('#2: p2 === 2. Actual: p2 ==='+ p2 );
80 }
82 if(!(p3 === 3)){
83 $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 );
84 }
86 if(!(p4 === undefined)){
87 $ERROR('#4: p4 === undefined. Actual: p4 ==='+ p4 );
88 }
90 try {
91 p5;
92 $ERROR('#5: p5 is not defined');
93 } catch(e) {
94 }
96 if(!(myObj.p1 === "a")){
97 $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
98 }
100 if(!(myObj.p2 === "b")){
101 $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
102 }
104 if(!(myObj.p3 === "c")){
105 $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
106 }
108 if(!(myObj.p4 === undefined)){
109 $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
110 }
112 if(!(myObj.p5 === undefined)){
113 $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
114 }
116 if(!(st_parseInt === "parseInt")){
117 $ERROR('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt );
118 }
120 if(!(st_NaN === "NaN")){
121 $ERROR('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN );
122 }
124 if(!(st_Infinity === "Infinity")){
125 $ERROR('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity );
126 }
128 if(!(st_eval === "eval")){
129 $ERROR('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval );
130 }
132 if(!(st_parseFloat === "parseFloat")){
133 $ERROR('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat );
134 }
136 if(!(st_isNaN === "isNaN")){
137 $ERROR('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN );
138 }
140 if(!(st_isFinite === "isFinite")){
141 $ERROR('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite );
142 }
144 if(!(value === undefined)){
145 $ERROR('#18: value === undefined. Actual: value ==='+ value );
146 }
148 if(!(myObj.value === "myObj_value")){
149 $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
150 }