Bug 885685 - B2G MMS: Use nsIURI Object in applyFilter for MmsProxyFilter. r=vyang,gene a=leo+

This commit is contained in:
Chia-hung Tai 2013-06-25 14:36:59 +08:00
Родитель 1f9f757030
Коммит 12751d7afd
1 изменённых файлов: 6 добавлений и 17 удалений

Просмотреть файл

@ -183,9 +183,6 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
try {
this.mmsc = Services.prefs.getCharPref("ril.mms.mmsc");
if (this.mmsc.endsWith("/")) {
this.mmsc = this.mmsc.substr(0, this.mmsc.length - 1);
}
this.proxy = Services.prefs.getCharPref("ril.mms.mmsproxy");
this.port = Services.prefs.getIntPref("ril.mms.mmsport");
this.updateProxyInfo();
@ -345,9 +342,6 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
switch (data) {
case "ril.mms.mmsc":
this.mmsc = Services.prefs.getCharPref("ril.mms.mmsc");
if (this.mmsc.endsWith("/")) {
this.mmsc = this.mmsc.substr(0, this.mmsc.length - 1);
}
break;
case "ril.mms.mmsproxy":
this.proxy = Services.prefs.getCharPref("ril.mms.mmsproxy");
@ -380,7 +374,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
});
function MmsProxyFilter(url) {
this.url = url;
this.uri = Services.io.newURI(url, null, null);
}
MmsProxyFilter.prototype = {
@ -389,19 +383,14 @@ MmsProxyFilter.prototype = {
// nsIProtocolProxyFilter
applyFilter: function applyFilter(proxyService, uri, proxyInfo) {
let url = uri.prePath + uri.path;
if (url.endsWith("/")) {
url = url.substr(0, url.length - 1);
}
if (this.url != url) {
if (DEBUG) debug("applyFilter: content uri = " + this.url +
" is not matched url = " + url + " .");
if (!this.uri.equals(uri)) {
if (DEBUG) debug("applyFilter: content uri = " + JSON.stringify(this.uri) +
" is not matched with uri = " + JSON.stringify(uri) + " .");
return proxyInfo;
}
// Fall-through, reutrn the MMS proxy info.
if (DEBUG) debug("applyFilter: MMSC is matched: " +
JSON.stringify({ url: this.url,
if (DEBUG) debug("applyFilter: MMSC/Content Location is matched with: " +
JSON.stringify({ uri: JSON.stringify(this.uri),
proxyInfo: gMmsConnection.proxyInfo }));
return gMmsConnection.proxyInfo ? gMmsConnection.proxyInfo : proxyInfo;
}