Bug 1560400: Part 3 - Update DocShell frame navigation tests to support remote frames. r=nika
authorKris Maglione <maglione.k@gmail.com>
Thu, 20 Jun 2019 14:30:47 -0700
changeset 540931 f0bac27bad8a6541611fb0cf59f666b45c574cc2
parent 540930 95da39224eab4e9aa1352c2d1d9288f458a89ab5
child 540932 72cd895b16137490bbc29d8e6f19f12551fc15f0
push id11533
push userarchaeopteryx@coole-files.de
push dateMon, 08 Jul 2019 18:18:03 +0000
treeherdermozilla-beta@f4452e031aed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1560400
milestone69.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 1560400: Part 3 - Update DocShell frame navigation tests to support remote frames. r=nika The tests still fail under Fission, because the mechanisms they use to navigate the frames don't work, but at least the checks for whether the navigation succeeded now do. That means the tests should start passing when the necessary APIs become Fission-compatible. Differential Revision: https://phabricator.services.mozilla.com/D35473
docshell/test/navigation/NavigationUtils.js
docshell/test/navigation/test_bug270414.html
docshell/test/navigation/test_child.html
docshell/test/navigation/test_grandchild.html
docshell/test/navigation/test_opener.html
docshell/test/navigation/test_popup-navigates-children.html
docshell/test/navigation/test_sibling-matching-parent.html
--- a/docshell/test/navigation/NavigationUtils.js
+++ b/docshell/test/navigation/NavigationUtils.js
@@ -50,20 +50,21 @@ function navigateByHyperlink(name) {
   document.body.appendChild(link);
   sendMouseEvent({type: "click"}, link.id);
 }
 
 // /////////////////////////////////////////////////////////////////////////
 // Functions that call into Mochitest framework
 // /////////////////////////////////////////////////////////////////////////
 
-function isNavigated(wnd, message) {
+async function isNavigated(wnd, message) {
   var result = null;
   try {
-    result = SpecialPowers.wrap(wnd).document.body.innerHTML.trim();
+    result = await SpecialPowers.spawn(
+      wnd, [], () => this.content.document.body.innerHTML.trim());
   } catch (ex) {
     result = ex;
   }
   is(result, body, message);
 }
 
 function isBlank(wnd, message) {
   var result = null;
--- a/docshell/test/navigation/test_bug270414.html
+++ b/docshell/test/navigation/test_bug270414.html
@@ -56,21 +56,21 @@ function testChild3() {
     window3.document.open();
     window3.document.write(headerHTML);
     window3.document.write("<script>navigateByHyperlink('child3');</scr" + "ipt>");
     window3.document.write(footerHTML);
     window3.document.close();
   }
 }
 
-xpcWaitForFinishedFrames(function() {
-  isNavigated(frames[0], "Should be able to navigate on-domain opener's children by setting location.");
-  isNavigated(frames[1], "Should be able to navigate on-domain opener's children by calling window.open.");
-  isNavigated(frames[2], "Should be able to navigate on-domain opener's children by submitting form.");
-  isNavigated(frames[3], "Should be able to navigate on-domain opener's children by targeted hyperlink.");
+xpcWaitForFinishedFrames(async function() {
+  await isNavigated(frames[0], "Should be able to navigate on-domain opener's children by setting location.");
+  await isNavigated(frames[1], "Should be able to navigate on-domain opener's children by calling window.open.");
+  await isNavigated(frames[2], "Should be able to navigate on-domain opener's children by submitting form.");
+  await isNavigated(frames[3], "Should be able to navigate on-domain opener's children by targeted hyperlink.");
 
   window0.close();
   window1.close();
   window2.close();
   window3.close();
 
   xpcCleanupWindows();
   SimpleTest.finish();
--- a/docshell/test/navigation/test_child.html
+++ b/docshell/test/navigation/test_child.html
@@ -14,21 +14,21 @@ if (!navigator.platform.startsWith("Win"
 }
 
 window.onload = function() {
   navigateByLocation(frames[0]);
   navigateByOpen("child1");
   navigateByForm("child2");
   navigateByHyperlink("child3");
 
-  xpcWaitForFinishedFrames(function() {
-    isNavigated(frames[0], "Should be able to navigate off-domain child by setting location.");
-    isNavigated(frames[1], "Should be able to navigate off-domain child by calling window.open.");
-    isNavigated(frames[2], "Should be able to navigate off-domain child by submitting form.");
-    isNavigated(frames[3], "Should be able to navigate off-domain child by targeted hyperlink.");
+  xpcWaitForFinishedFrames(async function() {
+    await isNavigated(frames[0], "Should be able to navigate off-domain child by setting location.");
+    await isNavigated(frames[1], "Should be able to navigate off-domain child by calling window.open.");
+    await isNavigated(frames[2], "Should be able to navigate off-domain child by submitting form.");
+    await isNavigated(frames[3], "Should be able to navigate off-domain child by targeted hyperlink.");
 
     xpcCleanupWindows();
     SimpleTest.finish();
   }, 4);
 };
 </script>
 </head>
 <body>
--- a/docshell/test/navigation/test_grandchild.html
+++ b/docshell/test/navigation/test_grandchild.html
@@ -14,21 +14,21 @@ if (!navigator.platform.startsWith("Win"
 }
 
 window.onload = function() {
   navigateByLocation(frames[0].frames[0]);
   navigateByOpen("child1_child0");
   navigateByForm("child2_child0");
   navigateByHyperlink("child3_child0");
 
-  xpcWaitForFinishedFrames(function() {
-    isNavigated(frames[0].frames[0], "Should be able to navigate off-domain grandchild by setting location.");
-    isNavigated(frames[1].frames[0], "Should be able to navigate off-domain grandchild by calling window.open.");
-    isNavigated(frames[2].frames[0], "Should be able to navigate off-domain grandchild by submitting form.");
-    isNavigated(frames[3].frames[0], "Should be able to navigate off-domain grandchild by targeted hyperlink.");
+  xpcWaitForFinishedFrames(async function() {
+    await isNavigated(frames[0].frames[0], "Should be able to navigate off-domain grandchild by setting location.");
+    await isNavigated(frames[1].frames[0], "Should be able to navigate off-domain grandchild by calling window.open.");
+    await isNavigated(frames[2].frames[0], "Should be able to navigate off-domain grandchild by submitting form.");
+    await isNavigated(frames[3].frames[0], "Should be able to navigate off-domain grandchild by targeted hyperlink.");
 
     xpcCleanupWindows();
     SimpleTest.finish();
   }, 4);
 };
 </script>
 </head>
 <body>
--- a/docshell/test/navigation/test_opener.html
+++ b/docshell/test/navigation/test_opener.html
@@ -14,21 +14,21 @@ if (navigator.platform.startsWith("Linux
 }
 
 window.onload = function() {
   navigateByLocation(window0);
   navigateByOpen("window1");
   navigateByForm("window2");
   navigateByHyperlink("window3");
 
-  xpcWaitForFinishedFrames(function() {
-    isNavigated(window0, "Should be able to navigate popup by setting location.");
-    isNavigated(window1, "Should be able to navigate popup by calling window.open.");
-    isNavigated(window2, "Should be able to navigate popup by submitting form.");
-    isNavigated(window3, "Should be able to navigate popup by targeted hyperlink.");
+  xpcWaitForFinishedFrames(async function() {
+    await isNavigated(window0, "Should be able to navigate popup by setting location.");
+    await isNavigated(window1, "Should be able to navigate popup by calling window.open.");
+    await isNavigated(window2, "Should be able to navigate popup by submitting form.");
+    await isNavigated(window3, "Should be able to navigate popup by targeted hyperlink.");
 
     window0.close();
     window1.close();
     window2.close();
     window3.close();
 
     xpcCleanupWindows();
     SimpleTest.finish();
--- a/docshell/test/navigation/test_popup-navigates-children.html
+++ b/docshell/test/navigation/test_popup-navigates-children.html
@@ -30,21 +30,21 @@ function testChild2() {
     window2 = window.open("navigate.html#child2,form", "window2", "width=10,height=10");
 }
 
 function testChild3() {
   if (!window.window3)
     window3 = window.open("navigate.html#child3,hyperlink", "window3", "width=10,height=10");
 }
 
-xpcWaitForFinishedFrames(function() {
-  isNavigated(frames[0], "Should be able to navigate on-domain opener's children by setting location.");
-  isNavigated(frames[1], "Should be able to navigate on-domain opener's children by calling window.open.");
-  isNavigated(frames[2], "Should be able to navigate on-domain opener's children by submitting form.");
-  isNavigated(frames[3], "Should be able to navigate on-domain opener's children by targeted hyperlink.");
+xpcWaitForFinishedFrames(async function() {
+  await isNavigated(frames[0], "Should be able to navigate on-domain opener's children by setting location.");
+  await isNavigated(frames[1], "Should be able to navigate on-domain opener's children by calling window.open.");
+  await isNavigated(frames[2], "Should be able to navigate on-domain opener's children by submitting form.");
+  await isNavigated(frames[3], "Should be able to navigate on-domain opener's children by targeted hyperlink.");
 
   window0.close();
   window1.close();
   window2.close();
   window3.close();
 
   xpcCleanupWindows();
   SimpleTest.finish();
--- a/docshell/test/navigation/test_sibling-matching-parent.html
+++ b/docshell/test/navigation/test_sibling-matching-parent.html
@@ -11,21 +11,21 @@
 <script>
 window.onload = function() {
   document.getElementById("active").innerHTML =
       '<iframe src="navigate.html#parent.frames[0],location"></iframe>' +
       '<iframe src="navigate.html#child1,open"></iframe>' +
       '<iframe src="navigate.html#child2,form"></iframe>' +
       '<iframe src="navigate.html#child3,hyperlink"></iframe>';
 
-  xpcWaitForFinishedFrames(function() {
-    isNavigated(frames[0], "Should be able to navigate sibling with on-domain parent by setting location.");
-    isNavigated(frames[1], "Should be able to navigate sibling with on-domain parent by calling window.open.");
-    isNavigated(frames[2], "Should be able to navigate sibling with on-domain parent by submitting form.");
-    isNavigated(frames[3], "Should be able to navigate sibling with on-domain parent by targeted hyperlink.");
+  xpcWaitForFinishedFrames(async function() {
+    await isNavigated(frames[0], "Should be able to navigate sibling with on-domain parent by setting location.");
+    await isNavigated(frames[1], "Should be able to navigate sibling with on-domain parent by calling window.open.");
+    await isNavigated(frames[2], "Should be able to navigate sibling with on-domain parent by submitting form.");
+    await isNavigated(frames[3], "Should be able to navigate sibling with on-domain parent by targeted hyperlink.");
 
     xpcCleanupWindows();
     SimpleTest.finish();
   }, 4);
 };
 </script>
 </head>
 <body>