Bug 978408 - A test for fragment navigation during load, r=nsm
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sat, 01 Mar 2014 20:11:30 +0200
changeset 171727 20c705d00e7c48ff5c82558af56be53a1a8f7f4c
parent 171726 8e57e185fd67702b146c6c4ef2e725839613b72b
child 171728 6ed443a0daa3f748bb3e288618c5a68c2f78e8a4
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersnsm
bugs978408
milestone30.0a1
Bug 978408 - A test for fragment navigation during load, r=nsm
docshell/test/navigation/file_fragment_handling_during_load.html
docshell/test/navigation/mochitest.ini
docshell/test/navigation/test_sessionhistory.html
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_fragment_handling_during_load.html
@@ -0,0 +1,24 @@
+<html>
+  <head>
+    <script>
+      var timerID = 0;
+      function testDone() {
+        clearTimeout(timerID);
+        var l = document.body.firstChild.contentWindow.location.href;
+        opener.todo_is(l, "data:text/html,bar", "Should have loaded a new document");
+        opener.nextTest();
+        window.close();
+      }
+      function test() {
+        var ifr = document.getElementsByTagName("iframe")[0];
+        ifr.onload = testDone;
+        ifr.contentWindow.location.hash = "b";
+        ifr.contentWindow.location.href = "data:text/html,bar";
+        history.back();
+        timerID = setTimeout(testDone, 2000);
+      }
+    </script>
+  </head>
+  <body onload="setTimeout(test, 0)"><iframe src="data:text/html,foo#a"></iframe>
+  </body>
+</html>
--- a/docshell/test/navigation/mochitest.ini
+++ b/docshell/test/navigation/mochitest.ini
@@ -3,16 +3,17 @@ support-files =
   NavigationUtils.js
   blank.html
   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_static_and_dynamic_1.html
   frame0.html
   frame1.html
   frame2.html
   frame3.html
   goback.html
   iframe.html
   navigate.html
--- a/docshell/test/navigation/test_sessionhistory.html
+++ b/docshell/test/navigation/test_sessionhistory.html
@@ -21,17 +21,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 var testFiles =
   [ "file_bug462076_1.html",         // Dynamic frames before onload
     "file_bug462076_2.html",         // Dynamic frames when handling onload
     "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_bug534178.html",           // Session history transaction clean-up.
+    "file_fragment_handling_during_load.html"
   ];
 var testCount = 0; // Used by the test files.
 
 SimpleTest.waitForExplicitFinish();
 
 var testWindow;
 function nextTest_() {
   if (testFiles.length) {