Bug 1100285 - sessionId shouldn't be added in nfc-manager-send-file. r=dimi
authorYoshi Huang <allstars.chh@mozilla.com>
Mon, 17 Nov 2014 18:51:40 +0800
changeset 241138 a7d8168d17267cc394c136b96e6029aea5ece403
parent 241079 893013d8d71480a18ee3a475ceaff46a1937477b
child 241139 9a402b78e281c65e09c42ce0564dca5f3197a7b3
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi
bugs1100285
milestone36.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 1100285 - sessionId shouldn't be added in nfc-manager-send-file. r=dimi
dom/nfc/gonk/Nfc.js
--- a/dom/nfc/gonk/Nfc.js
+++ b/dom/nfc/gonk/Nfc.js
@@ -594,23 +594,24 @@ Nfc.prototype = {
     gSystemMessenger.broadcastMessage("nfc-hci-event-transaction", message);
   },
 
   /**
    * Process a message from the gMessageManager.
    */
   receiveMessage: function receiveMessage(message) {
     let isRFAPI = message.name == "NFC:ChangeRFState";
-    if (!isRFAPI) {
-      if (this.rfState != NFC.NFC_RF_STATE_DISCOVERY) {
-        debug("NFC is not enabled. current rfState:" + this.rfState);
-        this.sendNfcErrorResponse(message, NFC.NFC_GECKO_ERROR_NOT_ENABLED);
-        return null;
-      }
+    let isSendFile = message.name == "NFC:SendFile";
+    if (!isRFAPI && (this.rfState != NFC.NFC_RF_STATE_DISCOVERY)) {
+      debug("NFC is not enabled. current rfState:" + this.rfState);
+      this.sendNfcErrorResponse(message, NFC.NFC_GECKO_ERROR_NOT_ENABLED);
+      return null;
+    }
 
+    if (!isRFAPI && !isSendFile) {
       // Update the current sessionId before sending to the NFC service.
       message.data.sessionId = SessionHelper.getId(message.data.sessionToken);
     }
 
     switch (message.name) {
       case "NFC:ChangeRFState":
         this.sendToNfcService("changeRFState", message.data);
         break;