Bug 1017706 - Make sure that healthreporter.jsm always initiates shutdown, even if it never receives quit-application. r=gps, a=lmandel
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Mon, 09 Jun 2014 12:07:00 -0400
changeset 208371 70d92047cc5dc0d740ecfbf89fbab127f804fb0f
parent 208370 87ea377ded69fb3478db257a15376975bf91f6f9
child 208372 b10a750d205d612353eed42b1d2e63d5e8a4a275
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, lmandel
bugs1017706
milestone32.0a2
Bug 1017706 - Make sure that healthreporter.jsm always initiates shutdown, even if it never receives quit-application. r=gps, a=lmandel
services/healthreport/healthreporter.jsm
--- a/services/healthreport/healthreporter.jsm
+++ b/services/healthreport/healthreporter.jsm
@@ -397,27 +397,35 @@ AbstractHealthReporter.prototype = Objec
 
       // As soon as we have could have storage, we need to register cleanup or
       // else bad things happen on shutdown.
       Services.obs.addObserver(this, "quit-application", false);
 
       // The database needs to be shut down by the end of shutdown
       // phase profileBeforeChange.
       Metrics.Storage.shutdown.addBlocker("FHR: Flushing storage shutdown",
-        this._promiseShutdown,
+        () => {
+          // Workaround bug 1017706
+          // Apparently, in some cases, quit-application is not triggered
+          // (or is triggered after profile-before-change), so we need to
+          // make sure that `_initiateShutdown()` is triggered at least
+          // once.
+          this._initiateShutdown();
+          return this._promiseShutdown;
+        },
         () => ({
             shutdownInitiated: this._shutdownInitiated,
             initialized: this._initialized,
             shutdownRequested: this._shutdownRequested,
             initializeHadError: this._initializeHadError,
             providerManagerInProgress: this._providerManagerInProgress,
             storageInProgress: this._storageInProgress,
             hasProviderManager: !!this._providerManager,
             hasStorage: !!this._storage,
-            shutdownComplete: this.shutdownComplete
+            shutdownComplete: this._shutdownComplete
           }));
 
       try {
         this._storageInProgress = true;
         TelemetryStopwatch.start(this._dbOpenHistogram, this);
         let storage = yield Metrics.Storage(this._dbName);
         TelemetryStopwatch.finish(this._dbOpenHistogram, this);
         yield this._onStorageCreated();