Bug 958423 - B2G NFC: ndef in 'nfc-manager-tech-discovered' is two levels of array. r=khuey
authorYoshi Huang <allstars.chh@mozilla.com>
Mon, 13 Jan 2014 16:46:55 +0800
changeset 163482 9a7f73b33c73c5febb87b24e5a8811f489745cc5
parent 163481 c6d5907ea1c41e04a9aa5a2e284d1155cae88dfd
child 163483 3ecd352ded47b613c7159397f8dfecbc4f950ecc
push idunknown
push userunknown
push dateunknown
reviewerskhuey
bugs958423
milestone29.0a1
Bug 958423 - B2G NFC: ndef in 'nfc-manager-tech-discovered' is two levels of array. r=khuey
dom/system/gonk/nfc_worker.js
--- a/dom/system/gonk/nfc_worker.js
+++ b/dom/system/gonk/nfc_worker.js
@@ -363,41 +363,37 @@ NfcWorker[NFC_NOTIFICATION_INITIALIZED] 
             NFC_MAJOR_VERSION + "." + NFC_MINOR_VERSION  +
            " Received Version : " + majorVersion + "." + minorVersion);
   }
 };
 
 NfcWorker[NFC_NOTIFICATION_TECH_DISCOVERED] = function NFC_NOTIFICATION_TECH_DISCOVERED() {
   debug("NFC_NOTIFICATION_TECH_DISCOVERED");
   let techList  = [];
-  let ndefMsgs  = [];
 
   let sessionId = Buf.readInt32();
   let techCount = Buf.readInt32();
   for (let count = 0; count < techCount; count++) {
     let tech = NFC_TECHS[Buf.readUint8()];
     if (tech) {
       techList.push(tech);
     }
   }
 
   let padding   = getPaddingLen(techCount);
   for (let i = 0; i < padding; i++) {
     Buf.readUint8();
   }
 
   let ndefMsgCount = Buf.readInt32();
-  for (let count = 0; count < ndefMsgCount; count++) {
-    ndefMsgs.push(this.unMarshallNdefMessage());
-  }
+  let records = this.unMarshallNdefMessage();
   this.sendDOMMessage({type: "techDiscovered",
                        sessionId: sessionId,
                        techList: techList,
-                       ndef: ndefMsgs
-                       });
+                       records: records});
 };
 
 NfcWorker[NFC_NOTIFICATION_TECH_LOST] = function NFC_NOTIFICATION_TECH_LOST() {
   debug("NFC_NOTIFICATION_TECH_LOST");
   let sessionId = Buf.readInt32();
   debug("sessionId = " + sessionId);
   this.sendDOMMessage({type: "techLost",
                        sessionId: sessionId,