Bug 1457231 - Submit content process crash reports in GeckoView r=jchen
This will only be done if "native" crash reporting has been enabled in
the GeckoRuntimeSettings.
MozReview-Commit-ID: Kdm5mRye5zy
--- a/mobile/android/components/geckoview/GeckoViewStartup.js
+++ b/mobile/android/components/geckoview/GeckoViewStartup.js
@@ -52,16 +52,23 @@ GeckoViewStartup.prototype = {
});
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT) {
// Parent process only.
this.setResourceSubstitutions();
Services.mm.loadFrameScript(
"chrome://geckoview/content/GeckoViewPromptContent.js", true);
+
+ GeckoViewUtils.addLazyGetter(this, "ContentCrashHandler", {
+ module: "resource://gre/modules/ContentCrashHandler.jsm",
+ observers: [
+ "ipc:content-shutdown",
+ ]
+ });
}
break;
}
case "profile-after-change": {
// Parent process only.
// ContentPrefServiceParent is needed for e10s file picker.
GeckoViewUtils.addLazyGetter(this, "ContentPrefServiceParent", {
new file mode 100644
--- /dev/null
+++ b/mobile/android/modules/geckoview/ContentCrashHandler.jsm
@@ -0,0 +1,42 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+var EXPORTED_SYMBOLS = ["ContentCrashHandler"];
+
+ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
+
+XPCOMUtils.defineLazyModuleGetters(this, {
+ AppConstants: "resource://gre/modules/AppConstants.jsm",
+ CrashSubmit: "resource://gre/modules/CrashSubmit.jsm",
+ Services: "resource://gre/modules/Services.jsm"
+});
+
+GeckoViewUtils.initLogging("ContentCrashHandler", this);
+
+var ContentCrashHandler = {
+ // The event listener for this is hooked up in GeckoViewStartup.js
+ observe(aSubject, aTopic, aData) {
+ aSubject.QueryInterface(Ci.nsIPropertyBag2);
+
+ if (!aSubject.get("abnormal") || !AppConstants.MOZ_CRASHREPORTER) {
+ return;
+ }
+
+ let dumpID = aSubject.get("dumpID");
+ if (!dumpID) {
+ Services.telemetry
+ .getHistogramById("FX_CONTENT_CRASH_DUMP_UNAVAILABLE")
+ .add(1);
+ return;
+ }
+
+ debug `Submitting content process crash, dump ID ${dumpID}`;
+ CrashSubmit.submit(dumpID, {}).then(crashID => {
+ debug `Crash submission successful: ${crashID}`;
+ }, ChromeUtils.reportError);
+ }
+}
--- a/mobile/android/modules/geckoview/moz.build
+++ b/mobile/android/modules/geckoview/moz.build
@@ -1,16 +1,17 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXTRA_JS_MODULES += [
'AndroidLog.jsm',
+ 'ContentCrashHandler.jsm',
'GeckoViewAccessibility.jsm',
'GeckoViewContent.jsm',
'GeckoViewContentModule.jsm',
'GeckoViewModule.jsm',
'GeckoViewNavigation.jsm',
'GeckoViewProgress.jsm',
'GeckoViewRemoteDebugger.jsm',
'GeckoViewSettings.jsm',