Bug 1385981 - Convert docshell/test/navigation/test_sessionhistory.html to comply with new data: URI inheritance model. r=smaug
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Tue, 01 Aug 2017 10:59:05 +0200
changeset 420903 46fcd660ce409f733ce77b3d9b1477080348e321
parent 420902 ce4b1ba61a79936fc6d9a4effe507547083578e0
child 420904 725d71e0ccdaf3aac178a54339fc4c2fa429d632
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1385981
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1385981 - Convert docshell/test/navigation/test_sessionhistory.html to comply with new data: URI inheritance model. r=smaug
docshell/test/navigation/file_fragment_handling_during_load.html
docshell/test/navigation/file_fragment_handling_during_load_frame1.html
docshell/test/navigation/file_fragment_handling_during_load_frame2.html
docshell/test/navigation/file_nested_frames.html
docshell/test/navigation/file_nested_frames_innerframe.html
docshell/test/navigation/file_scrollRestoration.html
docshell/test/navigation/mochitest.ini
--- a/docshell/test/navigation/file_fragment_handling_during_load.html
+++ b/docshell/test/navigation/file_fragment_handling_during_load.html
@@ -1,24 +1,25 @@
 <html>
   <head>
     <script>
       var timerID = 0;
       function testDone() {
         clearTimeout(timerID);
         var l = document.body.firstChild.contentWindow.location.href;
-        opener.is(l, "data:text/html,bar", "Should have loaded a new document");
+        opener.ok(l.endsWith("file_fragment_handling_during_load_frame2.html"),
+                 "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";
+        ifr.contentWindow.location.href = "file_fragment_handling_during_load_frame2.html";
         history.back();
         timerID = setTimeout(testDone, 2000);
       }
     </script>
   </head>
-  <body onload="setTimeout(test, 0)"><iframe src="data:text/html,foo#a"></iframe>
+  <body onload="setTimeout(test, 0)"><iframe src="file_fragment_handling_during_load_frame1.html#a"></iframe>
   </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_fragment_handling_during_load_frame1.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+foo
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_fragment_handling_during_load_frame2.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+bar
+</body>
+</html>
--- a/docshell/test/navigation/file_nested_frames.html
+++ b/docshell/test/navigation/file_nested_frames.html
@@ -16,13 +16,13 @@
         d.close();
         opener.is(window.history.length, 1, "Unexpected history length");
         opener.nextTest();
         window.close();
       }
     </script>
   </head>
   <body>
-  <iframe id="testframe" src="data:text/html,<iframe onload='parent.nestedIframeLoaded();'></iframe>" onload="frameLoaded()"></iframe>
+  <iframe id="testframe" src="file_nested_frames_innerframe.html" onload="frameLoaded()"></iframe>
   <script>
   </script>
   </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/docshell/test/navigation/file_nested_frames_innerframe.html
@@ -0,0 +1,1 @@
+<iframe onload='parent.nestedIframeLoaded();'></iframe>
--- a/docshell/test/navigation/file_scrollRestoration.html
+++ b/docshell/test/navigation/file_scrollRestoration.html
@@ -34,34 +34,34 @@
             break;
           }
           case 3: {
             opener.is(event.persisted, false, "Shouldn't have persisted session history entry.");
             opener.is(window.scrollY, 0, "Should not have restored scrolling.");
             opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration as before reload.");
             document.getElementById("bottom").scrollIntoView();
             window.onunload = null; // Should get bfcache behavior.
-            opener.setTimeout("testWindow.history.back();", 250);
+            opener.setTimeout("SpecialPowers.wrap(testWindow).history.back();", 250);
             window.location.href = 'data:text/html,';
             break;
           }
           case 4: {
             opener.is(event.persisted, true, "Should have persisted session history entry.");
             opener.isnot(Math.round(window.scrollY), 0, "Should have kept the old scroll position.");
             opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration as before reload.");
             window.scrollTo(0, 0);
             window.location.hash = "hash";
             requestAnimationFrame(test);
             break;
           }
           case 5: {
             opener.isnot(Math.round(window.scrollY), 0, "Should have scrolled to #hash.");
             opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration mode as before fragment navigation.");
             window.onunload = function() {} // Disable bfcache.
-            opener.setTimeout("is(testWindow.history.scrollRestoration, 'auto'); testWindow.history.back();", 250);
+            opener.setTimeout("is(SpecialPowers.wrap(testWindow).history.scrollRestoration, 'auto'); SpecialPowers.wrap(testWindow).history.back();", 250);
             window.location.href = 'data:text/html,';
             break;
           }
           case 6: {
             opener.is(event.persisted, false, "Shouldn't have persisted session history entry.");
             opener.is(window.scrollY, 0, "Shouldn't have kept the old scroll position.");
             opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration mode as before fragment navigation.");
             history.scrollRestoration = "auto";
@@ -93,17 +93,17 @@
 
             var ifr = document.createElement("iframe");
             ifr.src = "data:text/html,";
             document.body.appendChild(ifr);
             ifr.onload = test;
             break;
           }
           case 7: {
-            oldHistoryObject = event.target.contentWindow.history;
+            oldHistoryObject = SpecialPowers.wrap(event.target).contentWindow.history;
             event.target.src = "about:blank";
             break;
           }
           case 8: {
             try {
               var sr = oldHistoryObject.scrollRestoration;
               opener.ok(false, "Should have thrown an exception.");
             } catch(ex) {
--- a/docshell/test/navigation/mochitest.ini
+++ b/docshell/test/navigation/mochitest.ini
@@ -8,17 +8,20 @@ support-files =
   bluebox_bug430723.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_fragment_handling_during_load_frame1.html
+  file_fragment_handling_during_load_frame2.html
   file_nested_frames.html
+  file_nested_frames_innerframe.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