Bug 773892 - Part 1: Add crash submission when starting b2g. r=ted
authorHub Figuière <hfiguiere@mozilla.com>
Wed, 18 Jul 2012 14:40:24 -0700
changeset 100778 64d7f92c3029ac265828302cd0b97a94e509349c
parent 100777 74c9c20b284a1ec7ee5d6152b89396b25613017c
child 100779 853e5839a8afd76ba0ed8b0ea9c0b3f3ff28e6c8
push id23193
push userryanvm@gmail.com
push dateSat, 28 Jul 2012 21:54:39 +0000
treeherdermozilla-central@29bff59d3bbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs773892
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 773892 - Part 1: Add crash submission when starting b2g. r=ted
b2g/app/b2g.js
b2g/chrome/content/shell.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -193,16 +193,18 @@ pref("dom.ipc.plugins.enabled", true);
 pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
 pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/b2g/%VERSION%/releasenotes/");
 pref("app.support.baseURL", "http://support.mozilla.com/b2g");
 pref("app.feedbackURL", "http://input.mozilla.com/feedback/");
 pref("app.privacyURL", "http://www.mozilla.com/%LOCALE%/m/privacy.html");
 pref("app.creditsURL", "http://www.mozilla.org/credits/");
 pref("app.featuresURL", "http://www.mozilla.com/%LOCALE%/b2g/features/");
 pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/b2g/faq/");
+// Whether we want to report crashes (headless)
+pref("app.reportCrashes", true);
 
 // Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
 pref("security.alternate_certificate_error_page", "certerror");
 
 pref("security.warn_viewing_mixed", false); // Warning is disabled.  See Bug 616712.
 
 // Override some named colors to avoid inverse OS themes
 pref("ui.-moz-dialog", "#efebe7");
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -69,16 +69,32 @@ function addPermissions(urls) {
       permissions.forEach(function(permission) {
         Services.perms.add(uri, permission, allow);
       });
     }
   });
 }
 
 var shell = {
+
+  get CrashSubmit() {
+    delete this.CrashSubmit;
+    Cu.import("resource://gre/modules/CrashSubmit.jsm", this);
+    return this.CrashSubmit;
+  },
+
+  reportCrash: function shell_reportCrash() {
+    let crashID = Cc["@mozilla.org/xre/app-info;1"]
+      .getService(Ci.nsIXULRuntime).lastRunCrashID;
+    if (Services.prefs.getBoolPref('app.reportCrashes') &&
+        crashID) {
+      this.CrashSubmit().submit(crashID)
+    }
+  },
+
   get contentBrowser() {
     delete this.contentBrowser;
     return this.contentBrowser = document.getElementById('homescreen');
   },
 
   get homeURL() {
     try {
       let homeSrc = Services.env.get('B2G_HOMESCREEN');
@@ -265,16 +281,18 @@ var shell = {
         }
         break;
       case 'mozbrowserloadstart':
         if (content.document.location == 'about:blank')
           return;
 
         this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
 
+        this.reportCrash();
+
         let chromeWindow = window.QueryInterface(Ci.nsIDOMChromeWindow);
         chromeWindow.browserDOMWindow = new nsBrowserAccess();
 
         this.sendEvent(window, 'ContentStart');
         break;
       case 'MozApplicationManifest':
         try {
           if (!Services.prefs.getBoolPref('browser.cache.offline.enable'))