Bug 1572903: Part 2 - Make some dom/base mochitests Fission-compatible. r=mccr8
authorKris Maglione <maglione.k@gmail.com>
Fri, 09 Aug 2019 19:23:55 -0700
changeset 488075 1d8042fdc2b8a6ec78169a33d2648db97b2131c4
parent 488074 5f0660a4dc617fdeae2221bde5b77f2655e109a6
child 488076 c3db0f8fbc5b2ac742da75e8295052d5d9510306
push id36435
push usercbrindusan@mozilla.com
push dateThu, 15 Aug 2019 09:46:49 +0000
treeherdermozilla-central@0db07ff50ab5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1572903
milestone70.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 1572903: Part 2 - Make some dom/base mochitests Fission-compatible. r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D41473
dom/base/test/file_bug326337_inner.html
dom/base/test/mochitest.ini
dom/base/test/test_bug590812.html
dom/base/test/test_x-frame-options.html
--- a/dom/base/test/file_bug326337_inner.html
+++ b/dom/base/test/file_bug326337_inner.html
@@ -16,25 +16,29 @@ runTest();
 var xhr;
 
 function runTest() {
   xhr = new XMLHttpRequest();
   xhr.open("GET", "file_bug326337.xml", true);
   xhr.onreadystatechange = function() {
     if (xhr.readyState == 4) {
       check(xhr.responseXML.documentElement.getAttribute("root"));
-      SpecialPowers.wrap(parent).location.hash = "#done";
+      SpecialPowers.spawn(parent, [], () => {
+        content.location.hash = "#done";
+      });
     }
   }
   xhr.send(null);
 }
 
 function check(attr) {
   if (attr != "yes") {
-    SpeciaPowers.wrap(parent).location.hash = "#fail";
+    SpecialPowers.spawn(parent, [], () => {
+      content.location.hash = "#fail";
+    });
     throw 1;
   }
 }
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -305,23 +305,21 @@ skip-if = toolkit == 'android' || headle
 [test_bug282547.html]
 [test_bug298064.html]
 [test_bug300992.html]
 [test_bug311681.xml]
 [test_bug313646.html]
 [test_bug320799.html]
 [test_bug322317.html]
 [test_bug326337.html]
-fail-if = fission
 skip-if = fission && debug # Crashes: @ std::_Function_handler<void (mozilla::Tuple<nsresult, mozilla::dom::PBrowserBridgeParent*>&&), mozilla::dom::WindowGlobalParent::ChangeFrameRemoteness(mozilla::dom::BrowsingContext*, nsTSubstring<char16_t> const&, unsigned long, mozilla::ErrorResult&)::$_2>::_M_invoke(std::_Any_data const&, mozilla::Tuple<nsresult, mozilla::dom::PBrowserBridgeParent*>&&)
 [test_bug330925.xhtml]
 [test_bug331959.html]
-skip-if = fission
 [test_bug333064.html]
-skip-if = fission || toolkit == 'android' || headless # Headless: Bug 1405868
+skip-if = toolkit == 'android' || headless # Headless: Bug 1405868
 [test_bug333198.html]
 [test_bug333673.html]
 [test_bug337631.html]
 [test_bug338541.xhtml]
 [test_bug338583.html]
 skip-if = toolkit == 'android'
 [test_bug338679.html]
 [test_bug339494.html]
@@ -831,19 +829,18 @@ support-files =
 [test_setInterval_from_start.html]
 [test_setInterval_uncatchable_exception.html]
 skip-if = debug == false
 [test_settimeout_extra_arguments.html]
 [test_settimeout_inner.html]
 [test_setTimeoutWith0.html]
 [test_setting_opener.html]
 [test_shared_compartment1.html]
+[test_shared_compartment2.html]
 fail-if = fission
-[test_shared_compartment2.html]
-skip-if = fission # Times out in weird ways.
 [test_structuredclone_backref.html]
 [test_style_cssText.html]
 [test_text_wholeText.html]
 [test_textnode_normalize_in_selection.html]
 [test_textnode_split_in_selection.html]
 [test_timeout_clamp.html]
 skip-if = debug == true && toolkit == 'android' # Timing dependent, skip slow debug android builds
 [test_timer_flood.html]
@@ -877,12 +874,12 @@ fail-if = fission
 [test_window_extensible.html]
 [test_window_indexing.html]
 [test_window_keys.html]
 [test_window_named_frame_enumeration.html]
 [test_window_own_props.html]
 [test_window_proto.html]
 [test_writable-replaceable.html]
 [test_x-frame-options.html]
-fail-if = fission
+fail-if = fission # Cross-origin X-Frame-Options
 skip-if = toolkit == 'android' && debug && !is_fennec
 [test_youtube_flash_embed.html]
 # Please keep alphabetical order.
--- a/dom/base/test/test_bug590812.html
+++ b/dom/base/test/test_bug590812.html
@@ -12,17 +12,25 @@
 <iframe src="http://noxul.example.com/tests/dom/base/test/file_bug590812.xml"></iframe>
 <iframe src="file_bug590812.xml"></iframe>
 <iframe src="file_bug590812-ref.xhtml"></iframe>
 <pre id="test">
 <script class="testbody" type="application/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
-function runTest() {
+async function runTest() {
+  // FIXME(Fission): The load event fires before cross-origin iframes have
+  // loaded (bug 1559841).
+  if (SpecialPowers.useRemoteSubframes) {
+    for (let i = 0; i < 100; i++) {
+      await new Promise(resolve => setTimeout(resolve, 0));
+    }
+  }
+
   sNoXUL = snapshotWindow(window.frames[0], false);
   sWithXUL = snapshotWindow(window.frames[1], false);
   sRef = snapshotWindow(window.frames[2], false);
   let res;
   ok(compareSnapshots(sNoXUL, sRef, true)[0],
      "noxul domain same as ref");
   ok(compareSnapshots(sWithXUL, sRef, true)[0],
      "xul supporting domain same as ref");
--- a/dom/base/test/test_x-frame-options.html
+++ b/dom/base/test/test_x-frame-options.html
@@ -12,102 +12,138 @@
 </div>
 
 <iframe style="width:100%;height:300px;" id="harness"></iframe>
 <script class="testbody" type="text/javascript">
 
 var path = "/tests/dom/base/test/";
 var isUnique = SpecialPowers.getBoolPref("security.data_uri.unique_opaque_origin");
 
-var testFramesLoaded = function() {
-  var harness = SpecialPowers.wrap(document).getElementById("harness");
+var testFramesLoaded = async function() {
+  var harness = document.getElementById("harness").contentDocument;
+
+  // FIXME(Fission): The load event fires before cross-origin iframes have
+  // loaded (bug 1559841).
+  if (SpecialPowers.useRemoteSubframes) {
+    for (let i = 0; i < 100; i++) {
+      await new Promise(resolve => setTimeout(resolve, 0));
+    }
+  }
 
   // iframe from same origin, no X-F-O header - should load
-  var frame = harness.contentDocument.getElementById("control1");
-  var test1 = frame.contentDocument.getElementById("test").textContent;
-  is(test1, "control1", "test control1");
+  var frame = harness.getElementById("control1");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test1 = this.content.document.getElementById("test").textContent;
+    Assert.equal(test1, "control1", "test control1");
+  });
 
   // iframe from different origin, no X-F-O header - should load
-  frame = harness.contentDocument.getElementById("control2");
-  var test2 = frame.contentDocument.getElementById("test").textContent;
-  is(test2, "control2", "test control2");
+  frame = harness.getElementById("control2");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test2 = this.content.document.getElementById("test").textContent;
+    Assert.equal(test2, "control2", "test control2");
+  });
 
   // iframe from same origin, X-F-O: DENY - should not load
-  frame = harness.contentDocument.getElementById("deny");
-  var test3 = frame.contentDocument.getElementById("test");
-  is(test3, null, "test deny");
+  frame = harness.getElementById("deny");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test3 = this.content.document.getElementById("test");
+    Assert.equal(test3, null, "test deny");
+  });
 
   // iframe from same origin, X-F-O: SAMEORIGIN - should load
-  frame = harness.contentDocument.getElementById("sameorigin1");
-  var test4 = frame.contentDocument.getElementById("test").textContent;
-  is(test4, "sameorigin1", "test sameorigin1");
+  frame = harness.getElementById("sameorigin1");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test4 = this.content.document.getElementById("test").textContent;
+    Assert.equal(test4, "sameorigin1", "test sameorigin1");
+  });
 
   // iframe from different origin, X-F-O: SAMEORIGIN - should not load
-  frame = harness.contentDocument.getElementById("sameorigin2");
-  var test5 = frame.contentDocument.getElementById("test");
-  is(test5, null, "test sameorigin2");
+  frame = harness.getElementById("sameorigin2");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test5 = this.content.document.getElementById("test");
+    Assert.equal(test5, null, "test sameorigin2");
+  });
 
   // iframe from different origin, X-F-O: SAMEORIGIN, SAMEORIGIN - should not load
-  frame = harness.contentDocument.getElementById("sameorigin5");
-  var test6 = frame.contentDocument.getElementById("test");
-  is(test6, null, "test sameorigin5");
+  frame = harness.getElementById("sameorigin5");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test6 = this.content.document.getElementById("test");
+    Assert.equal(test6, null, "test sameorigin5");
+  });
 
   // iframe from same origin, X-F-O: SAMEORIGIN, SAMEORIGIN - should load
-  frame = harness.contentDocument.getElementById("sameorigin6");
-  var test7 = frame.contentDocument.getElementById("test").textContent;
-  is(test7, "sameorigin6", "test sameorigin6");
+  frame = harness.getElementById("sameorigin6");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test7 = this.content.document.getElementById("test").textContent;
+    Assert.equal(test7, "sameorigin6", "test sameorigin6");
+  });
 
   // iframe from same origin, X-F-O: SAMEORIGIN,SAMEORIGIN, SAMEORIGIN - should load
-  frame = harness.contentDocument.getElementById("sameorigin7");
-  var test8 = frame.contentDocument.getElementById("test").textContent;
-  is(test8, "sameorigin7", "test sameorigin7");
+  frame = harness.getElementById("sameorigin7");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test8 = this.content.document.getElementById("test").textContent;
+    Assert.equal(test8, "sameorigin7", "test sameorigin7");
+  });
 
   // iframe from same origin, X-F-O: SAMEORIGIN,SAMEORIGIN, SAMEORIGIN - should not load
-  frame = harness.contentDocument.getElementById("sameorigin8");
-  var test9 = frame.contentDocument.getElementById("test");
-  is(test9, null, "test sameorigin8");
+  frame = harness.getElementById("sameorigin8");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test9 = this.content.document.getElementById("test");
+    Assert.equal(test9, null, "test sameorigin8");
+  });
 
   // iframe from same origin, X-F-O: DENY,SAMEORIGIN - should not load
-  frame = harness.contentDocument.getElementById("mixedpolicy");
-  var test10 = frame.contentDocument.getElementById("test");
-  is(test10, null, "test mixedpolicy");
+  frame = harness.getElementById("mixedpolicy");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test10 = this.content.document.getElementById("test");
+    Assert.equal(test10, null, "test mixedpolicy");
+  });
 
   // iframe from different origin, allow-from: this origin - should load
-  frame = harness.contentDocument.getElementById("allow-from-allow");
-  var test11 = frame.contentDocument.getElementById("test").textContent;
-  is(test11, "allow-from-allow", "test allow-from-allow");
+  frame = harness.getElementById("allow-from-allow");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test11 = this.content.document.getElementById("test").textContent;
+    Assert.equal(test11, "allow-from-allow", "test allow-from-allow");
+  });
 
   // iframe from different origin, with allow-from: other - should load as we no longer support allow-from (Bug 1301529)
-  frame = harness.contentDocument.getElementById("allow-from-deny");
-  var test12 = frame.contentDocument.getElementById("test");
-  isnot(test12, null, "test allow-from-deny");
+  frame = harness.getElementById("allow-from-deny");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test12 = this.content.document.getElementById("test");
+    Assert.notEqual(test12, null, "test allow-from-deny");
+  });
 
   // iframe from different origin, X-F-O: SAMEORIGIN, multipart - should not load
-  frame = harness.contentDocument.getElementById("sameorigin-multipart");
-  var test13 = frame.contentDocument.getElementById("test");
-  is(test13, null, "test sameorigin-multipart");
+  frame = harness.getElementById("sameorigin-multipart");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test13 = this.content.document.getElementById("test");
+    Assert.equal(test13, null, "test sameorigin-multipart");
+  });
 
   // iframe from same origin, X-F-O: SAMEORIGIN, multipart - should load
-  frame = harness.contentDocument.getElementById("sameorigin-multipart2");
-  var test14 = frame.contentDocument.getElementById("test").textContent;
-  is(test14, "sameorigin-multipart2", "test sameorigin-multipart2");
+  frame = harness.getElementById("sameorigin-multipart2");
+  await SpecialPowers.spawn(frame, [], () => {
+    var test14 = this.content.document.getElementById("test").textContent;
+    Assert.equal(test14, "sameorigin-multipart2", "test sameorigin-multipart2");
+  });
 
 
   // frames from bug 836132 tests, no longer supported allow-from
   {
-    frame = harness.contentDocument.getElementById("allow-from-allow-1");
+    frame = harness.getElementById("allow-from-allow-1");
     var theTestResult = frame.contentDocument.getElementById("test");
     isnot(theTestResult, null, "test afa1 should have been allowed");
     if(theTestResult) {
       is(theTestResult.textContent, "allow-from-allow-1", "test allow-from-allow-1");
     }
   }
   // Verify allow-from no longer works
   for (var i = 1; i<=14; i++) {
-    frame = harness.contentDocument.getElementById("allow-from-deny-" + i);
+    frame = harness.getElementById("allow-from-deny-" + i);
     var theTestResult = frame.contentDocument.getElementById("test");
     isnot(theTestResult, null, "test allow-from-deny-" + i);
   }
 
   // call tests to check principal comparison, e.g. a document can open a window
   // to a data: or javascript: document which frames an
   // X-Frame-Options: SAMEORIGIN document and the frame should load
   testFrameInJSURI();