Bug 1563578: Make browser_getActor_filter.js Fission-compatible.
authorKris Maglione <maglione.k@gmail.com>
Thu, 22 Aug 2019 20:28:36 +0000
changeset 553240 45ce6b884d09cb48242a9c6d2f924f2107388531
parent 553239 b47aa54a3dad5afba524bc047c8b9b8c5c4533c6
child 553241 c3e405a5fca67b3f20b72ef1a732e7bc82486cd1
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1563578
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 1563578: Make browser_getActor_filter.js Fission-compatible. Differential Revision: https://phabricator.services.mozilla.com/D36974
dom/ipc/tests/JSWindowActor/browser.ini
dom/ipc/tests/JSWindowActor/browser_getActor_filter.js
testing/specialpowers/content/SpecialPowersChild.jsm
testing/specialpowers/content/SpecialPowersSandbox.jsm
--- a/dom/ipc/tests/JSWindowActor/browser.ini
+++ b/dom/ipc/tests/JSWindowActor/browser.ini
@@ -1,23 +1,16 @@
 [DEFAULT]
 support-files =
   head.js
 
 [browser_destroy_callbacks.js]
-skip-if = fission || os == 'mac' #Bug 1572560
+skip-if = os == 'mac' #Bug 1572560
 [browser_event_listener.js]
-skip-if = fission
 [browser_getActor.js]
-skip-if = fission
 [browser_getActor_filter.js]
-fail-if = fission
 [browser_observer_notification.js]
-skip-if = fission
 support-files=
   file_mediaPlayback.html
   audio.ogg
 [browser_registerWindowActor.js]
-skip-if = fission
 [browser_sendAsyncMessage.js]
-skip-if = fission
 [browser_sendQuery.js]
-skip-if = fission
--- a/dom/ipc/tests/JSWindowActor/browser_getActor_filter.js
+++ b/dom/ipc/tests/JSWindowActor/browser_getActor_filter.js
@@ -10,17 +10,17 @@ declTest("getActor with mismatch", {
     ok(parent, "WindowGlobalParent should have value.");
     Assert.throws(
       () => parent.getActor("Test"),
       /NS_ERROR_NOT_AVAILABLE/,
       "Should throw if it doesn't match."
     );
 
     await ContentTask.spawn(browser, {}, async function() {
-      let child = content.window.getWindowGlobalChild();
+      let child = content.getWindowGlobalChild();
       ok(child, "WindowGlobalChild should have value.");
 
       Assert.throws(
         () => child.getActor("Test"),
         /NS_ERROR_NOT_AVAILABLE/,
         "Should throw if it doesn't match."
       );
     });
@@ -31,17 +31,17 @@ declTest("getActor with matches", {
   matches: ["*://*/*"],
   url: TEST_URL,
 
   async test(browser) {
     let parent = browser.browsingContext.currentWindowGlobal;
     ok(parent.getActor("Test"), "JSWindowActorParent should have value.");
 
     await ContentTask.spawn(browser, {}, async function() {
-      let child = content.window.getWindowGlobalChild();
+      let child = content.getWindowGlobalChild();
       ok(child, "WindowGlobalChild should have value.");
       ok(child.getActor("Test"), "JSWindowActorChild should have value.");
     });
   },
 });
 
 declTest("getActor with iframe matches", {
   allFrames: true,
@@ -50,55 +50,62 @@ declTest("getActor with iframe matches",
   async test(browser) {
     await ContentTask.spawn(browser, TEST_URL, async function(url) {
       // Create and append an iframe into the window's document.
       let frame = content.document.createElement("iframe");
       frame.src = url;
       content.document.body.appendChild(frame);
       await ContentTaskUtils.waitForEvent(frame, "load");
 
-      is(content.window.frames.length, 1, "There should be an iframe.");
-      let child = frame.contentWindow.window.getWindowGlobalChild();
-      ok(child.getActor("Test"), "JSWindowActorChild should have value.");
+      is(content.frames.length, 1, "There should be an iframe.");
+      await content.SpecialPowers.spawn(frame, [], () => {
+        let child = content.getWindowGlobalChild();
+        Assert.ok(
+          child.getActor("Test"),
+          "JSWindowActorChild should have value."
+        );
+      });
     });
   },
 });
 
 declTest("getActor with iframe mismatch", {
   allFrames: true,
   matches: ["about:home"],
 
   async test(browser) {
     await ContentTask.spawn(browser, TEST_URL, async function(url) {
       // Create and append an iframe into the window's document.
       let frame = content.document.createElement("iframe");
       frame.src = url;
       content.document.body.appendChild(frame);
       await ContentTaskUtils.waitForEvent(frame, "load");
 
-      is(content.window.frames.length, 1, "There should be an iframe.");
-      let child = frame.contentWindow.window.getWindowGlobalChild();
-      Assert.throws(
-        () => child.getActor("Test"),
-        /NS_ERROR_NOT_AVAILABLE/,
-        "Should throw if it doesn't match."
-      );
+      is(content.frames.length, 1, "There should be an iframe.");
+      await content.SpecialPowers.spawn(frame, [], () => {
+        let child = content.getWindowGlobalChild();
+        Assert.throws(
+          () => child.getActor("Test"),
+          /NS_ERROR_NOT_AVAILABLE/,
+          "Should throw if it doesn't match."
+        );
+      });
     });
   },
 });
 
 declTest("getActor with remoteType match", {
   remoteTypes: ["web"],
 
   async test(browser) {
     let parent = browser.browsingContext.currentWindowGlobal;
     ok(parent.getActor("Test"), "JSWindowActorParent should have value.");
 
     await ContentTask.spawn(browser, {}, async function() {
-      let child = content.window.getWindowGlobalChild();
+      let child = content.getWindowGlobalChild();
       ok(child, "WindowGlobalChild should have value.");
       ok(child.getActor("Test"), "JSWindowActorChild should have value.");
     });
   },
 });
 
 declTest("getActor with remoteType mismatch", {
   remoteTypes: ["privilegedabout"],
@@ -108,17 +115,17 @@ declTest("getActor with remoteType misma
     let parent = browser.browsingContext.currentWindowGlobal;
     Assert.throws(
       () => parent.getActor("Test"),
       /NS_ERROR_NOT_AVAILABLE/,
       "Should throw if its remoteTypes don't match."
     );
 
     await ContentTask.spawn(browser, {}, async function() {
-      let child = content.window.getWindowGlobalChild();
+      let child = content.getWindowGlobalChild();
       ok(child, "WindowGlobalChild should have value.");
       Assert.throws(
         () => child.getActor("Test"),
         /NS_ERROR_NOT_AVAILABLE/,
         "Should throw if its remoteTypes don't match."
       );
     });
   },
@@ -127,18 +134,18 @@ declTest("getActor with remoteType misma
 declTest("getActor without allFrames", {
   allFrames: false,
 
   async test(browser) {
     await ContentTask.spawn(browser, {}, async function() {
       // Create and append an iframe into the window's document.
       let frame = content.document.createElement("iframe");
       content.document.body.appendChild(frame);
-      is(content.window.frames.length, 1, "There should be an iframe.");
-      let child = frame.contentWindow.window.getWindowGlobalChild();
+      is(content.frames.length, 1, "There should be an iframe.");
+      let child = frame.contentWindow.getWindowGlobalChild();
       Assert.throws(
         () => child.getActor("Test"),
         /NS_ERROR_NOT_AVAILABLE/,
         "Should throw if allFrames is false."
       );
     });
   },
 });
@@ -146,18 +153,18 @@ declTest("getActor without allFrames", {
 declTest("getActor with allFrames", {
   allFrames: true,
 
   async test(browser) {
     await ContentTask.spawn(browser, {}, async function() {
       // Create and append an iframe into the window's document.
       let frame = content.document.createElement("iframe");
       content.document.body.appendChild(frame);
-      is(content.window.frames.length, 1, "There should be an iframe.");
-      let child = frame.contentWindow.window.getWindowGlobalChild();
+      is(content.frames.length, 1, "There should be an iframe.");
+      let child = frame.contentWindow.getWindowGlobalChild();
       let actorChild = child.getActor("Test");
       ok(actorChild, "JSWindowActorChild should have value.");
     });
   },
 });
 
 declTest("getActor without includeChrome", {
   includeChrome: false,
--- a/testing/specialpowers/content/SpecialPowersChild.jsm
+++ b/testing/specialpowers/content/SpecialPowersChild.jsm
@@ -282,22 +282,17 @@ class SpecialPowersChild extends JSWindo
 
       case "Assert":
         {
           // An assertion has been done in a mochitest chrome script
           let { name, passed, stack, diag } = message.data;
 
           let { SimpleTest } = this;
           if (SimpleTest) {
-            SimpleTest.record(
-              passed,
-              name,
-              diag,
-              stack && stack.formattedStack
-            );
+            SimpleTest.record(passed, name, diag, stack);
           } else {
             // Well, this is unexpected.
             dump(name + "\n");
           }
         }
         break;
     }
     return undefined;
--- a/testing/specialpowers/content/SpecialPowersSandbox.jsm
+++ b/testing/specialpowers/content/SpecialPowersSandbox.jsm
@@ -63,17 +63,22 @@ class SpecialPowersSandbox {
   report(err, name, stack) {
     let diag;
     if (err) {
       diag =
         `got ${uneval(err.actual)}, expected ${uneval(err.expected)} ` +
         `(operator ${err.operator})`;
     }
 
-    this.reportCallback({ name, diag, passed: !err, stack });
+    this.reportCallback({
+      name,
+      diag,
+      passed: !err,
+      stack: stack && stack.formattedStack,
+    });
   }
 
   execute(task, args, caller) {
     let func = Cu.evalInSandbox(
       `(${task})`,
       this.sandbox,
       undefined,
       caller.filename,