Bug 1355492 - initialize ContentCrashHandlers.jsm after first paint, r=mconley.
authorFlorian Quèze <florian@queze.net>
Sat, 15 Jul 2017 00:16:31 +0200
changeset 369067 67205d8212f10e2e174214188f23f27833eb637f
parent 369066 42dd3838b575717643ecb7e7a0e81d8616edb7df
child 369068 d036fd0fef6b79c39f2a832bb3cf9436bc7b22a4
push id32182
push userarchaeopteryx@coole-files.de
push dateSat, 15 Jul 2017 14:35:04 +0000
treeherdermozilla-central@33d3192ed9eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1355492
milestone56.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 1355492 - initialize ContentCrashHandlers.jsm after first paint, r=mconley.
browser/base/content/test/performance/browser_startup.js
browser/components/nsBrowserGlue.js
browser/modules/ContentCrashHandlers.jsm
--- a/browser/base/content/test/performance/browser_startup.js
+++ b/browser/base/content/test/performance/browser_startup.js
@@ -62,16 +62,17 @@ const startupPhases = {
     components: new Set([
       "UnifiedComplete.js",
       "nsSearchService.js",
     ]),
     modules: new Set([
       "resource:///modules/AboutNewTab.jsm",
       "resource:///modules/BrowserUITelemetry.jsm",
       "resource:///modules/BrowserUsageTelemetry.jsm",
+      "resource:///modules/ContentCrashHandlers.jsm",
       "resource:///modules/DirectoryLinksProvider.jsm",
       "resource://gre/modules/NewTabUtils.jsm",
       "resource://gre/modules/PageThumbs.jsm",
       "resource://gre/modules/Promise.jsm", // imported by devtools during _delayedStartup
     ]),
     services: new Set([
       "@mozilla.org/browser/search-service;1",
     ])
@@ -88,16 +89,17 @@ const startupPhases = {
     ]),
     modules: new Set([
       "chrome://webcompat-reporter/content/TabListener.jsm",
       "chrome://webcompat-reporter/content/WebCompatReporter.jsm",
       "resource:///modules/RecentWindow.jsm",
       "resource://gre/modules/BookmarkHTMLUtils.jsm",
       "resource://gre/modules/Bookmarks.jsm",
       "resource://gre/modules/ContextualIdentityService.jsm",
+      "resource://gre/modules/CrashSubmit.jsm",
       "resource://gre/modules/FxAccounts.jsm",
       "resource://gre/modules/FxAccountsStorage.jsm",
       "resource://gre/modules/PlacesSyncUtils.jsm",
       "resource://gre/modules/Sqlite.jsm",
     ]),
     services: new Set([
       "@mozilla.org/browser/annotation-service;1",
       "@mozilla.org/browser/favicon-service;1",
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -634,22 +634,16 @@ BrowserGlue.prototype = {
         headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
         iconURL: "resource:///chrome/browser/content/browser/defaultthemes/compactdark.icon.svg",
         textcolor: "white",
         accentcolor: "black",
         author: vendorShortName,
       });
     }
 
-    TabCrashHandler.init();
-    if (AppConstants.MOZ_CRASHREPORTER) {
-      PluginCrashReporter.init();
-      UnsubmittedCrashHandler.init();
-    }
-
     Services.obs.notifyObservers(null, "browser-ui-startup-complete");
   },
 
   _checkForOldBuildUpdates() {
     // check for update if our build is old
     if (AppConstants.MOZ_UPDATER &&
         Services.prefs.getBoolPref("app.update.enabled") &&
         Services.prefs.getBoolPref("app.update.checkInstallTime")) {
@@ -898,16 +892,21 @@ BrowserGlue.prototype = {
       if (WINTASKBAR_CONTRACTID in Cc &&
           Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available) {
         let temp = {};
         Cu.import("resource:///modules/WindowsJumpLists.jsm", temp);
         temp.WinTaskbarJumpList.startup();
       }
     }
 
+    TabCrashHandler.init();
+    if (AppConstants.MOZ_CRASHREPORTER) {
+      PluginCrashReporter.init();
+    }
+
     ProcessHangMonitor.init();
 
     // A channel for "remote troubleshooting" code...
     let channel = new WebChannel("remote-troubleshooting", "remote-troubleshooting");
     channel.listen((id, data, target) => {
       if (data.command == "request") {
         let {Troubleshoot} = Cu.import("resource://gre/modules/Troubleshoot.jsm", {});
         Troubleshoot.snapshot(snapshotData => {
@@ -1165,16 +1164,23 @@ BrowserGlue.prototype = {
 
       if (willPrompt) {
         Services.tm.dispatchToMainThread(function() {
           DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
         });
       }
     }
 
+    if (AppConstants.MOZ_CRASHREPORTER) {
+      UnsubmittedCrashHandler.init();
+      Services.tm.idleDispatchToMainThread(function() {
+        UnsubmittedCrashHandler.checkForUnsubmittedCrashReports();
+      });
+    }
+
     // Let's load the contextual identities.
     Services.tm.idleDispatchToMainThread(() => {
       ContextualIdentityService.load();
     });
 
     this._sanitizer.onStartup();
     E10SAccessibilityCheck.onWindowsRestored();
   },
--- a/browser/modules/ContentCrashHandlers.jsm
+++ b/browser/modules/ContentCrashHandlers.jsm
@@ -572,17 +572,16 @@ this.UnsubmittedCrashHandler = {
           this.suppressed = true;
           return;
         }
 
         // We're done suppressing, so we don't need this pref anymore.
         this.prefs.clearUserPref("suppressUntilDate");
       }
 
-      Services.obs.addObserver(this, "browser-delayed-startup-finished");
       Services.obs.addObserver(this, "profile-before-change");
     }
   },
 
   uninit() {
     if (!this.initialized) {
       return;
     }
@@ -599,36 +598,21 @@ this.UnsubmittedCrashHandler = {
       return;
     }
 
     if (this.showingNotification) {
       this.prefs.setBoolPref("shutdownWhileShowing", true);
       this.showingNotification = false;
     }
 
-    try {
-      Services.obs.removeObserver(this, "browser-delayed-startup-finished");
-    } catch (e) {
-      // The browser-delayed-startup-finished observer might have already
-      // fired and removed itself, so if this fails, it's okay.
-      if (e.result != Cr.NS_ERROR_FAILURE) {
-        throw e;
-      }
-    }
-
     Services.obs.removeObserver(this, "profile-before-change");
   },
 
   observe(subject, topic, data) {
     switch (topic) {
-      case "browser-delayed-startup-finished": {
-        Services.obs.removeObserver(this, topic);
-        this.checkForUnsubmittedCrashReports();
-        break;
-      }
       case "profile-before-change": {
         this.uninit();
         break;
       }
     }
   },
 
   /**