Bug 506861 - make more use of makeURI(). r=gavin

This commit is contained in:
Dão Gottwald 2009-07-29 07:55:18 +02:00
parent 3f2b8bfc51
commit f7fa537188
4 changed files with 15 additions and 32 deletions

View File

@ -524,10 +524,7 @@ var PlacesCommandHook = {
* A short description of the feed. Optional.
*/
addLiveBookmark: function PCH_addLiveBookmark(url, feedTitle, feedSubtitle) {
var ios =
Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var feedURI = ios.newURI(url, null, null);
var feedURI = makeURI(url);
var doc = gBrowser.contentDocument;
var title = (arguments.length > 1) ? feedTitle : doc.title;

View File

@ -1182,10 +1182,8 @@ nsContextMenu.prototype = {
},
getLinkURI: function() {
var ioService = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
try {
return ioService.newURI(this.linkURL, null, null);
return makeURI(this.linkURL);
}
catch (ex) {
// e.g. empty URL string

View File

@ -622,15 +622,11 @@
<body>
<![CDATA[
var browser = this.getBrowserForTab(aTab);
browser.mIconURL = aURI;
browser.mIconURL = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
if (aURI) {
if (!(aURI instanceof Components.interfaces.nsIURI)) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
aURI = ios.newURI(aURI, null, null);
}
if (this.mFaviconService)
if (aURI && this.mFaviconService) {
if (!(aURI instanceof Ci.nsIURI))
aURI = makeURI(aURI);
this.mFaviconService.setAndLoadFaviconForPage(browser.currentURI,
aURI, false);
}
@ -706,7 +702,7 @@
req.image.height > sz)
return;
this.setIcon(aTab, browser.currentURI.spec);
this.setIcon(aTab, browser.currentURI);
} catch (e) { }
}
}
@ -725,14 +721,11 @@
<parameter name="aURI"/>
<body>
<![CDATA[
if (!(aURI instanceof Components.interfaces.nsIURI)) {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
aURI = ios.newURI(aURI, null, null);
}
if (this.mFaviconService)
if (this.mFaviconService) {
if (!(aURI instanceof Ci.nsIURI))
aURI = makeURI(aURI);
return this.mFaviconService.isFailedFavicon(aURI);
}
return null;
]]>
</body>

View File

@ -283,10 +283,8 @@
if (val == this.value &&
this.getAttribute("pageproxystate") == "valid") {
let uri;
let ioService = Cc["@mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
try {
uri = ioService.newURI(val, null, null);
uri = makeURI(val);
} catch (e) {}
if (uri && !uri.schemeIs("javascript") && !uri.schemeIs("data")) {
@ -387,10 +385,7 @@
<setter>
<![CDATA[
try {
let uri = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).
newURI(val, null, null);
val = losslessDecodeURI(uri);
val = losslessDecodeURI(makeURI(val));
} catch (ex) { }
this.value = val;