docshell/test/navigation/file_bug462076_3.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:686e49a26f67
1 <html>
2 <head>
3 <title>Bug 462076</title>
4 <script>
5 var srcs = [ "frame0.html",
6 "frame1.html",
7 "frame2.html",
8 "frame3.html" ];
9
10 var checkCount = 0;
11
12 function makeFrame(index) {
13 var ifr = document.createElement("iframe");
14 ifr.src = srcs[index];
15 ifr.onload = checkFrame;
16 document.getElementById("container" + index).appendChild(ifr);
17 }
18
19 function runTest() {
20 var randomNumber = Math.floor(Math.random() * 4);
21 for (var i = randomNumber; i < 4; ++i) {
22 makeFrame(i);
23 }
24 for (var i = 0; i < randomNumber; ++i) {
25 makeFrame(i);
26 }
27 }
28
29 function checkFrame(evt) {
30 var ifr = evt.target;
31 opener.ok(new String(ifr.contentWindow.location).indexOf(ifr.src) >= 0,
32 "Wrong document loaded (" + ifr.src + ", " +
33 ifr.contentWindow.location + ")!");
34
35 if (++checkCount == 4) {
36 if (++opener.testCount == 10) {
37 opener.nextTest();
38 window.close();
39 } else {
40 window.location.reload();
41 }
42 }
43 }
44 </script>
45 </head>
46 <body onload="setTimeout(runTest, 0);">
47 <div id="container0"></div>
48 <div id="container1"></div>
49 <div id="container2"></div>
50 <div id="container3"></div>
51 </body>
52 </html>

mercurial