Bug 1061827 - Nfc.js serializes all the messages, even in release mode. r=allstars.chh, a=lmandel
authorKrzysztof Mioduszewski <kmioduszewski@gmail.com>
Fri, 05 Sep 2014 00:21:00 -0400
changeset 225050 8ef9fa6a0cffc567be89728a7bac016b02e631d6
parent 225049 0ca14437762294ed08c41f7928b0a1ca62d91f2d
child 225051 8ec3db1220e0a2e9fe99d3e984e73fb708ed51e6
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)
reviewersallstars, lmandel
bugs1061827
milestone34.0a2
Bug 1061827 - Nfc.js serializes all the messages, even in release mode. r=allstars.chh, a=lmandel
dom/nfc/NfcContentHelper.js
dom/nfc/gonk/Nfc.js
--- a/dom/nfc/NfcContentHelper.js
+++ b/dom/nfc/NfcContentHelper.js
@@ -360,23 +360,21 @@ NfcContentHelper.prototype = {
     }
   },
 
   // nsIMessageListener
 
   fireRequestSuccess: function fireRequestSuccess(requestId, result) {
     let request = this.takeRequest(requestId);
     if (!request) {
-      debug("not firing success for id: " + requestId +
-            ", result: " + JSON.stringify(result));
+      debug("not firing success for id: " + requestId);
       return;
     }
 
-    debug("fire request success, id: " + requestId +
-          ", result: " + JSON.stringify(result));
+    debug("fire request success, id: " + requestId);
     Services.DOMRequest.fireSuccess(request, result);
   },
 
   fireRequestError: function fireRequestError(requestId, errorMsg) {
     let request = this.takeRequest(requestId);
     if (!request) {
       debug("not firing error for id: " + requestId +
             ", errormsg: " + errorMsg);
@@ -384,17 +382,17 @@ NfcContentHelper.prototype = {
     }
 
     debug("fire request error, id: " + requestId +
           ", errormsg: " + errorMsg);
     Services.DOMRequest.fireError(request, errorMsg);
   },
 
   receiveMessage: function receiveMessage(message) {
-    debug("Message received: " + JSON.stringify(message));
+    DEBUG && debug("Message received: " + JSON.stringify(message));
     let result = message.json;
 
     switch (message.name) {
       case "NFC:ReadNDEFResponse":
         this.handleReadNDEFResponse(result);
         break;
       case "NFC:GetDetailsNDEFResponse":
         this.handleGetDetailsNDEFResponse(result);
--- a/dom/nfc/gonk/Nfc.js
+++ b/dom/nfc/gonk/Nfc.js
@@ -227,17 +227,18 @@ XPCOMUtils.defineLazyGetter(this, "gMess
       this.currentPeer = null;
     },
 
     /**
      * nsIMessageListener interface methods.
      */
 
     receiveMessage: function receiveMessage(message) {
-      debug("Received '" + JSON.stringify(message) + "' message from content process");
+      DEBUG && debug("Received message from content process: " + JSON.stringify(message));
+
       if (message.name == "child-process-shutdown") {
         this.removePeerTarget(message.target);
         this.nfc.removeTarget(message.target);
         return null;
       }
 
       if (NFC_IPC_MSG_NAMES.indexOf(message.name) != -1) {
         // Do nothing.
@@ -393,17 +394,17 @@ Nfc.prototype = {
            NFC.NFC_ERROR_MSG[NFC.NFC_GECKO_ERROR_GENERIC_FAILURE];
   },
 
   /**
    * Process the incoming message from the NFC Service.
    */
   onEvent: function onEvent(event) {
     let message = Cu.cloneInto(event, this);
-    debug("Received message from NFC Service: " + JSON.stringify(message));
+    DEBUG && debug("Received message from NFC Service: " + JSON.stringify(message));
 
     // mapping error code to error message
     if (message.status !== undefined && message.status !== NFC.NFC_SUCCESS) {
       message.errorMsg = this.getErrorMessage(message.status);
     }
 
     switch (message.type) {
       case "InitializedNotification":