mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-23 21:17:52 +00:00
Bug 663269 - Handle null livemarks siteURIs.
r=dietrich
This commit is contained in:
parent
96b9620223
commit
0e55ba696e
@ -402,9 +402,9 @@ PlacesViewBase.prototype = {
|
||||
let as = PlacesUtils.annotations;
|
||||
|
||||
let lmStatus = null;
|
||||
if (as.itemHasAnnotation(itemId, "livemark/loadfailed"))
|
||||
if (as.itemHasAnnotation(itemId, PlacesUtils.LMANNO_LOADFAILED))
|
||||
lmStatus = "bookmarksLivemarkFailed";
|
||||
else if (as.itemHasAnnotation(itemId, "livemark/loading"))
|
||||
else if (as.itemHasAnnotation(itemId, PlacesUtils.LMANNO_LOADING))
|
||||
lmStatus = "bookmarksLivemarkLoading";
|
||||
|
||||
let lmStatusElt = aPopup._lmStatusMenuItem;
|
||||
|
@ -618,10 +618,12 @@ var gEditItemOverlay = {
|
||||
catch(ex) { }
|
||||
|
||||
var currentSiteURI = PlacesUtils.livemarks.getSiteURI(this._itemId);
|
||||
if (!uri || !currentSiteURI.equals(uri)) {
|
||||
var txn = PlacesUIUtils.ptm.editLivemarkSiteURI(this._itemId, uri);
|
||||
PlacesUIUtils.ptm.doTransaction(txn);
|
||||
if ((!uri && !currentSiteURI) ||
|
||||
(uri && currentSiteURI && currentSiteURI.equals(uri))) {
|
||||
return;
|
||||
}
|
||||
var txn = PlacesUIUtils.ptm.editLivemarkSiteURI(this._itemId, uri);
|
||||
PlacesUIUtils.ptm.doTransaction(txn);
|
||||
},
|
||||
|
||||
onLoadInSidebarCheckboxCommand:
|
||||
|
@ -596,8 +596,9 @@ var PlacesUtils = {
|
||||
case this.TYPE_X_MOZ_URL: {
|
||||
function gatherDataUrl(bNode) {
|
||||
if (PlacesUtils.nodeIsLivemarkContainer(bNode)) {
|
||||
let siteURI = PlacesUtils.livemarks.getSiteURI(bNode.itemId).spec;
|
||||
return siteURI + NEWLINE + bNode.title;
|
||||
let uri = PlacesUtils.livemarks.getSiteURI(bNode.itemId) ||
|
||||
PlacesUtils.livemarks.getFeedURI(bNode.itemId);
|
||||
return uri.spec + NEWLINE + bNode.title;
|
||||
}
|
||||
if (PlacesUtils.nodeIsURI(bNode))
|
||||
return (aOverrideURI || bNode.uri) + NEWLINE + bNode.title;
|
||||
@ -625,8 +626,9 @@ var PlacesUtils = {
|
||||
// escape out potential HTML in the title
|
||||
let escapedTitle = bNode.title ? htmlEscape(bNode.title) : "";
|
||||
if (PlacesUtils.nodeIsLivemarkContainer(bNode)) {
|
||||
let siteURI = PlacesUtils.livemarks.getSiteURI(bNode.itemId).spec;
|
||||
return "<A HREF=\"" + siteURI + "\">" + escapedTitle + "</A>" + NEWLINE;
|
||||
let uri = PlacesUtils.livemarks.getSiteURI(bNode.itemId) ||
|
||||
PlacesUtils.livemarks.getFeedURI(bNode.itemId);
|
||||
return "<A HREF=\"" + uri.spec + "\">" + escapedTitle + "</A>" + NEWLINE;
|
||||
}
|
||||
if (PlacesUtils.nodeIsContainer(bNode)) {
|
||||
asContainer(bNode);
|
||||
@ -664,7 +666,8 @@ var PlacesUtils = {
|
||||
// Otherwise, we wrap as TYPE_UNICODE.
|
||||
function gatherDataText(bNode) {
|
||||
if (PlacesUtils.nodeIsLivemarkContainer(bNode))
|
||||
return PlacesUtils.livemarks.getSiteURI(bNode.itemId).spec;
|
||||
return PlacesUtils.livemarks.getSiteURI(bNode.itemId) ||
|
||||
PlacesUtils.livemarks.getFeedURI(bNode.itemId);
|
||||
if (PlacesUtils.nodeIsContainer(bNode)) {
|
||||
asContainer(bNode);
|
||||
let wasOpen = bNode.containerOpen;
|
||||
@ -2590,11 +2593,11 @@ function PlacesRemoveLivemarkTransaction(aFolderId)
|
||||
this._container = PlacesUtils.bookmarks.getFolderIdForItem(this._id);
|
||||
let annos = PlacesUtils.getAnnotationsForItem(this._id);
|
||||
// Exclude livemark service annotations, those will be recreated automatically
|
||||
let annosToExclude = ["livemark/feedURI",
|
||||
"livemark/siteURI",
|
||||
"livemark/expiration",
|
||||
"livemark/loadfailed",
|
||||
"livemark/loading"];
|
||||
let annosToExclude = [PlacesUtils.LMANNO_FEEDURI,
|
||||
PlacesUtils.LMANNO_SITEURI,
|
||||
PlacesUtils.LMANNO_EXPIRATION,
|
||||
PlacesUtils.LMANNO_LOADFAILED,
|
||||
PlacesUtils.LMANNO_LOADING];
|
||||
this._annotations = annos.filter(function(aValue, aIndex, aArray) {
|
||||
return annosToExclude.indexOf(aValue.name) == -1;
|
||||
});
|
||||
|
@ -64,7 +64,8 @@ interface nsILivemarkService : nsISupports
|
||||
* @param name The name to show when displaying the livemark
|
||||
* @param siteURI The URI of the site the livemark was created from
|
||||
* @param feedURI The URI of the actual RSS feed
|
||||
* @param index The index to insert at, or -1 to append
|
||||
* @param index The index to insert at, or
|
||||
* nsINavBookmarksService.DEFAULT_INDEX to append.
|
||||
* @returns the ID of the folder for the livemark
|
||||
*/
|
||||
long long createLivemark(in long long folder,
|
||||
|
Loading…
x
Reference in New Issue
Block a user