CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / docshell / test / navigation / test_bug270414.html
blobf38dbab4dd06e8f95fcf874c48ea2eb02e9ed4c0
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script type="text/javascript" src="/MochiKit/packed.js"></script>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
8 <script type="text/javascript" src="NavigationUtils.js"></script>
9 <style type="text/css">
10 iframe { width: 90%; height: 50px; }
11 </style>
12 <script>
13 var headerHTML = "<html><head>" +
14 "<script src='/tests/SimpleTest/EventUtils.js'></scr" + "ipt>" +
15 "<script src='NavigationUtils.js'></scr" + "ipt>" +
16 "</head><body>";
17 var footerHTML = "</body></html>";
19 function testChild0() {
20 if (!window.window0) {
21 window0 = window.open("", "window0", "width=10,height=10");
22 window0.document.open();
23 window0.document.write(headerHTML);
24 window0.document.write("<script>navigateByLocation(opener.frames[0])</scr" + "ipt>");
25 window0.document.write(footerHTML);
26 window0.document.close();
30 function testChild1() {
31 if (!window.window1) {
32 window1 = window.open("", "window1", "width=10,height=10");
33 window1.document.open();
34 window1.document.write(headerHTML);
35 window1.document.write("<script>navigateByOpen('child1');</scr" + "ipt>");
36 window1.document.write(footerHTML);
37 window1.document.close();
41 function testChild2() {
42 if (!window.window2) {
43 window2 = window.open("", "window2", "width=10,height=10");
44 window2.document.open();
45 window2.document.write(headerHTML);
46 window2.document.write("<script>navigateByForm('child2');</scr" + "ipt>");
47 window2.document.write(footerHTML);
48 window2.document.close();
52 function testChild3() {
53 if (!window.window3) {
54 window3 = window.open("", "window3", "width=10,height=10");
55 window3.document.open();
56 window3.document.write(headerHTML);
57 window3.document.write("<script>navigateByHyperlink('child3');</scr" + "ipt>");
58 window3.document.write(footerHTML);
59 window3.document.close();
63 xpcWaitForFinishedFrames(function() {
64 isNavigated(frames[0], "Should be able to navigate on-domain opener's children by setting location.");
65 isNavigated(frames[1], "Should be able to navigate on-domain opener's children by calling window.open.");
66 isNavigated(frames[2], "Should be able to navigate on-domain opener's children by submitting form.");
67 isNavigated(frames[3], "Should be able to navigate on-domain opener's children by targeted hyperlink.");
69 window0.close();
70 window1.close();
71 window2.close();
72 window3.close();
74 xpcCleanupWindows();
75 SimpleTest.finish();
76 }, 4);
78 </script>
79 </head>
80 <body>
81 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=270414">Mozilla Bug 270414</a>
82 <div id="frames">
83 <iframe onload="testChild0();" name="child0" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
84 <iframe onload="testChild1();" name="child1" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
85 <iframe onload="testChild2();" name="child2" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
86 <iframe onload="testChild3();" name="child3" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
87 </div>
88 <pre id="test">
89 <script type="text/javascript">
90 SimpleTest.waitForExplicitFinish();
91 </script>
92 </pre>
93 </body>
94 </html>