Bug 1111523 - isP2P and sessionToken shouldn't exist in nfc-manager-tech-discover wrapper. r=dimi
authorYoshi Huang <allstars.chh@mozilla.com>
Mon, 15 Dec 2014 18:01:34 +0800
changeset 220145 b89d2bdab0e419570e6d3c1b8fae89b3c7aef912
parent 220144 24b23243f75820c3d5b9195317a956b848844d8a
child 220146 ed17947fb3992959e3b85c39c8f17c68984412a1
push id10457
push userryanvm@gmail.com
push dateThu, 18 Dec 2014 01:54:25 +0000
treeherderfx-team@0e441ff66c5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi
bugs1111523
milestone37.0a1
Bug 1111523 - isP2P and sessionToken shouldn't exist in nfc-manager-tech-discover wrapper. r=dimi
dom/nfc/gonk/Nfc.js
dom/nfc/nsNfc.js
--- a/dom/nfc/gonk/Nfc.js
+++ b/dom/nfc/gonk/Nfc.js
@@ -477,17 +477,17 @@ Nfc.prototype = {
             gMessageManager.onPeerEvent(NFC.PEER_EVENT_FOUND, message.sessionToken);
           }
         } else {
           gMessageManager.onTagFound(message);
         }
 
         let sysMsg = new NfcTechDiscoveredSysMsg(message.sessionToken,
                                                  message.isP2P,
-                                                 message.records);
+                                                 message.records || null);
         gSystemMessenger.broadcastMessage("nfc-manager-tech-discovered", sysMsg);
         break;
       case "TechLostNotification":
         message.type = "techLost";
 
         // Update the upper layers with a session token (alias)
         message.sessionToken = SessionHelper.getToken(message.sessionId);
         if (SessionHelper.isP2PSession(message.sessionId)) {
--- a/dom/nfc/nsNfc.js
+++ b/dom/nfc/nsNfc.js
@@ -568,16 +568,20 @@ NFCTechDiscoveredWrapper.prototype = {
   // nsISystemMessagesWrapper implementation.
   wrapMessage: function wrapMessage(aMessage, aWindow) {
     aMessage = Cu.cloneInto(aMessage, aWindow);
     if (aMessage.isP2P) {
       let peerImpl = new MozNFCPeerImpl(aWindow, aMessage.sessionToken);
       let peer = aWindow.MozNFCPeer._create(aWindow, peerImpl);
       aMessage.peer = peer;
     }
+
+    delete aMessage.isP2P;
+    delete aMessage.sessionToken;
+
     return aMessage;
   },
 
   classDescription: "NFCTechDiscoveredWrapper",
   classID: Components.ID("{2e7f9285-3c72-4e1f-b985-141a00a23a75}"),
   contractID: "@mozilla.org/dom/system-messages/wrapper/nfc-manager-tech-discovered;1",
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISystemMessagesWrapper])
 };