Bug 1381771 - Part 2: use legacy data: URI behavior to run test. r=bgrins
authorYoshi Huang <allstars.chh@mozilla.com>
Fri, 21 Jul 2017 14:44:08 +0800
changeset 419221 1f551cfb7a2d3699093cfa3411f4fe153cdc6c19
parent 419220 83e350c46e945d6172c86da8c4cf6b8a85182e59
child 419222 7accd152f3e0ebe51dd91427413419be545477a4
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)
reviewersbgrins
bugs1381771
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 1381771 - Part 2: use legacy data: URI behavior to run test. r=bgrins These two tests just creates a dummy window, however it makes the test more difficult to write if we just simply use a seperate file for them. Because these are chrome: tests, and they are opening a content window, for the chrome side, it won't receive the window.onload because they are not the same origin. For the content side, it cannot access 'postMessage' because it looks there's some protection when trying to read chrome object.
devtools/shared/webconsole/test/test_commands_other.html
devtools/shared/webconsole/test/test_jsterm_queryselector.html
--- a/devtools/shared/webconsole/test/test_commands_other.html
+++ b/devtools/shared/webconsole/test/test_commands_other.html
@@ -67,17 +67,27 @@ function testEnd() {
   gWin.close();
   gWin = null;
   closeDebugger(gState, function() {
     gState = null;
     SimpleTest.finish();
   });
 }
 
-window.onload = function() {
+let load = Task.async(function*() {
+  removeEventListener("load", load);
+
+  yield new Promise(resolve => {
+    SpecialPowers.pushPrefEnv({"set": [
+      ["security.data_uri.unique_opaque_origin", false],
+    ]}, resolve);
+  });
+
   // Open a content window to test XRay functionality on built in functions.
   gWin = window.open("data:text/html,");
   info ("Waiting for content window to load");
   gWin.onload = startTest;
-}
+});
+addEventListener("load", load);
+
 </script>
 </body>
 </html>
--- a/devtools/shared/webconsole/test/test_jsterm_queryselector.html
+++ b/devtools/shared/webconsole/test/test_jsterm_queryselector.html
@@ -118,17 +118,27 @@ function testEnd() {
   gWin.close();
   gWin = null;
   closeDebugger(gState, function() {
     gState = null;
     SimpleTest.finish();
   });
 }
 
-window.onload = function() {
+let load = Task.async(function*() {
+  removeEventListener("load", load);
+
+  yield new Promise(resolve => {
+    SpecialPowers.pushPrefEnv({"set": [
+      ["security.data_uri.unique_opaque_origin", false],
+    ]}, resolve);
+  });
+
   // Open a content window to test XRay functionality on built in functions.
   gWin = window.open("data:text/html,");
   info ("Waiting for content window to load");
   gWin.onload = startTest;
-}
+});
+addEventListener("load", load);
+
 </script>
 </body>
 </html>