Bug 1281952 - Basic test for sync-ness of popstate event.
MozReview-Commit-ID: 1dEXrnDwXhM
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_popstate_sync.html
@@ -0,0 +1,44 @@
+<html>
+ <head>
+ <script>
+ let correctOrder = ["start-onload", "end-onload", "onpopstate", "onhashchange"];
+ let order = [];
+ let done = false;
+
+ window.onload = function () {
+ setTimeout(function () {
+ order.push("start-onload");
+ history.pushState({page: 1}, "Hi", "#fragment");
+ history.back();
+ order.push("end-onload");
+ opener.ok(!done, "onhash should run last, not onload");
+ }, 0);
+ }
+
+ window.onpopstate = function () {
+ order.push("onpopstate");
+ opener.ok(!done, "onhash should run last, not onpopstate");
+ }
+
+ window.onhashchange = function () {
+ order.push("onhashchange");
+ done = true;
+ opener.is(correctOrder.length, order.length,
+ "should have the right number of total states");
+ let i = 0;
+ for (let e of correctOrder) {
+ opener.is(e, order[i], "state " + i.toString() + " should match");
+ ++i;
+ }
+ opener.nextTest();
+ window.close();
+ }
+ </script>
+ </head>
+ <body>
+ <div style="border: 1px solid black; height: 5000px;">
+ </div>
+ <div id="bottom">Hello world</div>
+ <a href="#hash" name="hash">hash</a>
+ </body>
+</html>
--- a/docshell/test/navigation/mochitest.ini
+++ b/docshell/test/navigation/mochitest.ini
@@ -5,16 +5,17 @@ support-files =
file_bug462076_1.html
file_bug462076_2.html
file_bug462076_3.html
file_bug508537_1.html
file_bug534178.html
file_document_write_1.html
file_fragment_handling_during_load.html
file_nested_frames.html
+ file_popstate_sync.html
file_scrollRestoration.html
file_shiftReload_and_pushState.html
file_static_and_dynamic_1.html
frame0.html
frame1.html
frame2.html
frame3.html
goback.html
@@ -27,17 +28,17 @@ support-files =
file_triggeringprincipal_subframe.html
file_triggeringprincipal_subframe_nav.html
file_triggeringprincipal_window_open.html
file_triggeringprincipal_parent_iframe_window_open_base.html
file_triggeringprincipal_parent_iframe_window_open_nav.html
file_triggeringprincipal_iframe_iframe_window_open_frame_a.html
file_triggeringprincipal_iframe_iframe_window_open_frame_b.html
file_triggeringprincipal_iframe_iframe_window_open_frame_a_nav.html
-
+
[test_bug13871.html]
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || toolkit == 'android' #RANDOM # Bug 1136180 disabled on B2G Desktop and Mulet for intermittent failures
[test_bug270414.html]
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || toolkit == "android" # Bug 1136180 disabled on B2G Desktop and Mulet for intermittent failures
[test_bug278916.html]
[test_bug279495.html]
[test_bug344861.html]
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || toolkit == "android" || toolkit == "windows" # disabled on Windows because of bug 1234520
--- a/docshell/test/navigation/test_sessionhistory.html
+++ b/docshell/test/navigation/test_sessionhistory.html
@@ -25,17 +25,18 @@ var testFiles =
"file_bug462076_3.html", // Dynamic frames after onload
"file_bug508537_1.html", // Dynamic frames and forward-back
"file_document_write_1.html", // Session history + document.write
//"file_static_and_dynamic_1.html",// Static and dynamic frames and forward-back
"file_bug534178.html", // Session history transaction clean-up.
"file_fragment_handling_during_load.html",
"file_nested_frames.html",
"file_shiftReload_and_pushState.html",
- "file_scrollRestoration.html"
+ "file_scrollRestoration.html",
+ "file_popstate_sync.html",
];
var testCount = 0; // Used by the test files.
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
var testWindow;
function nextTest_() {