Bug 1017706 - Make sure that healthreporter.jsm always initiates shutdown, even if it never receives quit-application. r=gps
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Mon, 09 Jun 2014 12:07:00 -0400
changeset 187636 330b60fb2530
parent 187635 1be1b85f1ab1
child 187637 708e8dddc9a4
push id44643
push userryanvm@gmail.com
push date2014-06-09 19:29 +0000
treeherdermozilla-inbound@708e8dddc9a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1017706
milestone32.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 1017706 - Make sure that healthreporter.jsm always initiates shutdown, even if it never receives quit-application. r=gps
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();