Bug 1071721 - Call destroyDOMRequestHelper on SettingsLock after transaction ends; r=bent a=khuey
authorKyle Machulis <kyle@nonpolynomial.com>
Tue, 23 Sep 2014 13:16:56 -0700
changeset 225058 96e15bbed7ab4385a1a2e24e2339776b26dc6ddc
parent 225057 373b644d6c0ad6daf6dc0fd9311b5784ca979b30
child 225059 d614ae398c031b32dc11258734e20aca19e88fb8
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, khuey
bugs1071721
milestone34.0a2
Bug 1071721 - Call destroyDOMRequestHelper on SettingsLock after transaction ends; r=bent a=khuey
dom/settings/SettingsManager.js
--- a/dom/settings/SettingsManager.js
+++ b/dom/settings/SettingsManager.js
@@ -125,36 +125,43 @@ SettingsLock.prototype = {
     // our lock isn't being addressed, just return.
     if (msg.lockID != this._id) {
       return;
               }
     if (DEBUG) debug("receiveMessage (" + this._id + "): " + aMessage.name);
 
     // Finalizing a transaction does not return a request ID since we are
     // supposed to fire callbacks.
+    //
+    // We also destroy the DOMRequestHelper after we've received the
+    // finalize message. At this point, we will be guarenteed no more
+    // request returns are coming from the SettingsRequestManager.
+
     if (!msg.requestID) {
       let event;
       switch (aMessage.name) {
         case "Settings:Finalize:OK":
           if (DEBUG) debug("Lock finalize ok: " + this._id);
           event = new this._window.MozSettingsTransactionEvent("settingstransactionsuccess", {});
           this.__DOM_IMPL__.dispatchEvent(event);
+          this.destroyDOMRequestHelper();
           break;
         case "Settings:Finalize:KO":
           if (DEBUG) debug("Lock finalize failed: " + this._id);
           event = new this._window.MozSettingsTransactionEvent("settingstransactionfailure", {
             error: msg.errorMsg
           });
           this.__DOM_IMPL__.dispatchEvent(event);
+          this.destroyDOMRequestHelper();
           break;
         default:
           if (DEBUG) debug("Message type " + aMessage.name + " is missing a requestID");
-                }
-          return;
-            }
+      }
+      return;
+    }
 
 
     let req = this.getRequest(msg.requestID);
     if (!req) {
       if (DEBUG) debug("Matching request not found.");
       return;
             }
     this.removeRequest(msg.requestID);