CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / docshell / test / test_bug615501_3.html
blob99adbe7a9dade6f2e251bba68e8455b2642be104
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=615501
5 -->
6 <head>
7 <title>Test for Bug 615501</title>
8 <script type="application/javascript" src="/MochiKit/packed.js"></script>
9 <script type="application/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=615501">Mozilla Bug 615501</a>
15 <iframe id='iframe' src='file_bug615501.html'></iframe>
17 <script type="application/javascript;version=1.7">
19 /** Test for Bug 615501 **/
21 SimpleTest.waitForExplicitFinish();
23 // Called by inner frame on DOMContentLoaded.
24 function innerDOMContentLoaded() {
27 // Called by inner frame on load.
28 function innerLoad() {
31 // Called by inner frame on popstate.
32 var numPopstates = 0;
33 function innerPopstate(e) {
34 numPopstates++;
36 if (numPopstates == 1) {
37 // This is the inner frame's initial popstate. Spin the event loop, then
38 // start the test.
39 ok(true, 'Got initial popstate.');
40 is(e.initial, true, 'Initial popstate should have .initial set to true.');
41 setTimeout(runTest, 0);
43 else {
44 is(e.initial, false, 'State-change popstate should have .initial set to false.');
45 is(e.state, '1', 'Correct state after back.');
46 SimpleTest.finish();
50 function runTest() {
51 var win = $('iframe').contentWindow;
52 win.history.replaceState('1', '1', '1');
53 win.history.pushState('2', '2', '2');
54 win.history.back();
56 // If back() is synchronous, this replaceState call won't cause us to cancel
57 // the popstate from the call to back.
58 win.history.replaceState('a', 'a', 'a');
61 </script>
62 </body>
63 </html>