Bug 1576288 - Fix dom/tests/mochitest/storageevent/ tests to work with Fission. r=asuth
authorAndrew McCreight <continuation@gmail.com>
Sat, 31 Aug 2019 01:52:35 +0000
changeset 491430 d1615ca96d8f9599d78682439af3b86c011387ea
parent 491429 56e0d66f5eec918defbeba5a55e56b0f7a296661
child 491431 9f42a1117de296199fde1ce23855b8f6481c3305
push id36528
push useraiakab@mozilla.com
push dateTue, 03 Sep 2019 21:53:16 +0000
treeherdermozilla-central@6a6153cb19e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1576288
milestone71.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 1576288 - Fix dom/tests/mochitest/storageevent/ tests to work with Fission. r=asuth These tests compute the origin of their parent, in order to pass in as the target origin argument to postMessage. They do this with SpecialPowers.wrap(parent.window.location); which does not work with Fission enabled, because the parent is often in another process. Every web page in this directory is only ever has a single origin as a parent, so we can hard code it as an argument to the first call to the postMsg() helper method. Differential Revision: https://phabricator.services.mozilla.com/D43307
dom/tests/mochitest/storageevent/frameLocalStorageMaster.html
dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html
dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html
dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html
dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html
dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html
dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html
dom/tests/mochitest/storageevent/interOriginFrame.js
dom/tests/mochitest/storageevent/mochitest.ini
--- a/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html
+++ b/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html
@@ -53,11 +53,11 @@ function doStep()
 
   return true;
 }
 
 </script>
 
 </head>
 
-<body onload="postMsg('frame loaded');">
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
 </body>
 </html>
--- a/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html
+++ b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html
@@ -45,11 +45,11 @@ function doStep()
 
   return true;
 }
 
 </script>
 
 </head>
 
-<body onload="postMsg('frame loaded');">
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
 </body>
 </html>
--- a/dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html
+++ b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveNotEqual.html
@@ -29,11 +29,11 @@ function doStep()
 
   return true;
 }
 
 </script>
 
 </head>
 
-<body onload="postMsg('frame loaded');">
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
 </body>
 </html>
--- a/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html
@@ -54,14 +54,14 @@ function doStep()
 
   return true;
 }
 
 </script>
 
 </head>
 
-<body onload="postMsg('frame loaded');">
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
   <iframe src="http://example.com:80/tests/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html"
           name="slaveFrame">
   </iframe>
 </body>
 </html>
--- a/dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageMasterNotEqual.html
@@ -53,14 +53,14 @@ function doStep()
 
   return true;
 }
 
 </script>
 
 </head>
 
-<body onload="postMsg('frame loaded');">
+<body onload="postMsg('frame loaded', 'http://mochi.test:8888');">
   <iframe src="http://example.com:80/tests/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html"
           name="slaveFrame">
   </iframe>
 </body>
 </html>
--- a/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html
@@ -49,11 +49,11 @@ function doStep()
 
   return true;
 }
 
 </script>
 
 </head>
 
-<body onload="postMsg('frame loaded');">
+<body onload="postMsg('frame loaded', 'http://example.com:80');">
 </body>
 </html>
--- a/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html
+++ b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveNotEqual.html
@@ -29,11 +29,11 @@ function doStep()
 
   return true;
 }
 
 </script>
 
 </head>
 
-<body onload="postMsg('frame loaded');">
+<body onload="postMsg('frame loaded', 'http://example.org');">
 </body>
 </html>
--- a/dom/tests/mochitest/storageevent/interOriginFrame.js
+++ b/dom/tests/mochitest/storageevent/interOriginFrame.js
@@ -1,11 +1,21 @@
-function postMsg(message) {
-  var l = SpecialPowers.wrap(parent.window.location);
-  parent.postMessage(message, l.protocol + "//" + l.host);
+let parentLocation = "";
+
+// The first time this gets called in a page, the location of the parent
+// should be passed in. This will be used as the target origin argument
+// for the postMessage call for all subsequent calls to postMsg().
+function postMsg(message, newParentLocation) {
+  if (newParentLocation) {
+    parentLocation = newParentLocation;
+  } else if (parentLocation == "") {
+    throw new Error("Failed to pass in newParentLocation");
+  }
+
+  parent.postMessage(message, parentLocation);
 }
 
 window.addEventListener("message", onMessageReceived);
 
 function onMessageReceived(event) {
   if (event.data == "step") {
     var performed = false;
     try {
--- a/dom/tests/mochitest/storageevent/mochitest.ini
+++ b/dom/tests/mochitest/storageevent/mochitest.ini
@@ -6,16 +6,12 @@ support-files =
   frameSessionStorageMasterEqual.html
   frameSessionStorageMasterNotEqual.html
   frameSessionStorageSlaveEqual.html
   frameSessionStorageSlaveNotEqual.html
   interOriginFrame.js
   interOriginTest2.js
 
 [test_storageLocalStorageEventCheckNoPropagation.html]
-fail-if = fission
 [test_storageLocalStorageEventCheckPropagation.html]
-fail-if = fission
 [test_storageNotifications.html]
 [test_storageSessionStorageEventCheckNoPropagation.html]
-fail-if = fission
 [test_storageSessionStorageEventCheckPropagation.html]
-skip-if = fission