Bug 1075405 - Use numItems to iterate mobile connection providers. r=echen
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Wed, 01 Oct 2014 07:07:00 -0400
changeset 208583 32c885eeb5bc08918a2554521d0d350bef8a68fd
parent 208582 262bb8e131fea2bfb9a8f80dda8f9d4885b2aa11
child 208584 97974cf0eb91d08fd8c20bd7dce2c0a4ed28a16b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersechen
bugs1075405, 1063304
milestone35.0a1
Bug 1075405 - Use numItems to iterate mobile connection providers. r=echen Using .length attribute does not work anymore, probably after bug 1063304 landed. The GonkVoicemail code makes a similar use of the MobileConnectionService and uses numItems to iterate over the providers.
dom/system/NetworkGeolocationProvider.js
--- a/dom/system/NetworkGeolocationProvider.js
+++ b/dom/system/NetworkGeolocationProvider.js
@@ -410,18 +410,18 @@ WifiGeoPositionProvider.prototype = {
     LOG("getMobileInfo called");
     try {
       let radioService = Cc["@mozilla.org/ril;1"]
                     .getService(Ci.nsIRadioInterfaceLayer);
       let service = Cc["@mozilla.org/mobileconnection/mobileconnectionservice;1"]
                     .getService(Ci.nsIMobileConnectionService);
 
       let result = [];
-      for (let i = 0; i < service.length; i++) {
-        LOG("Looking for SIM in slot:" + i + " of " + service.length);
+      for (let i = 0; i < service.numItems; i++) {
+        LOG("Looking for SIM in slot:" + i + " of " + service.numItems);
         let connection = service.getItemByServiceId(i);
         let voice = connection && connection.voice;
         let cell = voice && voice.cell;
         let type = voice && voice.type;
         let network = voice && voice.network;
 
         if (network && cell && type) {
           let radioTechFamily;