Bug 1167132 - Part 10: [NetworkManager] Move network information into a separate interface (PushService). r=nsm
authorJessica Jong <jjong@mozilla.com>
Wed, 29 Jul 2015 02:11:00 -0400
changeset 286952 928cd60fdc21d9ff08c2442bded9963c13f36780
parent 286951 d922c89bb2128d8cf5f74024fdc3fc77a5c6260e
child 286953 6580a14154efd5666d646c58ae31bff26902f6bc
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnsm
bugs1167132
milestone42.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 1167132 - Part 10: [NetworkManager] Move network information into a separate interface (PushService). r=nsm
dom/push/PushServiceWebSocket.jsm
dom/simplepush/PushService.jsm
--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -1251,34 +1251,34 @@ let PushNetworkInfo = {
     try {
       if (!prefs.get("udp.wakeupEnabled")) {
         debug("UDP support disabled, we do not send any carrier info");
         throw new Error("UDP disabled");
       }
 
       let nm = Cc["@mozilla.org/network/manager;1"]
                  .getService(Ci.nsINetworkManager);
-      if (nm.active &&
-          nm.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
+      if (nm.activeNetworkInfo &&
+          nm.activeNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
         let iccService = Cc["@mozilla.org/icc/iccservice;1"]
                            .getService(Ci.nsIIccService);
         // TODO: Bug 927721 - PushService for multi-sim
         // In Multi-sim, there is more than one client in iccService. Each
         // client represents a icc handle. To maintain backward compatibility
         // with single sim, we always use client 0 for now. Adding support
         // for multiple sim will be addressed in bug 927721, if needed.
         let clientId = 0;
         let icc = iccService.getIccByServiceId(clientId);
         let iccInfo = icc && icc.iccInfo;
         if (iccInfo) {
           debug("Running on mobile data");
 
           let ips = {};
           let prefixLengths = {};
-          nm.active.getAddresses(ips, prefixLengths);
+          nm.activeNetworkInfo.getAddresses(ips, prefixLengths);
 
           return {
             mcc: iccInfo.mcc,
             mnc: iccInfo.mnc,
             ip:  ips.value[0]
           };
         }
       }
--- a/dom/simplepush/PushService.jsm
+++ b/dom/simplepush/PushService.jsm
@@ -1769,32 +1769,33 @@ this.PushService = {
 
     try {
       if (!prefs.get("udp.wakeupEnabled")) {
         debug("UDP support disabled, we do not send any carrier info");
         throw new Error("UDP disabled");
       }
 
       let nm = Cc["@mozilla.org/network/manager;1"].getService(Ci.nsINetworkManager);
-      if (nm.active && nm.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
+      if (nm.activeNetworkInfo &&
+          nm.activeNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
         let iccService = Cc["@mozilla.org/icc/iccservice;1"].getService(Ci.nsIIccService);
         // TODO: Bug 927721 - PushService for multi-sim
         // In Multi-sim, there is more than one client in iccService. Each
         // client represents a icc handle. To maintain backward compatibility
         // with single sim, we always use client 0 for now. Adding support
         // for multiple sim will be addressed in bug 927721, if needed.
         let clientId = 0;
         let icc = iccService.getIccByServiceId(clientId);
         let iccInfo = icc && icc.iccInfo;
         if (iccInfo) {
           debug("Running on mobile data");
 
           let ips = {};
           let prefixLengths = {};
-          nm.active.getAddresses(ips, prefixLengths);
+          nm.activeNetworkInfo.getAddresses(ips, prefixLengths);
 
           return {
             mcc: iccInfo.mcc,
             mnc: iccInfo.mnc,
             ip:  ips.value[0]
           }
         }
       }