fix for bug #381894: Some Live Bookmarks only show in the places organizer.also, there was a crash lurking in the export code when we didn't have a feed uri.r=sayrer

This commit is contained in:
sspitzer@mozilla.org 2007-05-27 20:50:34 -07:00
parent e708f58f97
commit 4c40a2ce52
2 changed files with 36 additions and 20 deletions

View File

@ -2038,17 +2038,19 @@ nsPlacesImportExportService::WriteLivemark(nsINavHistoryResultNode* aFolder, con
nsCOMPtr<nsIURI> feedURI;
rv = mLivemarkService->GetFeedURI(folderId, getter_AddRefs(feedURI));
NS_ENSURE_SUCCESS(rv, rv);
nsCString feedSpec;
rv = feedURI->GetSpec(feedSpec);
NS_ENSURE_SUCCESS(rv, rv);
if (feedURI) {
nsCString feedSpec;
rv = feedURI->GetSpec(feedSpec);
NS_ENSURE_SUCCESS(rv, rv);
// write feed URI
rv = aOutput->Write(kFeedURIAttribute, sizeof(kFeedURIAttribute)-1, &dummy);
NS_ENSURE_SUCCESS(rv, rv);
rv = WriteEscapedUrl(feedSpec, aOutput);
NS_ENSURE_SUCCESS(rv, rv);
rv = aOutput->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
NS_ENSURE_SUCCESS(rv, rv);
// write feed URI
rv = aOutput->Write(kFeedURIAttribute, sizeof(kFeedURIAttribute)-1, &dummy);
NS_ENSURE_SUCCESS(rv, rv);
rv = WriteEscapedUrl(feedSpec, aOutput);
NS_ENSURE_SUCCESS(rv, rv);
rv = aOutput->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
NS_ENSURE_SUCCESS(rv, rv);
}
// get the optional site URI
nsCOMPtr<nsIURI> siteURI;

View File

@ -301,17 +301,21 @@ LivemarkService.prototype = {
* startup.
*/
getSiteURI: function LS_getSiteURI(container) {
this._ensureLivemark(container);
var siteURIString;
try {
siteURIString =
try {
this._ensureLivemark(container);
// getItemAnnotationString() can throw if there is no annotation
var siteURIString =
this._ans.getItemAnnotationString(container, LMANNO_SITEURI);
return gIoService.newURI(siteURIString, null, null);
}
catch (ex) {
return null;
// temporary logging, for bug #381894
LOG("getSiteURI failed: " + ex);
LOG("siteURIString: " + siteURIString);
}
return gIoService.newURI(siteURIString, null, null);
return null;
},
setSiteURI: function LS_setSiteURI(container, siteURI) {
@ -327,9 +331,19 @@ LivemarkService.prototype = {
},
getFeedURI: function LS_getFeedURI(container) {
return gIoService.newURI(this._ans.getItemAnnotationString(container,
LMANNO_FEEDURI),
null, null);
try {
// getItemAnnotationString() can throw if there is no annotation
var feedURIString = this._ans.getItemAnnotationString(container,
LMANNO_FEEDURI);
return gIoService.newURI(feedURIString, null, null);
}
catch (ex) {
// temporary logging, for bug #381894
LOG("getFeedURI failed: " + ex);
LOG("feedURIString: " + feedURIString);
}
return null;
},
setFeedURI: function LS_setFeedURI(container, feedURI) {