Bug 1038068: Always log errors from saving the extensions database. r=dveditz
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 23 Apr 2015 14:43:37 -0700
changeset 241133 ebc84b792237ffe7ee2fb9640e8f3b6e37364783
parent 241132 137707995d3ad1b357e2f7795ac2b30e60b77a06
child 241134 1cfe7aee45084049b9dc9c55c424f0665d27f154
push id28653
push usercbook@mozilla.com
push dateMon, 27 Apr 2015 10:34:32 +0000
treeherdermozilla-central@9c22b105b0e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdveditz
bugs1038068
milestone40.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 1038068: Always log errors from saving the extensions database. r=dveditz
toolkit/mozapps/extensions/internal/XPIProviderUtils.js
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -434,34 +434,39 @@ this.XPIDatabase = {
       this._deferredSave = new DeferredSave(this.jsonFile.path,
                                             () => JSON.stringify(this),
                                             ASYNC_SAVE_DELAY_MS);
     }
 
     let promise = this._deferredSave.saveChanges();
     if (!this._schemaVersionSet) {
       this._schemaVersionSet = true;
-      promise.then(
+      promise = promise.then(
         count => {
           // Update the XPIDB schema version preference the first time we successfully
           // save the database.
           logger.debug("XPI Database saved, setting schema version preference to " + DB_SCHEMA);
           Services.prefs.setIntPref(PREF_DB_SCHEMA, DB_SCHEMA);
           // Reading the DB worked once, so we don't need the load error
           this._loadError = null;
         },
         error => {
           // Need to try setting the schema version again later
           this._schemaVersionSet = false;
-          logger.warn("Failed to save XPI database", error);
           // this._deferredSave.lastError has the most recent error so we don't
           // need this any more
           this._loadError = null;
+
+          throw error;
         });
     }
+
+    promise.catch(error => {
+      logger.warn("Failed to save XPI database", error);
+    });
   },
 
   flush: function() {
     // handle the "in memory only" and "saveChanges never called" cases
     if (!this._deferredSave) {
       return Promise.resolve(0);
     }