зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1589493) for causing failures in test_process_error_oom.xhtml
CLOSED TREE Backed out changeset d914e968de2c (bug 1589493) Backed out changeset 2c23fed6b2ff (bug 1589493) Backed out changeset 416b95911b6d (bug 1589493) Backed out changeset 47e745b389d0 (bug 1589493)
This commit is contained in:
Родитель
3ad6458b99
Коммит
f049ee5a93
|
@ -1717,11 +1717,7 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) {
|
|||
// if mCreatedPairedMinidumps is true, we've already generated
|
||||
// parent/child dumps for desktop crashes.
|
||||
if (!mCreatedPairedMinidumps) {
|
||||
if (mCrashReporter->GenerateCrashReport(OtherPid())) {
|
||||
// Propagate `isLikelyOOM`.
|
||||
Unused << props->SetPropertyAsBool(NS_LITERAL_STRING("isLikelyOOM"),
|
||||
mCrashReporter->IsLikelyOOM());
|
||||
}
|
||||
mCrashReporter->GenerateCrashReport(OtherPid());
|
||||
}
|
||||
|
||||
if (mCrashReporter->HasMinidump()) {
|
||||
|
|
|
@ -5,7 +5,3 @@ support-files =
|
|||
|
||||
[test_process_error.xhtml]
|
||||
skip-if = !crashreporter
|
||||
|
||||
|
||||
[test_process_error_oom.xhtml]
|
||||
skip-if = !crashreporter
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
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", () => {
|
||||
|
@ -33,10 +29,6 @@
|
|||
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');
|
||||
|
@ -54,7 +46,7 @@
|
|||
"Expected the right browsing context id on the oop-browser-crashed event.");
|
||||
})
|
||||
|
||||
BrowserTestUtils.crashFrame(browser, true, false, /* Default browsing context */ null, { crashType });
|
||||
BrowserTestUtils.crashFrame(browser, true, false);
|
||||
|
||||
Promise.all([observerPromise, eventPromise]).then(done);
|
||||
});
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
<?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>
|
|
@ -235,19 +235,5 @@ void CrashReporterHost::AddAnnotation(CrashReporter::Annotation aKey,
|
|||
mExtraAnnotations[aKey] = aValue;
|
||||
}
|
||||
|
||||
bool CrashReporterHost::IsLikelyOOM() {
|
||||
// The data is only populated during the call to `FinalizeCrashReport()`.
|
||||
MOZ_ASSERT(mFinalized);
|
||||
|
||||
// If `OOMAllocationSize` was set, we know that the crash happened
|
||||
// because an allocation failed (`malloc` returned `nullptr`).
|
||||
//
|
||||
// As Unix systems generally allow `malloc` to return a non-null value
|
||||
// even when no virtual memory is available, this doesn't cover all
|
||||
// cases of OOM under Unix (far from it).
|
||||
return mExtraAnnotations[CrashReporter::Annotation::OOMAllocationSize]
|
||||
.Length() > 0;
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -94,14 +94,6 @@ class CrashReporterHost {
|
|||
return mExtraAnnotations[CrashReporter::Annotation::additional_minidumps];
|
||||
}
|
||||
|
||||
// Return `true` if this crash reporter has been identified as a likely OOM.
|
||||
//
|
||||
// At the time of this writing, OOMs detection is considered reliable under
|
||||
// Windows but other platforms quite often return false negatives.
|
||||
//
|
||||
// `CrashReporterHost::FinalizeCrashReport()` MUST have been called already.
|
||||
bool IsLikelyOOM();
|
||||
|
||||
// This is a static helper function to notify the crash service that a
|
||||
// crash has occurred and record the crash with telemetry. This can be called
|
||||
// from any thread, and if not called from the main thread, will post a
|
||||
|
|
|
@ -1628,10 +1628,6 @@ var BrowserTestUtils = {
|
|||
* @param (BrowsingContext) browsingContext
|
||||
* The context where the frame leaves. Default to
|
||||
* top level context if not supplied.
|
||||
* @param (object?) options
|
||||
* An object with any of the following fields:
|
||||
* crashType: "CRASH_INVALID_POINTER_DEREF" | "CRASH_OOM"
|
||||
* The type of crash. If unspecified, default to "CRASH_INVALID_POINTER_DEREF"
|
||||
*
|
||||
* @returns (Promise)
|
||||
* @resolves An Object with key-value pairs representing the data from the
|
||||
|
@ -1641,8 +1637,7 @@ var BrowserTestUtils = {
|
|||
browser,
|
||||
shouldShowTabCrashPage = true,
|
||||
shouldClearMinidumps = true,
|
||||
browsingContext,
|
||||
options = {}
|
||||
browsingContext
|
||||
) {
|
||||
let extra = {};
|
||||
|
||||
|
@ -1777,9 +1772,7 @@ var BrowserTestUtils = {
|
|||
this.sendAsyncMessage(
|
||||
browsingContext || browser.browsingContext,
|
||||
"BrowserTestUtils:CrashFrame",
|
||||
{
|
||||
crashType: options.crashType || "",
|
||||
}
|
||||
{}
|
||||
);
|
||||
|
||||
await Promise.all(expectedPromises);
|
||||
|
|
|
@ -210,8 +210,8 @@ class BrowserTestUtilsChild extends JSWindowActorChild {
|
|||
|
||||
case "BrowserTestUtils:CrashFrame": {
|
||||
// This is to intentionally crash the frame.
|
||||
// We crash by using js-ctypes. The crash
|
||||
// should happen immediately
|
||||
// We crash by using js-ctypes and dereferencing
|
||||
// a bad pointer. The crash should happen immediately
|
||||
// upon loading this frame script.
|
||||
|
||||
const { ctypes } = ChromeUtils.import(
|
||||
|
@ -220,53 +220,9 @@ class BrowserTestUtilsChild extends JSWindowActorChild {
|
|||
|
||||
let dies = function() {
|
||||
ChromeUtils.privateNoteIntentionalCrash();
|
||||
|
||||
switch (aMessage.data.crashType) {
|
||||
case "CRASH_OOM": {
|
||||
// Allocate waaaaaay too much memory to encourage the system
|
||||
// to crash with an OOM.
|
||||
const OS = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
// Dynlink to moz_xmalloc, our implementation of malloc with
|
||||
// OOM checks. Depending on platform/configuration, this
|
||||
// symbol can be located in libxul or in mozglue.
|
||||
let moz_xmalloc;
|
||||
try {
|
||||
let lib = ctypes.open(OS.Constants.Path.libxul);
|
||||
moz_xmalloc = lib.declare(
|
||||
"moz_xmalloc",
|
||||
ctypes.default_abi,
|
||||
/* return type */ ctypes.voidptr_t,
|
||||
/* size */ ctypes.size_t
|
||||
);
|
||||
} catch (ex) {
|
||||
console.log("Cannot open libxul", ex);
|
||||
let lib = ctypes.open("mozglue");
|
||||
moz_xmalloc = lib.declare(
|
||||
"moz_xmalloc",
|
||||
ctypes.default_abi,
|
||||
/* return type */ ctypes.voidptr_t,
|
||||
/* size */ ctypes.size_t
|
||||
);
|
||||
}
|
||||
let max_value = ctypes.cast(ctypes.ssize_t(-1), ctypes.size_t);
|
||||
moz_xmalloc(max_value);
|
||||
moz_xmalloc(max_value);
|
||||
moz_xmalloc(max_value);
|
||||
break;
|
||||
}
|
||||
case "CRASH_INVALID_POINTER_DEREF": // Fallthrough
|
||||
default: {
|
||||
// Dereference a bad pointer.
|
||||
let zero = new ctypes.intptr_t(8);
|
||||
let badptr = ctypes.cast(
|
||||
zero,
|
||||
ctypes.PointerType(ctypes.int32_t)
|
||||
);
|
||||
badptr.contents;
|
||||
}
|
||||
}
|
||||
let zero = new ctypes.intptr_t(8);
|
||||
let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
|
||||
badptr.contents;
|
||||
};
|
||||
|
||||
dump("\nEt tu, Brute?\n");
|
||||
|
|
Загрузка…
Ссылка в новой задаче