Bug 1068962 - Fix task cleanup on settings locks where finalize has already been called; r=bent
authorKyle Machulis <kyle@nonpolynomial.com>
Thu, 18 Sep 2014 13:43:40 -0700
changeset 206100 2d5de8b63f6963154c52791c2023635b234c8dc8
parent 206099 0ad56fef7fb28017906c1ad1d3a18c08ecc20504
child 206101 b030bb382b31903cbf8d20e2f598b414c6daaeca
push id27512
push usercbook@mozilla.com
push dateFri, 19 Sep 2014 12:07:02 +0000
treeherdermozilla-central@c8dee1c9cc3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs1068962
milestone35.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 1068962 - Fix task cleanup on settings locks where finalize has already been called; r=bent
dom/settings/SettingsRequestManager.jsm
--- a/dom/settings/SettingsRequestManager.jsm
+++ b/dom/settings/SettingsRequestManager.jsm
@@ -575,19 +575,21 @@ let SettingsRequestManager = {
       if (DEBUG) debug("Lock no longer alive, cannot run tasks");
       return;
     }
     let currentTask = lock.tasks.shift();
     let promises = [];
     while (currentTask) {
       if (DEBUG) debug("Running Operation " + currentTask.operation);
       if (lock.finalizing) {
+        // We should really never get to this point, but if we do,
+        // fail every task that happens.
         Cu.reportError("Settings lock trying to run more tasks after finalizing. Ignoring tasks, but this is bad. Lock: " + aLockID);
-        continue;
-      }
+        currentTask.defer.reject("Cannot call new task after finalizing");
+      } else {
       let p;
       switch (currentTask.operation) {
         case "get":
           p = this.taskGet(currentTask);
           break;
         case "set":
           p = this.taskSet(currentTask);
           break;
@@ -602,16 +604,17 @@ let SettingsRequestManager = {
           p.reject("Invalid operation: " + currentTask.operation);
       }
       p.then(function(ret) {
         ret.task.defer.resolve("results" in ret ? ret.results : null);
       }.bind(currentTask), function(ret) {
         ret.task.defer.reject(ret.error);
       });
       promises.push(p);
+      }
       currentTask = lock.tasks.shift();
     }
   },
 
   consumeTasks: function() {
     if (this.settingsLockQueue.length == 0) {
       if (DEBUG) debug("Nothing to run!");
       return;