harmony 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +0 -104
- data/README.md +7 -1
- data/harmony.gemspec +2 -1
- data/lib/harmony.rb +1 -1
- data/lib/harmony/page.rb +8 -7
- data/test/page_test.rb +28 -0
- metadata +13 -107
- data/vendor/README +0 -1
- data/vendor/envjs/README +0 -36
- data/vendor/envjs/bin/envjsrb +0 -255
- data/vendor/envjs/bin/jquery-1.2.6-test.js +0 -33
- data/vendor/envjs/bin/jquery-1.3.1-test.js +0 -33
- data/vendor/envjs/bin/jquery-1.3.2-test.js +0 -106
- data/vendor/envjs/bin/prototype-1.6.0.3-test.js +0 -82
- data/vendor/envjs/bin/prototype_1.6.0.3_tmpl.txt +0 -27
- data/vendor/envjs/bin/test-jquery.sh +0 -58
- data/vendor/envjs/bin/test-prototype.sh +0 -54
- data/vendor/envjs/bin/tidy +0 -0
- data/vendor/envjs/lib/envjs.rb +0 -23
- data/vendor/envjs/lib/envjs/env.js +0 -21665
- data/vendor/envjs/lib/envjs/net.rb +0 -3
- data/vendor/envjs/lib/envjs/net/cgi.rb +0 -94
- data/vendor/envjs/lib/envjs/net/file.rb +0 -75
- data/vendor/envjs/lib/envjs/options.rb +0 -11
- data/vendor/envjs/lib/envjs/runtime.rb +0 -351
- data/vendor/envjs/lib/envjs/tempfile.rb +0 -24
- data/vendor/envjs/test/base64.js +0 -80
- data/vendor/envjs/test/call-load-test.js +0 -15
- data/vendor/envjs/test/data.js +0 -45
- data/vendor/envjs/test/debug.js +0 -53
- data/vendor/envjs/test/firebug/errorIcon.png +0 -0
- data/vendor/envjs/test/firebug/firebug.css +0 -209
- data/vendor/envjs/test/firebug/firebug.html +0 -23
- data/vendor/envjs/test/firebug/firebug.js +0 -672
- data/vendor/envjs/test/firebug/firebugx.js +0 -10
- data/vendor/envjs/test/firebug/infoIcon.png +0 -0
- data/vendor/envjs/test/firebug/warningIcon.png +0 -0
- data/vendor/envjs/test/fixtures/html/events.html +0 -171
- data/vendor/envjs/test/fixtures/html/iframe1.html +0 -46
- data/vendor/envjs/test/fixtures/html/iframe1a.html +0 -46
- data/vendor/envjs/test/fixtures/html/iframe2.html +0 -45
- data/vendor/envjs/test/fixtures/html/iframe3.html +0 -28
- data/vendor/envjs/test/fixtures/html/iframeN.html +0 -57
- data/vendor/envjs/test/fixtures/html/malformed.html +0 -181
- data/vendor/envjs/test/fixtures/html/scope.html +0 -81
- data/vendor/envjs/test/fixtures/html/trivial.html +0 -19
- data/vendor/envjs/test/fixtures/html/with_js.html +0 -26
- data/vendor/envjs/test/fixtures/images/icon-blue.png +0 -0
- data/vendor/envjs/test/fixtures/js/external_script.js +0 -1
- data/vendor/envjs/test/fixtures/js/script.js +0 -1
- data/vendor/envjs/test/fixtures/js/script_error.js +0 -2
- data/vendor/envjs/test/html/events.html +0 -171
- data/vendor/envjs/test/html/iframe1.html +0 -46
- data/vendor/envjs/test/html/iframe1a.html +0 -46
- data/vendor/envjs/test/html/iframe2.html +0 -45
- data/vendor/envjs/test/html/iframe3.html +0 -30
- data/vendor/envjs/test/html/iframeN.html +0 -57
- data/vendor/envjs/test/html/malformed.html +0 -181
- data/vendor/envjs/test/html/scope.html +0 -87
- data/vendor/envjs/test/html/script.js +0 -1
- data/vendor/envjs/test/html/trivial.html +0 -19
- data/vendor/envjs/test/html/with_js.html +0 -26
- data/vendor/envjs/test/index.html +0 -328
- data/vendor/envjs/test/java-prototype.js +0 -9
- data/vendor/envjs/test/primary-tests.js +0 -24
- data/vendor/envjs/test/prototype-test.js +0 -13
- data/vendor/envjs/test/qunit.js +0 -61
- data/vendor/envjs/test/qunit/qunit/qunit.css +0 -17
- data/vendor/envjs/test/qunit/qunit/qunit.js +0 -997
- data/vendor/envjs/test/scope.rb +0 -25
- data/vendor/envjs/test/specs/dist/env.spec.js +0 -1534
- data/vendor/envjs/test/specs/envjs.spec.css +0 -46
- data/vendor/envjs/test/specs/parser/html.js +0 -31
- data/vendor/envjs/test/specs/parser/spec.html +0 -40
- data/vendor/envjs/test/specs/parser/xml.js +0 -31
- data/vendor/envjs/test/specs/qunit.bdd.js +0 -210
- data/vendor/envjs/test/specs/qunit.css +0 -17
- data/vendor/envjs/test/specs/qunit.js +0 -997
- data/vendor/envjs/test/specs/template/spec-0.js +0 -31
- data/vendor/envjs/test/specs/template/spec-1.js +0 -31
- data/vendor/envjs/test/specs/template/spec.html +0 -40
- data/vendor/envjs/test/specs/window/css.js +0 -23
- data/vendor/envjs/test/specs/window/dialog.js +0 -25
- data/vendor/envjs/test/specs/window/document.js +0 -23
- data/vendor/envjs/test/specs/window/event.js +0 -25
- data/vendor/envjs/test/specs/window/history.js +0 -34
- data/vendor/envjs/test/specs/window/location.js +0 -34
- data/vendor/envjs/test/specs/window/navigator.js +0 -71
- data/vendor/envjs/test/specs/window/screen.js +0 -42
- data/vendor/envjs/test/specs/window/spec.html +0 -48
- data/vendor/envjs/test/specs/window/timer.js +0 -26
- data/vendor/envjs/test/specs/window/window.js +0 -53
- data/vendor/envjs/test/specs/xhr/spec.html +0 -47
- data/vendor/envjs/test/specs/xhr/xhr.js +0 -31
- data/vendor/envjs/test/test.js +0 -10
- data/vendor/envjs/test/unit/dom.js +0 -44
- data/vendor/envjs/test/unit/elementmembers.js +0 -60
- data/vendor/envjs/test/unit/events.js +0 -195
- data/vendor/envjs/test/unit/fixtures/external_script.js +0 -1
- data/vendor/envjs/test/unit/iframe.js +0 -234
- data/vendor/envjs/test/unit/multi-window.js +0 -212
- data/vendor/envjs/test/unit/nu.validator.js +0 -34
- data/vendor/envjs/test/unit/onload.js +0 -90
- data/vendor/envjs/test/unit/parser.js +0 -121
- data/vendor/envjs/test/unit/prototypecompat.js +0 -22
- data/vendor/envjs/test/unit/proxy.js +0 -6
- data/vendor/envjs/test/unit/scope.js +0 -209
- data/vendor/envjs/test/unit/timer.js +0 -115
- data/vendor/envjs/test/unit/window.js +0 -41
- data/vendor/envjs/test/vendor/jQuery/README +0 -2
- data/vendor/envjs/test/vendor/prototype-1.6.0.3.js +0 -4320
@@ -1 +0,0 @@
|
|
1
|
-
var $$$$$ = "12345";
|
@@ -1,234 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This file is a component of env.js,
|
3
|
-
* http://github.com/gleneivey/env-js/commits/master/README
|
4
|
-
* a Pure JavaScript Browser Environment
|
5
|
-
* Copyright 2009 John Resig, licensed under the MIT License
|
6
|
-
* http://www.opensource.org/licenses/mit-license.php
|
7
|
-
*/
|
8
|
-
|
9
|
-
|
10
|
-
module("iframe");
|
11
|
-
|
12
|
-
|
13
|
-
// In general, the tests here use the files ../html/iframe*.html
|
14
|
-
// I've tried to keep all of the id attributes and text fragments in these
|
15
|
-
// files unique from each other and from the content of index.html
|
16
|
-
// to ensure that we can correctly identify which file has loaded into
|
17
|
-
// which frame/window. When making modifications/additions, paying
|
18
|
-
// attention to uniqueness is recommended.
|
19
|
-
|
20
|
-
|
21
|
-
// all tests to next comment rely on content of ../html/iframe1.html and
|
22
|
-
// ../html/iframe1a.html
|
23
|
-
|
24
|
-
// iframe1 and iframe1a are identical in structure (so we can use the
|
25
|
-
// same assertions against both), but different in content text (so
|
26
|
-
// that we can tell which one is currently loaded). So, create an
|
27
|
-
// object (associative array) that is specific to the content of each.
|
28
|
-
contentOfIframe1 = {
|
29
|
-
url : "html/iframe1.html",
|
30
|
-
titleRE : /IFRAME/,
|
31
|
-
elementId : 'anElementWithText',
|
32
|
-
elementRE : /content of a paragraph/
|
33
|
-
};
|
34
|
-
contentOfIframe1a = {
|
35
|
-
url : "html/iframe1a.html",
|
36
|
-
titleRE : /iframe1a.html/,
|
37
|
-
elementId : 'anotherElementWithText',
|
38
|
-
elementRE : /block-quote element/
|
39
|
-
};
|
40
|
-
|
41
|
-
var accessChecksForIframe1 = function(flag, iframe, contentOf) {
|
42
|
-
expect(6);
|
43
|
-
|
44
|
-
try{ok (iframe.src == contentOf.url,
|
45
|
-
flag + ": Initial iframe src matches test page source");
|
46
|
-
}catch(e){print(e);}
|
47
|
-
|
48
|
-
var idoc = iframe.contentDocument;
|
49
|
-
var mtch = idoc.title.match(contentOf.titleRE);
|
50
|
-
try{ok (mtch && mtch.length > 0,
|
51
|
-
flag + ": Can get 'document' object from test iframe");
|
52
|
-
}catch(e){print(e);}
|
53
|
-
|
54
|
-
var para = idoc.getElementById(contentOf.elementId);
|
55
|
-
mtch = para.innerHTML.match(contentOf.elementRE);
|
56
|
-
try{ok (mtch && mtch.length > 0,
|
57
|
-
flag + ": Can get text from element in an iframe");
|
58
|
-
}catch(e){print(e);}
|
59
|
-
|
60
|
-
try{ok (idoc.parentWindow == iframe.contentWindow,
|
61
|
-
flag + ": doc's .parentWindow points to iframe's .contentWindow");
|
62
|
-
}catch(e){print(e);}
|
63
|
-
|
64
|
-
try{ok (idoc.parentWindow.parent == window,
|
65
|
-
flag + ": Can follow chain from iframe's doc to containing window");
|
66
|
-
}catch(e){print(e);}
|
67
|
-
|
68
|
-
try{ok (iframe.contentWindow.top == window,
|
69
|
-
flag + ": '.top' from iframe does point to top window");
|
70
|
-
}catch(e){print(e);}
|
71
|
-
};
|
72
|
-
|
73
|
-
test("IFRAMEs load with accessible content", function() {
|
74
|
-
var iframe = document.getElementById('loadediframe');
|
75
|
-
// iframe1.html loaded via src= attribute when index.html was parsed
|
76
|
-
accessChecksForIframe1("1", iframe, contentOfIframe1);
|
77
|
-
});
|
78
|
-
|
79
|
-
|
80
|
-
test("IFRAMEs still load when .src is set after the page is parsed",function() {
|
81
|
-
var iframe = document.getElementById('emptyiframe');
|
82
|
-
iframe.src = "html/iframe1.html";
|
83
|
-
accessChecksForIframe1("2", iframe, contentOfIframe1);
|
84
|
-
});
|
85
|
-
|
86
|
-
test("IFRAMEs reload with accessible content", function() {
|
87
|
-
var iframe = document.getElementById('loadediframe');
|
88
|
-
iframe.src = "html/iframe1a.html";
|
89
|
-
accessChecksForIframe1("3", iframe, contentOfIframe1a);
|
90
|
-
});
|
91
|
-
|
92
|
-
|
93
|
-
// this test relies on iframe3.html, iframe2.html, and iframeN.html
|
94
|
-
test("IFRAMEs can be nested, created dynamically", function() {
|
95
|
-
var startingDepth = 3;
|
96
|
-
var endingDepth = 7;
|
97
|
-
expect(5 + (10*((endingDepth - startingDepth)+1)));
|
98
|
-
|
99
|
-
// manually load iframe3.html
|
100
|
-
var firstIframe = document.getElementById('emptyiframe');
|
101
|
-
firstIframe.src = "html/iframe3.html";
|
102
|
-
|
103
|
-
// iframe3.html contains a static <iframe> element that loads iframe2.html,
|
104
|
-
// so at this point, we should have both loaded, with the structure that
|
105
|
-
// index.html --contains--> iframe3.html --contains--> iframe2.html
|
106
|
-
// w/ id's = emptyiframe nested1Level
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
////////////////////////////////////////
|
111
|
-
// first, verify that we've got the structure we expect:
|
112
|
-
var mtch = firstIframe.contentDocument.title.match(/nested-IFRAME/);
|
113
|
-
try{ok (mtch && mtch.length > 0,
|
114
|
-
"top-level IFRAME reloaded from correct source");
|
115
|
-
}catch(e){print(e);}
|
116
|
-
|
117
|
-
var secondIframe = firstIframe.contentDocument.
|
118
|
-
getElementById('nested1Level');
|
119
|
-
mtch = secondIframe.contentDocument.title.match(/IFRAME loading/);
|
120
|
-
try{ok (mtch && mtch.length > 0,
|
121
|
-
"can access content of an IFRAME nested in another");
|
122
|
-
}catch(e){print(e);}
|
123
|
-
|
124
|
-
try{ok (secondIframe.contentDocument.parentWindow.parent.parent == window,
|
125
|
-
"can follow path from nested IFRAME to root window");
|
126
|
-
}catch(e){print(e);}
|
127
|
-
|
128
|
-
try{ok (secondIframe.contentWindow.parent.parent == window,
|
129
|
-
"also path through .contentWindow to root window");
|
130
|
-
}catch(e){print(e);}
|
131
|
-
|
132
|
-
try{ok (secondIframe.contentWindow.top == window,
|
133
|
-
"nested IFRAME has correct .top");
|
134
|
-
}catch(e){print(e);}
|
135
|
-
|
136
|
-
|
137
|
-
////////////////////////////////////////
|
138
|
-
// OK, now we'll programatically extend the nesting depth from 2 to many
|
139
|
-
window.numberNestedIframeLoads = 0;
|
140
|
-
window.winLoadCount = 0;
|
141
|
-
window.bodyLoadCount = 0;
|
142
|
-
window.frameLoadCount = 0;
|
143
|
-
for (var c = startingDepth, bottomIframe = secondIframe; c <= endingDepth;
|
144
|
-
c++){
|
145
|
-
|
146
|
-
// add a new iframe within the current leaf iframe
|
147
|
-
var newIframe = bottomIframe.contentDocument.createElement("iframe");
|
148
|
-
newIframe.setAttribute("id", "iframe_of_depth_" + c);
|
149
|
-
newIframe.setAttribute("onload", "iframeOnloadHandler();");
|
150
|
-
var bottomBody = bottomIframe.contentDocument.
|
151
|
-
getElementsByTagName('body')[0];
|
152
|
-
|
153
|
-
bottomBody.appendChild(newIframe);
|
154
|
-
newIframe.src = "html/iframeN.html";
|
155
|
-
bottomIframe = newIframe;
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
////////////////////////////////////////
|
160
|
-
// verify contents of just-loaded iframe
|
161
|
-
mtch = bottomIframe.contentDocument.getElementById('nestingLevel').
|
162
|
-
innerHTML.match(/[0-9]+/);
|
163
|
-
try{ok (mtch && mtch.length > 0 && parseInt(mtch[0]) == c,
|
164
|
-
"nested " + c + " levels: can access content");
|
165
|
-
}catch(e){print(e);}
|
166
|
-
|
167
|
-
for (var aWindow = bottomIframe.contentWindow, cn = c; cn > 0; cn--)
|
168
|
-
aWindow = aWindow.parent;
|
169
|
-
try{ok (aWindow == window,
|
170
|
-
"nested " + c + " levels: can follow path to root window");
|
171
|
-
}catch(e){print(e);}
|
172
|
-
|
173
|
-
try{ok (bottomIframe.contentWindow.top == window,
|
174
|
-
"nested " + c + " levels: IFRAME has correct .top");
|
175
|
-
}catch(e){print(e);}
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
////////////////////////////////////////
|
180
|
-
// verify events related to iframe load:
|
181
|
-
// iframe.onload (container); window.onload and body.onload (contained)
|
182
|
-
var num = (c - startingDepth) + 1;
|
183
|
-
try{ok (num == window.numberNestedIframeLoads,
|
184
|
-
"nested " + c + " levels: event <script> executed");
|
185
|
-
}catch(e){print(e);}
|
186
|
-
|
187
|
-
try{ok (num == window.winLoadCount,
|
188
|
-
"nested " + c + " levels: window-onload handler executed");
|
189
|
-
}catch(e){print(e);}
|
190
|
-
try{ok (num == window.bodyLoadCount,
|
191
|
-
"nested " + c + " levels: body-onload handler executed");
|
192
|
-
}catch(e){print(e);}
|
193
|
-
try{ok (num == window.frameLoadCount,
|
194
|
-
"nested " + c + " levels: iframe-onload handler executed");
|
195
|
-
}catch(e){print(e);}
|
196
|
-
|
197
|
-
mtch = bottomIframe.contentWindow.parent.document.
|
198
|
-
getElementById("pCreatedIframeOnload" + num).innerHTML.
|
199
|
-
match(/para iframe onload ([0-9]+)/);
|
200
|
-
try{ok (mtch && mtch.length > 0 && parseInt(mtch[1]) == num,
|
201
|
-
"nested " + c + " levels: confirmed iframe-onload");
|
202
|
-
}catch(e){print(e);}
|
203
|
-
mtch = bottomIframe.contentDocument.
|
204
|
-
getElementById("pCreatedWindowOnload" + num).innerHTML.
|
205
|
-
match(/para window onload ([0-9]+)/);
|
206
|
-
try{ok (mtch && mtch.length > 0 && parseInt(mtch[1]) == num,
|
207
|
-
"nested " + c + " levels: confirmed window-onload");
|
208
|
-
}catch(e){print(e);}
|
209
|
-
mtch = bottomIframe.contentDocument.
|
210
|
-
getElementById("pCreatedBodyOnload" + num).innerHTML.
|
211
|
-
match(/para body onload ([0-9]+)/);
|
212
|
-
try{ok (mtch && mtch.length > 0 && parseInt(mtch[1]) == num,
|
213
|
-
"nested " + c + " levels: confirmed body-onload");
|
214
|
-
}catch(e){print(e);}
|
215
|
-
}
|
216
|
-
});
|
217
|
-
|
218
|
-
|
219
|
-
// all tests to next comment rely on content of ../html/iframe2.html
|
220
|
-
test("IFRAMEs reload on assignment to 'src'", function() {
|
221
|
-
expect(2);
|
222
|
-
|
223
|
-
var iframe = document.getElementById('loadediframe');
|
224
|
-
iframe.src = "html/iframe2.html";
|
225
|
-
try{ok (iframe.src == "html/iframe2.html",
|
226
|
-
"iframe.src matches value assigned");
|
227
|
-
}catch(e){print(e);}
|
228
|
-
|
229
|
-
var para = iframe.contentDocument.getElementById('aParaInAnIframe');
|
230
|
-
var mtch = para.innerHTML.match(/short paragraph/);
|
231
|
-
try{ok (mtch && mtch.length > 0,
|
232
|
-
"IFRAME reloaded from correct source");
|
233
|
-
}catch(e){print(e);}
|
234
|
-
});
|
@@ -1,212 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This file is a component of env.js,
|
3
|
-
* http://github.com/gleneivey/env-js/commits/master/README
|
4
|
-
* a Pure JavaScript Browser Environment
|
5
|
-
* Copyright 2009 John Resig, licensed under the MIT License
|
6
|
-
* http://www.opensource.org/licenses/mit-license.php
|
7
|
-
*/
|
8
|
-
|
9
|
-
|
10
|
-
module("multi-window");
|
11
|
-
|
12
|
-
test("2nd window.location= operation flagged as error", function() {
|
13
|
-
expect(1);
|
14
|
-
|
15
|
-
if ( window.Envjs.interpreter === "Johnson" ) {
|
16
|
-
ok(true,"we don't object to setting window.location in Johnson, which will blitz the tests");
|
17
|
-
} else {
|
18
|
-
var gotAnException = false;
|
19
|
-
window.onload = function(){;};
|
20
|
-
try {
|
21
|
-
window.location = "html/trivial.html";
|
22
|
-
} catch (e){ gotAnException = true; }
|
23
|
-
try{ ok(gotAnException, "prohibited window.location setter call fails");
|
24
|
-
}catch(e){print(e);}
|
25
|
-
}
|
26
|
-
});
|
27
|
-
|
28
|
-
test("window.open()-related behavior and members", function() {
|
29
|
-
expect(30);
|
30
|
-
|
31
|
-
var anotherWin;
|
32
|
-
try{ ok(anotherWin = window.open("html/trivial.html"),
|
33
|
-
"'window.open' returns new object");
|
34
|
-
}catch(e){print(e);}
|
35
|
-
|
36
|
-
try{ ok(anotherWin.closed == false,
|
37
|
-
"2nd window knows that it is not-closed");
|
38
|
-
}catch(e){print(e);}
|
39
|
-
|
40
|
-
var mtch = anotherWin.document.getElementById('oneP').innerHTML.
|
41
|
-
match(/Nearly-empty HTML/);
|
42
|
-
try{ ok(mtch && mtch.length > 0,
|
43
|
-
"2nd window has correct contents");
|
44
|
-
}catch(e){print(e);}
|
45
|
-
|
46
|
-
try{ ok(anotherWin.opener == window,
|
47
|
-
"2nd window's .opener is original window");
|
48
|
-
}catch(e){print(e);}
|
49
|
-
|
50
|
-
try{ ok(anotherWin.top == anotherWin,
|
51
|
-
"2nd window's .top is itself");
|
52
|
-
}catch(e){print(e);}
|
53
|
-
|
54
|
-
try{ ok(anotherWin.parent == anotherWin,
|
55
|
-
"2nd window's .parent is itself");
|
56
|
-
}catch(e){print(e);}
|
57
|
-
|
58
|
-
try{ ok(anotherWin.document.referrer == location.href,
|
59
|
-
"2nd window's document.referrer points to this one");
|
60
|
-
}catch(e){print(e);}
|
61
|
-
|
62
|
-
|
63
|
-
try{ ok((anotherWin.location = "html/with_js.html") || true,
|
64
|
-
"1st explicit '.location=' completes without exception");
|
65
|
-
}catch(e){print(e);}
|
66
|
-
|
67
|
-
mtch = anotherWin.document.getElementById('HeaderLevel1').
|
68
|
-
innerHTML.match(/Hello/);
|
69
|
-
try{ ok(mtch && mtch.length > 0,
|
70
|
-
"location setter-loaded content is correct");
|
71
|
-
}catch(e){print(e);}
|
72
|
-
|
73
|
-
|
74
|
-
try{ ok((anotherWin.location = "html/trivial.html") || true,
|
75
|
-
"2nd explicit '.location=' completes without exception");
|
76
|
-
}catch(e){print(e);}
|
77
|
-
|
78
|
-
mtch = anotherWin.document.getElementById('oneP').innerHTML.
|
79
|
-
match(/Nearly-empty HTML/);
|
80
|
-
try{ ok(mtch && mtch.length > 0,
|
81
|
-
"2nd location setter-loaded content is correct");
|
82
|
-
}catch(e){print(e);}
|
83
|
-
|
84
|
-
|
85
|
-
var thirdWin;
|
86
|
-
try{ ok(thirdWin = window.open("html/with_js.html"),
|
87
|
-
"2nd 'window.open' returns 3rd window");
|
88
|
-
}catch(e){print(e);}
|
89
|
-
|
90
|
-
mtch = thirdWin.document.getElementById('HeaderLevel1').
|
91
|
-
innerHTML.match(/Hello/);
|
92
|
-
try{ ok(mtch && mtch.length > 0,
|
93
|
-
"3rd window's content is correct");
|
94
|
-
}catch(e){print(e);}
|
95
|
-
|
96
|
-
mtch = anotherWin.document.getElementById('oneP').innerHTML.
|
97
|
-
match(/Nearly-empty HTML/);
|
98
|
-
try{ ok(mtch && mtch.length > 0,
|
99
|
-
"after 3rd window, 2nd's content still correct");
|
100
|
-
}catch(e){print(e);}
|
101
|
-
|
102
|
-
try{ ok(document.title == "jQuery Test Suite",
|
103
|
-
"after 3rd window, original's content still correct");
|
104
|
-
}catch(e){print(e);}
|
105
|
-
|
106
|
-
|
107
|
-
try{ ok(thirdWin.getTestVariables()[0] == "hello, scope",
|
108
|
-
"function from open()'ed window's scope callable");
|
109
|
-
}catch(e){print(e);}
|
110
|
-
|
111
|
-
try{ ok(thirdWin.getTestVariables()[1] == undefined ||
|
112
|
-
thirdWin.getTestVariables()[1] == null,
|
113
|
-
"dynamically-created test variable in 3rd win doesn't exist yet");
|
114
|
-
}catch(e){print(e);}
|
115
|
-
|
116
|
-
try{ ok(thirdWin.setTestVariable(42) || true,
|
117
|
-
"call to fn to create variable in other window's scope w/o exception");
|
118
|
-
}catch(e){print(e);}
|
119
|
-
|
120
|
-
try{ ok(thirdWin.getTestVariables()[1] == 42,
|
121
|
-
"variable in other window's scope created correctly");
|
122
|
-
}catch(e){print(e);}
|
123
|
-
|
124
|
-
try{ ok(thirdWin.notAlwaysPresentVariable == 42,
|
125
|
-
"variable in other window's scope accessible directly, too");
|
126
|
-
}catch(e){print(e);}
|
127
|
-
|
128
|
-
try{ ok((thirdWin.location = "html/with_js.html") || true,
|
129
|
-
"3rd window's '.location=' worked without exception");
|
130
|
-
}catch(e){print(e);}
|
131
|
-
|
132
|
-
try{ ok(thirdWin.getTestVariables()[1] == undefined ||
|
133
|
-
thirdWin.getTestVariables()[1] == null,
|
134
|
-
"reloaded window has clean variable scope");
|
135
|
-
}catch(e){print(e);}
|
136
|
-
|
137
|
-
try{ ok(thirdWin.notAlwaysPresentVariable = 55,
|
138
|
-
"setting variable in other window's scope executes without exception");
|
139
|
-
}catch(e){print(e);}
|
140
|
-
|
141
|
-
try{ ok(thirdWin.getTestVariables()[1] == 55,
|
142
|
-
"directly-set variable visible to code executing in other scope");
|
143
|
-
}catch(e){print(e);}
|
144
|
-
|
145
|
-
try{ ok(window.notAlwaysPresentVariable == undefined ||
|
146
|
-
window.notAlwaysPresentVariable == null,
|
147
|
-
"creating variable in 3rd window scope doesn't affect original window");
|
148
|
-
}catch(e){print(e);}
|
149
|
-
|
150
|
-
try{ ok(anotherWin.notAlwaysPresentVariable == undefined ||
|
151
|
-
anotherWin.notAlwaysPresentVariable == null,
|
152
|
-
"creating variable in 3rd window scope doesn't affect 2nd window");
|
153
|
-
}catch(e){print(e);}
|
154
|
-
|
155
|
-
|
156
|
-
try{ ok(anotherWin.close() || true,
|
157
|
-
"'.close()' executed without exception");
|
158
|
-
}catch(e){print(e);}
|
159
|
-
|
160
|
-
try{ ok(anotherWin.closed == true,
|
161
|
-
"after closing window, '.closed' is true");
|
162
|
-
}catch(e){print(e);}
|
163
|
-
|
164
|
-
try{ ok(window.closed == false,
|
165
|
-
"closing 2nd window doesn't affect original window");
|
166
|
-
}catch(e){print(e);}
|
167
|
-
|
168
|
-
try{ ok(thirdWin.closed == false,
|
169
|
-
"closing 2nd window doesn't affect 3rd window");
|
170
|
-
}catch(e){print(e);}
|
171
|
-
});
|
172
|
-
|
173
|
-
test("window.reload() behavior", function() {
|
174
|
-
expect(3);
|
175
|
-
|
176
|
-
var testWindow = window.open("html/trivial.html");
|
177
|
-
testWindow.checkingScope = 17;
|
178
|
-
try{ ok(testWindow.location.reload() || true,
|
179
|
-
"'window.location.reload()' completes without exception");
|
180
|
-
}catch(e){print(e);}
|
181
|
-
|
182
|
-
var variableNoLongerDefined = false;
|
183
|
-
try {
|
184
|
-
variableNoLongerDefined = (testWindow.checkingScope == undefined);
|
185
|
-
} catch (e){
|
186
|
-
variableNoLongerDefined = true;
|
187
|
-
}
|
188
|
-
try{ ok(variableNoLongerDefined, "reloaded window has clean scope");
|
189
|
-
}catch(e){print(e);}
|
190
|
-
|
191
|
-
var mtch = testWindow.document.getElementById('oneP').innerHTML.
|
192
|
-
match(/Nearly-empty HTML/);
|
193
|
-
try{ ok(mtch && mtch.length > 0,
|
194
|
-
"reloaded window has correct contents");
|
195
|
-
}catch(e){print(e);}
|
196
|
-
});
|
197
|
-
|
198
|
-
test("window.replace() behavior", function() {
|
199
|
-
expect(2);
|
200
|
-
|
201
|
-
var testWindow = window.open("html/trivial.html");
|
202
|
-
try{ ok(testWindow.location.replace("html/with_js.html") || true,
|
203
|
-
"'window.location.replace()' completes without exception");
|
204
|
-
}catch(e){print(e);}
|
205
|
-
|
206
|
-
var mtch = testWindow.document.getElementById('HeaderLevel1').
|
207
|
-
innerHTML.match(/Hello/);
|
208
|
-
try{ ok(mtch && mtch.length > 0, "replaced window has correct content");
|
209
|
-
}catch(e){print(e);}
|
210
|
-
});
|
211
|
-
|
212
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @author thatcher
|
3
|
-
*/
|
4
|
-
|
5
|
-
load('dist/env.rhino.js');
|
6
|
-
|
7
|
-
window.location = 'test/html/malformed.html';
|
8
|
-
|
9
|
-
|
10
|
-
var fixture = document.xml,
|
11
|
-
testhtml = '<!DOCTYPE html><html><head/><body><script>document.write("<a>efg");</script><p>abc</body></html>',
|
12
|
-
testfragment = '<div>this is a<strong>pig<div>oink oink!',
|
13
|
-
success = function(){
|
14
|
-
print(doc.xml);
|
15
|
-
};
|
16
|
-
|
17
|
-
var doc;
|
18
|
-
//Envjs.logLevel = Envjs.DEBUG;
|
19
|
-
doc = new DOMParser().parseFromString(testhtml);
|
20
|
-
print(doc.xml);
|
21
|
-
|
22
|
-
|
23
|
-
doc.body.innerHTML = testfragment;
|
24
|
-
print(doc.xml);
|
25
|
-
|
26
|
-
|
27
|
-
/*
|
28
|
-
var start = new Date().getTime();
|
29
|
-
for(var i=0;i<1000;i++){
|
30
|
-
parseHtmlDocument(trivial, document, null, null);
|
31
|
-
}
|
32
|
-
var stop = new Date().getTime();
|
33
|
-
print("1000 parses "+(stop-start));
|
34
|
-
*/
|