Bug 448909 - Need more controls WHATWG Video tag. r=mconnor, r=bz
[wine-gecko.git] / docshell / test / test_bug413310.html
blobbce91c027b49dceca24c46c3196cd90e6bafa9e8
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=413310
5 -->
6 <head>
7 <title>Test for Bug 413310</title>
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=413310">Mozilla Bug 413310</a>
14 <p id="display">
15 <script class="testbody" type="text/javascript">
17 /** Test for Bug 413310 **/
19 // NOTE: If we ever make subframes do bfcache stuff, this test will need to be
20 // modified accordingly! It assumes that subframes do NOT get bfcached.
21 var onloadCount = 0;
23 var step = -1; // One increment will come from the initial subframe onload.
24 // Note that this script should come before the subframe,
25 // so that doNextStep is defined when its onload handler fires.
27 var textContent;
29 SimpleTest.waitForExplicitFinish();
31 addLoadEvent(doNextStep);
33 function doNextStep() {
34 ++step;
35 switch (step) {
36 case 1:
37 is(onloadCount, 1, "Loaded initial page");
38 is($("i").contentWindow.location.href,
39 location.href.replace(/test_bug413310.html/,
40 "bug413310-subframe.html"),
41 "Unexpected subframe location after initial load");
42 $("i").contentDocument.forms[0].submit();
43 break;
44 case 2:
45 is(onloadCount, 2, "Loaded POST result");
47 is($("i").contentWindow.location.href,
48 location.href.replace(/test_bug413310.html/,
49 "bug413310-post.sjs"),
50 "Unexpected subframe location after POST load");
52 textContent = $("i").contentDocument.body.textContent;
53 isDeeply(textContent.match(/^POST /), ["POST "], "Not a POST?");
55 $("i").contentWindow.location.hash = "foo";
56 setTimeout(doNextStep, 0);
57 break;
58 case 3:
59 is(onloadCount, 2, "Anchor scroll should not fire onload");
60 is($("i").contentWindow.location.href,
61 location.href.replace(/test_bug413310.html/,
62 "bug413310-post.sjs#foo"),
63 "Unexpected subframe location after anchor scroll");
64 is(textContent, $("i").contentDocument.body.textContent,
65 "Did a load when scrolling?");
66 $("i").contentWindow.location.href = "bug413310-subframe.html";;
67 break;
68 case 4:
69 is(onloadCount, 3, "Done new load");
70 is($("i").contentWindow.location.href,
71 location.href.replace(/test_bug413310.html/,
72 "bug413310-subframe.html"),
73 "Unexpected subframe location after new load");
74 history.back();
75 break;
76 case 5:
77 is(onloadCount, 4,
78 "History traversal didn't fire onload: bfcache issues!");
79 is($("i").contentWindow.location.href,
80 location.href.replace(/test_bug413310.html/,
81 "bug413310-post.sjs#foo"),
82 "Unexpected subframe location");
83 is(textContent, $("i").contentDocument.body.textContent,
84 "Did a load when going back?");
85 SimpleTest.finish();
86 break;
89 </script>
90 <!-- Use a timeout in onload so that we don't do a load immediately inside onload -->
91 <iframe id="i" src="bug413310-subframe.html" onload="setTimeout(doNextStep, 20)">
92 </iframe>
93 </p>
94 <div id="content" style="display: none">
96 </div>
97 <pre id="test">
98 </pre>
99 </body>
100 </html>