Bug 906164 - Do NOT ack the received system message until being about to handle it. r=gene
authorHenry Chang <hchang@mozilla.com>
Thu, 03 Apr 2014 14:51:30 +0800
changeset 195777 f94df8c36ab31de0890cb3b37cd1431af7f8a784
parent 195776 beef4eb4485488438b17341968f800b34e7b2590
child 195778 6e1d2814d4dbf5a2db5d1e59797b62d0d0fdfce6
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgene
bugs906164
milestone31.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 906164 - Do NOT ack the received system message until being about to handle it. r=gene
dom/messages/SystemMessageManager.js
--- a/dom/messages/SystemMessageManager.js
+++ b/dom/messages/SystemMessageManager.js
@@ -212,33 +212,34 @@ SystemMessageManager.prototype = {
     if (msg.manifestURL !== this._manifestURL ||
         msg.pageURL !== this._pageURL) {
       debug("This page shouldn't handle the messages because its " +
             "manifest URL = " + this._manifestURL +
             " and page URL = " + this._pageURL);
       return;
     }
 
-    if (aMessage.name == "SystemMessageManager:Message") {
-      // Send an acknowledgement to parent to clean up the pending message,
-      // so a re-launched app won't handle it again, which is redundant.
-      cpmm.sendAsyncMessage("SystemMessageManager:Message:Return:OK",
-                            { type: msg.type,
-                              manifestURL: this._manifestURL,
-                              pageURL: this._pageURL,
-                              msgID: msg.msgID });
-    }
-
     let messages = (aMessage.name == "SystemMessageManager:Message")
                    ? [msg.msg]
                    : msg.msgQueue;
 
     // We only dispatch messages when a handler is registered.
     let dispatcher = this._dispatchers[msg.type];
     if (dispatcher) {
+      if (aMessage.name == "SystemMessageManager:Message") {
+        // Send an acknowledgement to parent to clean up the pending message
+        // before we dispatch the message to apps, so a re-launched app won't
+        // handle it again, which is redundant.
+        cpmm.sendAsyncMessage("SystemMessageManager:Message:Return:OK",
+                              { type: msg.type,
+                                manifest: this._manifest,
+                                uri: this._uri,
+                                msgID: msg.msgID });
+      }
+
       messages.forEach(function(aMsg) {
         this._dispatchMessage(msg.type, dispatcher, aMsg);
       }, this);
     } else {
       // Since no handlers are registered, we need to notify the parent as if
       // all the queued system messages have been handled (notice |handledCount:
       // messages.length|), so the parent can release the CPU wake lock it took
       // on our behalf.