Bug 385273 - "add bookmark button disabled in the "Add Bookmark" dialog if there is no scheme on the url" [p=florian r=Mano a=blocking-firefox3+]

This commit is contained in:
reed@reedloden.com 2007-11-12 21:24:55 -08:00
Родитель f57620360c
Коммит ad50b38554
3 изменённых файлов: 26 добавлений и 13 удалений

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

@ -715,7 +715,7 @@ var BookmarkPropertiesPanel = {
try {
var value = this._element(aTextboxID).value;
if (value) {
var uri = PlacesUtils._uri(value);
var uri = PlacesUtils.createFixedURI(value);
return true;
}
} catch (e) { }
@ -822,7 +822,7 @@ var BookmarkPropertiesPanel = {
if (this._itemType == BOOKMARK_ITEM) {
// location
var url = PlacesUtils._uri(this._element("editURLBar").value);
var url = PlacesUtils.createFixedURI(this._element("editURLBar").value);
if (!this._bookmarkURI.equals(url))
transactions.push(PlacesUtils.ptm.editBookmarkURI(itemId, url));
@ -858,7 +858,7 @@ var BookmarkPropertiesPanel = {
}
else if (this._itemType == LIVEMARK_CONTAINER) {
var feedURIString = this._element("feedLocationTextfield").value;
var feedURI = PlacesUtils._uri(feedURIString);
var feedURI = PlacesUtils.createFixedURI(feedURIString);
if (!this._feedURI.equals(feedURI)) {
transactions.push(
PlacesUtils.ptm.editLivemarkFeedURI(this._folderId, feedURI));
@ -868,7 +868,7 @@ var BookmarkPropertiesPanel = {
var newSiteURIString = this._element("feedSiteLocationTextfield").value;
var newSiteURI = null;
if (newSiteURIString)
newSiteURI = PlacesUtils._uri(newSiteURIString);
newSiteURI = PlacesUtils.createFixedURI(newSiteURIString);
if ((!newSiteURI && this._siteURI) ||
(newSiteURI && (!this._siteURI || !this._siteURI.equals(newSiteURI)))) {
@ -912,7 +912,7 @@ var BookmarkPropertiesPanel = {
*/
_getCreateNewBookmarkTransaction:
function BPP__getCreateNewBookmarkTransaction(aContainer, aIndex) {
var uri = PlacesUtils._uri(this._element("editURLBar").value);
var uri = PlacesUtils.createFixedURI(this._element("editURLBar").value);
var title = this._element("userEnteredName").label;
var keyword = this._element("keywordTextfield").value;
var annotations = [];
@ -984,12 +984,12 @@ var BookmarkPropertiesPanel = {
_getCreateNewLivemarkTransaction:
function BPP__getCreateNewLivemarkTransaction(aContainer, aIndex) {
var feedURIString = this._element("feedLocationTextfield").value;
var feedURI = PlacesUtils._uri(feedURIString);
var feedURI = PlacesUtils.createFixedURI(feedURIString);
var siteURIString = this._element("feedSiteLocationTextfield").value;
var siteURI = null;
if (siteURIString)
siteURI = PlacesUtils._uri(siteURIString);
siteURI = PlacesUtils.createFixedURI(siteURIString);
var name = this._element("namePicker").value;
return PlacesUtils.ptm.createLivemark(feedURI, siteURI, name,

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

@ -500,10 +500,9 @@ var gEditItemOverlay = {
},
onLocationFieldBlur: function EIO_onLocationFieldBlur() {
// XXXmano: uri fixup
var uri;
try {
uri = IO.newURI(this._element("locationField").value);
uri = PlacesUtils.createFixedURI(this._element("locationField").value);
}
catch(ex) { return; }
@ -522,10 +521,9 @@ var gEditItemOverlay = {
},
onFeedLocationFieldBlur: function EIO_onFeedLocationFieldBlur() {
// XXXmano: uri fixup
var uri;
try {
uri = IO.newURI(this._element("feedLocationField").value);
uri = PlacesUtils.createFixedURI(this._element("feedLocationField").value);
}
catch(ex) { return; }
@ -537,10 +535,9 @@ var gEditItemOverlay = {
},
onSiteLocationFieldBlur: function EIO_onSiteLocationFieldBlur() {
// XXXmano: uri fixup
var uri = null;
try {
uri = IO.newURI(this._element("siteLocationField").value);
uri = PlacesUtils.createFixedURI(this._element("siteLocationField").value);
}
catch(ex) { }

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

@ -183,6 +183,12 @@ var PlacesUtils = {
getService(Ci.nsIClipboard);
},
get URIFixup() {
delete this.URIFixup;
return this.URIFixup = Cc["@mozilla.org/docshell/urifixup;1"].
getService(Ci.nsIURIFixup);
},
/**
* Makes a URI from a spec.
* @param aSpec
@ -194,6 +200,16 @@ var PlacesUtils = {
return IO.newURI(aSpec);
},
/**
* Makes a URI from a spec, and do fixup
* @param aSpec
* The string spec of the URI
* @returns A URI object for the spec.
*/
createFixedURI: function PU_createFixedURI(aSpec) {
return this.URIFixup.createFixupURI(aSpec, 0);
},
/**
* Wraps a string in a nsISupportsString wrapper
* @param aString