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
This commit is contained in:
David Teller 2020-03-03 21:16:00 +00:00
Родитель 28e34497c9
Коммит e251bcf21f
3 изменённых файлов: 35 добавлений и 1 удалений

Просмотреть файл

@ -5,3 +5,7 @@ support-files =
[test_process_error.xhtml]
skip-if = !crashreporter
[test_process_error_oom.xhtml]
skip-if = !crashreporter

Просмотреть файл

@ -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);
});

Просмотреть файл

@ -0,0 +1,22 @@
<?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>