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

View File

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

View File

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

View File

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