Commits

Anonymous committed 3fca49e Draft

Bug 777185 - Hookup content process crash reporting. r=fabrice

  • Participants
  • Parent commits 48557b9

Comments (0)

Files changed (1)

File b2g/chrome/content/shell.js

     return this.CrashSubmit;
   },
 
-  reportCrash: function shell_reportCrash() {
-    let crashID;
+  reportCrash: function shell_reportCrash(aCrashID) {
+    let crashID = aCrashID;
     try {
-      crashID = Cc["@mozilla.org/xre/app-info;1"]
-                .getService(Ci.nsIXULRuntime).lastRunCrashID;
+      if (crashID == undefined || crashID == "")
+        crashID = Cc["@mozilla.org/xre/app-info;1"]
+                    .getService(Ci.nsIXULRuntime).lastRunCrashID;
     } catch(e) { }
     if (Services.prefs.getBoolPref('app.reportCrashes') &&
         crashID) {
   });
 });
 
+(function contentCrashTracker() {
+  Services.obs.addObserver(function(aSubject, aTopic, aData) {
+      let cs = Cc["@mozilla.org/consoleservice;1"]
+                 .getService(Ci.nsIConsoleService);
+      let props = aSubject.QueryInterface(Ci.nsIPropertyBag2);
+      if (props.hasKey("abnormal") && props.hasKey("dumpID")) {
+        shell.reportCrash(props.getProperty("dumpID"));
+      }
+    },
+    "ipc:content-shutdown", false);
+})();
+
 (function geolocationStatusTracker() {
   let gGeolocationActiveCount = 0;