diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 873f613eebc4..130eb1509627 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1695,10 +1695,6 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) { dumpID = mCrashReporter->MinidumpID(); } props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID); - - // Propagate `isLikelyOOM`. - Unused << props->SetPropertyAsBool(NS_LITERAL_STRING("isLikelyOOM"), - mCrashReporter->IsLikelyOOM()); } else { CrashReporter::FinalizeOrphanedMinidump(OtherPid(), GeckoProcessType_Content); diff --git a/dom/ipc/tests/chrome.ini b/dom/ipc/tests/chrome.ini index cede4d919290..e24ad5028145 100644 --- a/dom/ipc/tests/chrome.ini +++ b/dom/ipc/tests/chrome.ini @@ -5,6 +5,3 @@ support-files = [test_process_error.xhtml] skip-if = !crashreporter || (webrender && os == 'linux' && bits == 64 && debug) # bug 1544147 - -[test_process_error_oom.xul] -skip-if = !crashreporter || (webrender && os == 'linux' && bits == 64 && debug) # bug 1544147 diff --git a/dom/ipc/tests/process_error.xhtml b/dom/ipc/tests/process_error.xhtml index a017508b9482..a074f33b6def 100644 --- a/dom/ipc/tests/process_error.xhtml +++ b/dom/ipc/tests/process_error.xhtml @@ -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); }); diff --git a/dom/ipc/tests/test_process_error_oom.xul b/dom/ipc/tests/test_process_error_oom.xul deleted file mode 100644 index ee537122b9e4..000000000000 --- a/dom/ipc/tests/test_process_error_oom.xul +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - diff --git a/ipc/glue/CrashReporterHost.cpp b/ipc/glue/CrashReporterHost.cpp index cc6b8fc16734..fee0c9d68698 100644 --- a/ipc/glue/CrashReporterHost.cpp +++ b/ipc/glue/CrashReporterHost.cpp @@ -8,7 +8,6 @@ #include "CrashReporterMetadataShmem.h" #include "mozilla/dom/Promise.h" #include "mozilla/recordreplay/ParentIPC.h" -#include "mozilla/EnumeratedRange.h" #include "mozilla/Sprintf.h" #include "mozilla/SyncRunnable.h" #include "mozilla/Telemetry.h" @@ -229,21 +228,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 (mExtraAnnotations[CrashReporter::Annotation::OOMAllocationSize].Length() > - 0) { - // 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 true; - } - return false; -} - } // namespace ipc } // namespace mozilla diff --git a/ipc/glue/CrashReporterHost.h b/ipc/glue/CrashReporterHost.h index ef88cd081e5d..5f14ce40532b 100644 --- a/ipc/glue/CrashReporterHost.h +++ b/ipc/glue/CrashReporterHost.h @@ -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(); - private: static void AsyncAddCrash(int32_t aProcessType, int32_t aCrashType, const nsString& aChildDumpID); diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm index 23d226f538e6..4c338f5f08b1 100644 --- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm +++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm @@ -1629,10 +1629,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 @@ -1642,8 +1638,7 @@ var BrowserTestUtils = { browser, shouldShowTabCrashPage = true, shouldClearMinidumps = true, - browsingContext, - options = {} + browsingContext ) { let extra = {}; let KeyValueParser = {}; @@ -1781,9 +1776,7 @@ var BrowserTestUtils = { this.sendAsyncMessage( browsingContext || browser.browsingContext, "BrowserTestUtils:CrashFrame", - { - crashType: options.crashType || "", - } + {} ); await Promise.all(expectedPromises); diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm index 1c0b4017bdd2..6e307e0fb350 100644 --- a/testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm +++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm @@ -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,38 +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" - ); - let libxul = ctypes.open(OS.Constants.Path.libxul); - let moz_xmalloc = libxul.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");