From 975ef5d363b0d1bf34eb98f44b5949ed44e4c153 Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Mon, 22 Dec 2014 15:53:25 +0800 Subject: [PATCH] Bug 1101397 - Clear up unnecessary checking of "undefined" DOMString attribute. r=echen --- b2g/chrome/content/settings.js | 15 ----------- dom/mobilemessage/gonk/MmsService.js | 23 +++-------------- dom/system/gonk/RadioInterfaceLayer.js | 35 ++++---------------------- 3 files changed, 8 insertions(+), 65 deletions(-) diff --git a/b2g/chrome/content/settings.js b/b2g/chrome/content/settings.js index 0bba8372478..aba908cbd38 100644 --- a/b2g/chrome/content/settings.js +++ b/b2g/chrome/content/settings.js @@ -114,21 +114,6 @@ SettingsListener.observe('language.current', 'en-US', function(value) { // =================== RIL ==================== (function RILSettingsToPrefs() { - let strPrefs = ['ril.mms.mmsc', 'ril.mms.mmsproxy']; - strPrefs.forEach(function(key) { - SettingsListener.observe(key, "", function(value) { - Services.prefs.setCharPref(key, value); - }); - }); - - ['ril.mms.mmsport'].forEach(function(key) { - SettingsListener.observe(key, null, function(value) { - if (value != null) { - Services.prefs.setIntPref(key, value); - } - }); - }); - // DSDS default service IDs ['mms', 'sms', 'telephony', 'voicemail'].forEach(function(key) { SettingsListener.observe('ril.' + key + '.defaultServiceId', 0, diff --git a/dom/mobilemessage/gonk/MmsService.js b/dom/mobilemessage/gonk/MmsService.js index 0256b915479..3fa167b76bb 100644 --- a/dom/mobilemessage/gonk/MmsService.js +++ b/dom/mobilemessage/gonk/MmsService.js @@ -225,11 +225,8 @@ MmsConnection.prototype = { mmsPort: -1, setApnSetting: function(network) { - // Workaround an xpconnect issue with undefined string objects. See bug 808220. - this.mmsc = - (network.mmsc === "undefined") ? undefined : network.mmsc; - this.mmsProxy = - (network.mmsProxy === "undefined") ? undefined : network.mmsProxy; + this.mmsc = network.mmsc; + this.mmsProxy = network.mmsProxy; this.mmsPort = network.mmsPort; }, @@ -366,12 +363,6 @@ MmsConnection.prototype = { return null; } - // Workaround an xpconnect issue with undefined string objects. - // See bug 808220 - if (number === undefined || number === "undefined") { - return null; - } - return number; }, @@ -385,15 +376,7 @@ MmsConnection.prototype = { return null; } - let iccId = iccInfo.iccid; - - // Workaround an xpconnect issue with undefined string objects. - // See bug 808220 - if (iccId === undefined || iccId === "undefined") { - return null; - } - - return iccId; + return iccInfo.iccid; }, /** diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 5470975cff3..246dfbcccae 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -3147,16 +3147,7 @@ RILNetworkInterface.prototype = { throw Cr.NS_ERROR_UNEXPECTED; } - let mmsc = this.apnSetting.mmsc; - if (!mmsc) { - try { - mmsc = Services.prefs.getCharPref("ril.mms.mmsc"); - } catch (e) { - mmsc = ""; - } - } - - return mmsc; + return this.apnSetting.mmsc || ""; }, get mmsProxy() { @@ -3165,16 +3156,7 @@ RILNetworkInterface.prototype = { throw Cr.NS_ERROR_UNEXPECTED; } - let proxy = this.apnSetting.mmsproxy; - if (!proxy) { - try { - proxy = Services.prefs.getCharPref("ril.mms.mmsproxy"); - } catch (e) { - proxy = ""; - } - } - - return proxy; + return this.apnSetting.mmsproxy || ""; }, get mmsPort() { @@ -3183,16 +3165,9 @@ RILNetworkInterface.prototype = { throw Cr.NS_ERROR_UNEXPECTED; } - let port = this.apnSetting.mmsport; - if (!port) { - try { - port = Services.prefs.getIntPref("ril.mms.mmsport"); - } catch (e) { - port = -1; - } - } - - return port; + // Note: Port 0 is reserved, so we treat it as invalid as well. + // See http://www.iana.org/assignments/port-numbers + return this.apnSetting.mmsport || -1; }, // Helpers