Commit e251bcf2 authored by David Teller's avatar David Teller
Browse files

Bug 1589493 - Testing ipc:content-shutdown's support for isLikelyOOM;r=gsvelto

Depends on D54700

Differential Revision: https://phabricator.services.mozilla.com/D54702

--HG--
extra : moz-landing-system : lando
parent 28e34497
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -5,3 +5,7 @@ support-files =

[test_process_error.xhtml]
skip-if = !crashreporter


[test_process_error_oom.xhtml]
skip-if = !crashreporter
+9 −1
Original line number Diff line number Diff line
@@ -14,6 +14,10 @@
    const done = window.arguments[0].done;
    const SimpleTest = window.arguments[0].SimpleTest;

    // Parse test options.
    const url = new URL(document.location);
    const crashType = url.searchParams.get("crashType");

    // Allow the browser to get connected before using the messageManager to cause
    // a crash:
    addEventListener("DOMContentLoaded", () => {
@@ -29,6 +33,10 @@
          if ('nsICrashReporter' in Ci) {
            dumpID = subject.getPropertyAsAString('dumpID');
            ok(dumpID, "dumpID is present and not an empty string");

            // Let's check whether we have correctly reported OOM.
            var isLikelyOOM = subject.getPropertyAsBool('isLikelyOOM');
            is(isLikelyOOM, crashType == 'CRASH_OOM', 'isLikelyOOM is correct');
          }

          Services.obs.removeObserver(crashObserver, 'ipc:content-shutdown');
@@ -46,7 +54,7 @@
           "Expected the right browsing context id on the oop-browser-crashed event.");
      })

      BrowserTestUtils.crashFrame(browser, true, false);
      BrowserTestUtils.crashFrame(browser, true, false, /* Default browsing context */ null, { crashType });

      Promise.all([observerPromise, eventPromise]).then(done);
    });
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />

  <script>
  SimpleTest.waitForExplicitFinish();
  SimpleTest.expectChildProcessCrash();

  var w = window.docShell.rootTreeItem.domWindow.openDialog('process_error.xhtml?crashType=CRASH_OOM', '_blank', 'chrome,resizable=yes,width=400,height=600', window);

  function done()
  {
    w.close();
    SimpleTest.finish();
  }
  </script>

  <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;" />
</window>