From 8099ca4c54ee8308f2869bbbaa4e86960ef3bc2d Mon Sep 17 00:00:00 2001 From: Vicamo Yang Date: Mon, 11 Nov 2013 12:41:03 +0800 Subject: [PATCH] Bug 936763 - B2G MMS: the connected/disconnected network can come from 3G not MMS, which throws exceptions when accessing MMS proxy settings. r=vicamo --- dom/mobilemessage/src/gonk/MmsService.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dom/mobilemessage/src/gonk/MmsService.js b/dom/mobilemessage/src/gonk/MmsService.js index 24d0d0ec17a7..cc19250460ed 100644 --- a/dom/mobilemessage/src/gonk/MmsService.js +++ b/dom/mobilemessage/src/gonk/MmsService.js @@ -407,16 +407,25 @@ MmsConnection.prototype = { return; } - this.connected = + // We only need to capture the state change of MMS network. Using + // |network.state| isn't reliable due to the possibilty of shared APN. + let connected = this.radioInterface.getDataCallStateByType("mms") == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED; + // Return if the MMS network state doesn't change, where the network + // state change can come from other non-MMS networks. + if (connected == this.connected) { + return; + } + + this.connected = connected; if (!this.connected) { return; } - // Set up the MMS APN setting based on the network, which is going to - // be used for the HTTP requests later. + // Set up the MMS APN setting based on the connected MMS network, + // which is going to be used for the HTTP requests later. this.setApnSetting(network); if (DEBUG) debug("Got the MMS network connected! Resend the buffered " +