Bug 1605209 - Testing JSWindowActor crash annotations;r=gsvelto
☠☠ backed out by 6daca7282599 ☠ ☠
authorDavid Teller <dteller@mozilla.com>
Thu, 16 Apr 2020 08:05:45 +0000
changeset 524568 e0e6dbf1d48da58434c44c3a218a46635e95c6b9
parent 524567 289f5bbac1ae08e5e1885de44ad85922258b3122
child 524569 d81b566ad94f0dc3dca206a8b3556b631ef7ec42
push id37323
push userdluca@mozilla.com
push dateFri, 17 Apr 2020 16:25:55 +0000
treeherdermozilla-central@b4b1d6f91ef0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgsvelto
bugs1605209
milestone77.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 1605209 - Testing JSWindowActor crash annotations;r=gsvelto Differential Revision: https://phabricator.services.mozilla.com/D70175
dom/ipc/tests/JSWindowActor/browser.ini
dom/ipc/tests/JSWindowActor/browser_crash_report.js
--- a/dom/ipc/tests/JSWindowActor/browser.ini
+++ b/dom/ipc/tests/JSWindowActor/browser.ini
@@ -1,12 +1,13 @@
 [DEFAULT]
 support-files =
   head.js
 
+[browser_crash_report.js]
 [browser_destroy_callbacks.js]
 [browser_event_listener.js]
 [browser_getActor.js]
 [browser_getActor_filter.js]
 [browser_observer_notification.js]
 support-files=
   file_mediaPlayback.html
   audio.ogg
new file mode 100644
--- /dev/null
+++ b/dom/ipc/tests/JSWindowActor/browser_crash_report.js
@@ -0,0 +1,104 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict";
+
+declTest("crash actor", {
+  allFrames: true,
+
+  async test(browser) {
+    if (!("@mozilla.org/toolkit/crash-reporter;1" in Cc)) {
+      info("Cannot test crash annotations without a crash reporter");
+      return;
+    }
+
+    {
+      info("Creating a new tab.");
+      let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+      let newTabBrowser = newTab.linkedBrowser;
+
+      let parent = newTabBrowser.browsingContext.currentWindowGlobal.getActor(
+        "Test"
+      );
+      ok(parent, "JSWindowActorParent should have value.");
+
+      await SpecialPowers.spawn(newTabBrowser, [], async function() {
+        let child = content.windowGlobalChild;
+        ok(child, "WindowGlobalChild should have value.");
+        is(
+          child.isInProcess,
+          false,
+          "Actor should be loaded in the content process."
+        );
+        // Make sure that the actor is loaded.
+        let actorChild = child.getActor("Test");
+        is(actorChild.show(), "TestChild", "actor show should have value.");
+        is(
+          actorChild.manager,
+          child,
+          "manager should match WindowGlobalChild."
+        );
+      });
+
+      info(
+        "Crashing from withing an actor. We should have an actor name and a message name."
+      );
+      let report = await BrowserTestUtils.crashFrame(
+        newTabBrowser,
+        /* shouldShowTabCrashPage = */ false,
+        /* shouldClearMinidumps =  */ true,
+        /* browsingContext = */ null,
+        { asyncCrash: false }
+      );
+
+      is(report.JSActorName, "BrowserTestUtils");
+      is(report.JSActorMessage, "BrowserTestUtils:CrashFrame");
+
+      BrowserTestUtils.removeTab(newTab);
+    }
+
+    {
+      info("Creating a new tab for async crash");
+      let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
+      let newTabBrowser = newTab.linkedBrowser;
+
+      let parent = newTabBrowser.browsingContext.currentWindowGlobal.getActor(
+        "Test"
+      );
+      ok(parent, "JSWindowActorParent should have value.");
+
+      await SpecialPowers.spawn(newTabBrowser, [], async function() {
+        let child = content.windowGlobalChild;
+        ok(child, "WindowGlobalChild should have value.");
+        is(
+          child.isInProcess,
+          false,
+          "Actor should be loaded in the content process."
+        );
+        // Make sure that the actor is loaded.
+        let actorChild = child.getActor("Test");
+        is(actorChild.show(), "TestChild", "actor show should have value.");
+        is(
+          actorChild.manager,
+          child,
+          "manager should match WindowGlobalChild."
+        );
+      });
+
+      info(
+        "Crashing from without an actor. We should have neither an actor name nor a message name."
+      );
+      let report = await BrowserTestUtils.crashFrame(
+        newTabBrowser,
+        /* shouldShowTabCrashPage = */ false,
+        /* shouldClearMinidumps =  */ true,
+        /* browsingContext = */ null,
+        { asyncCrash: true }
+      );
+
+      is(report.JSActorName, null);
+      is(report.JSActorMessage, null);
+
+      BrowserTestUtils.removeTab(newTab);
+    }
+  },
+});