Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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.9_T1.js
9 * @description Using "for-in" statement within "with" statement, leading to normal completion
10 * @noStrict
11 */
13 this.p1 = 1;
14 this.p2 = 2;
15 this.p3 = 3;
16 var result = "result";
17 var myObj = {p1: 'a',
18 p2: 'b',
19 p3: 'c',
20 value: 'myObj_value',
21 valueOf : function(){return 'obj_valueOf';},
22 parseInt : function(){return 'obj_parseInt';},
23 NaN : 'obj_NaN',
24 Infinity : 'obj_Infinity',
25 eval : function(){return 'obj_eval';},
26 parseFloat : function(){return 'obj_parseFloat';},
27 isNaN : function(){return 'obj_isNaN';},
28 isFinite : function(){return 'obj_isFinite';}
29 }
30 var del;
31 var st_p1 = "p1";
32 var st_p2 = "p2";
33 var st_p3 = "p3";
34 var st_parseInt = "parseInt";
35 var st_NaN = "NaN";
36 var st_Infinity = "Infinity";
37 var st_eval = "eval";
38 var st_parseFloat = "parseFloat";
39 var st_isNaN = "isNaN";
40 var st_isFinite = "isFinite";
42 with(myObj){
43 for(var prop in myObj){
44 if(prop === 'p1') {
45 st_p1 = p1;
46 p1 = 'x1';
47 }
48 if(prop === 'p2') {
49 st_p2 = p2;
50 this.p2 = 'x2';
51 }
52 if(prop === 'p3') {
53 st_p3 = p3;
54 del = delete p3;
55 }
56 if(prop === 'parseInt') st_parseInt = parseInt;
57 if(prop === 'NaN') st_NaN = NaN;
58 if(prop === 'Infinity') st_Infinity = Infinity;
59 if(prop === 'eval') st_eval = eval;
60 if(prop === 'parseFloat') st_parseFloat = parseFloat;
61 if(prop === 'isNaN') st_isNaN = isNaN;
62 if(prop === 'isFinite') st_isFinite = isFinite;
63 var p4 = 'x4';
64 p5 = 'x5';
65 var value = 'value';
66 }
67 }
69 if(!(p1 === 1)){
70 $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 );
71 }
73 if(!(p2 === "x2")){
74 $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 );
75 }
77 if(!(p3 === 3)){
78 $ERROR('#3: p3 === 3. Actual: p3 ==='+ p3 );
79 }
81 if(!(p4 === "x4")){
82 $ERROR('#4: p4 === "x4". Actual: p4 ==='+ p4 );
83 }
85 if(!(p5 === "x5")){
86 $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 );
87 }
89 if(!(myObj.p1 === "x1")){
90 $ERROR('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 );
91 }
93 if(!(myObj.p2 === "b")){
94 $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
95 }
97 if(!(myObj.p3 === undefined)){
98 $ERROR('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 );
99 }
101 if(!(myObj.p4 === undefined)){
102 $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
103 }
105 if(!(myObj.p5 === undefined)){
106 $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
107 }
109 if(!(st_parseInt !== parseInt)){
110 $ERROR('#11: myObj.parseInt !== parseInt');
111 }
113 if(!(st_NaN === "obj_NaN")){
114 $ERROR('#12: myObj.NaN !== NaN');
115 }
117 if(!(st_Infinity !== Infinity)){
118 $ERROR('#13: myObj.Infinity !== Infinity');
119 }
121 if(!(st_eval !== eval)){
122 $ERROR('#14: myObj.eval !== eval');
123 }
125 if(!(st_parseFloat !== parseFloat)){
126 $ERROR('#15: myObj.parseFloat !== parseFloat');
127 }
129 if(!(st_isNaN !== isNaN)){
130 $ERROR('#16: myObj.isNaN !== isNaN');
131 }
133 if(!(st_isFinite !== isFinite)){
134 $ERROR('#17: myObj.isFinite !== isFinite');
135 }
137 if(!(value === undefined)){
138 $ERROR('#18: value === undefined. Actual: value ==='+ value );
139 }
141 if(!(myObj.value === "value")){
142 $ERROR('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value );
143 }