Bug 1065185 - Create a content Array rather than a chrome array when reading Icc contacts. r=hsinyi
authorBobby Holley <bobbyholley@gmail.com>
Fri, 03 Oct 2014 10:05:51 +0200
changeset 208542 2bf5d8b7d3cbdab894449291273b49bde3c133b7
parent 208541 34dbc25304b9357942a337297b5bb9c0626ede76
child 208543 674d025b67e946580a0f602a3be8ede799c0d5fb
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewershsinyi
bugs1065185
milestone35.0a1
Bug 1065185 - Create a content Array rather than a chrome array when reading Icc contacts. r=hsinyi Right now, this array gets implicit __exposedProps__ for all of its indexed members (and .length). Instead, we should be creating the Array directly in the target Window.
dom/system/gonk/RILContentHelper.js
--- a/dom/system/gonk/RILContentHelper.js
+++ b/dom/system/gonk/RILContentHelper.js
@@ -794,32 +794,33 @@ RILContentHelper.prototype = {
     if (message.errorMsg) {
       this.fireRequestError(message.requestId, message.errorMsg);
       return;
     }
 
     let window = this._windowsMap[message.requestId];
     delete this._windowsMap[message.requestId];
     let contacts = message.contacts;
-    let result = contacts.map(function(c) {
+    let result = new window.Array();
+    contacts.forEach(function(c) {
       let prop = {name: [c.alphaId], tel: [{value: c.number}]};
 
       if (c.email) {
         prop.email = [{value: c.email}];
       }
 
       // ANR - Additional Number
       let anrLen = c.anr ? c.anr.length : 0;
       for (let i = 0; i < anrLen; i++) {
         prop.tel.push({value: c.anr[i]});
       }
 
       let contact = new window.mozContact(prop);
       contact.id = c.contactId;
-      return contact;
+      result.push(contact);
     });
 
     this.fireRequestSuccess(message.requestId, result);
   },
 
   handleUpdateIccContact: function(message) {
     if (message.errorMsg) {
       this.fireRequestError(message.requestId, message.errorMsg);