Bug 1159812 - Bookmark All Tabs is broken. r=ttaubert

This commit is contained in:
Marco Bonardo 2015-05-04 13:05:07 +02:00
Родитель c09150dc35
Коммит 3cc2d3e440
1 изменённых файлов: 23 добавлений и 18 удалений

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

@ -660,17 +660,17 @@ let gEditItemOverlay = {
* The identifier of the bookmarks folder.
*/
_getFolderMenuItem(aFolderId) {
let menuPopup = this._folderMenuList.menupopup;
let menupopup = this._folderMenuList.menupopup;
let menuItem = Array.prototype.find.call(
menuPopup.childNodes, menuItem => menuItem.folderId === aFolderId);
menupopup.childNodes, menuItem => menuItem.folderId === aFolderId);
if (menuItem !== undefined)
return menuItem;
// 3 special folders + separator + folder-items-count limit
if (menupopup.childNodes.length == 4 + MAX_FOLDER_ITEM_IN_MENU_LIST)
menupopup.removeChild(menuPopup.lastChild);
menupopup.removeChild(menupopup.lastChild);
return this._appendFolderItemToMenupopup(menuPopup, aFolderId);
return this._appendFolderItemToMenupopup(menupopup, aFolderId);
},
onFolderMenuListCommand(aEvent) {
@ -692,7 +692,8 @@ let gEditItemOverlay = {
// Move the item
let containerId = this._getFolderIdFromMenuList();
if (PlacesUtils.bookmarks.getFolderIdForItem(this._paneInfo.itemId) != containerId) {
if (PlacesUtils.bookmarks.getFolderIdForItem(this._paneInfo.itemId) != containerId &&
this._paneInfo.itemId != containerId) {
if (PlacesUIUtils.useAsyncTransactions) {
Task.spawn(function* () {
let newParentGuid = yield PlacesUtils.promiseItemGuid(containerId);
@ -712,7 +713,7 @@ let gEditItemOverlay = {
if (containerId != PlacesUtils.unfiledBookmarksFolderId &&
containerId != PlacesUtils.toolbarFolderId &&
containerId != PlacesUtils.bookmarksMenuFolderId) {
this._markFolderAsRecentlyUsed(container)
this._markFolderAsRecentlyUsed(containerId)
.catch(Components.utils.reportError);
}
}
@ -722,8 +723,8 @@ let gEditItemOverlay = {
if (!folderTreeRow.collapsed) {
var selectedNode = this._folderTree.selectedNode;
if (!selectedNode ||
PlacesUtils.getConcreteItemId(selectedNode) != container)
this._folderTree.selectItems([container]);
PlacesUtils.getConcreteItemId(selectedNode) != containerId)
this._folderTree.selectItems([containerId]);
}
},
@ -754,13 +755,15 @@ let gEditItemOverlay = {
let annotation = this._getLastUsedAnnotationObject(false);
while (this._recentFolders.length > MAX_FOLDER_ITEM_IN_MENU_LIST) {
let folderId = this._recentFolders.pop().folderId;
let annoTxn = new PlacesSetItemAnnotationTransaction(folderId, anno);
let annoTxn = new PlacesSetItemAnnotationTransaction(folderId,
annotation);
txns.push(annoTxn);
}
// Mark folder as recently used
annotation = this._getLastUsedAnnotationObject(true);
let annoTxn = new PlacesSetItemAnnotationTransaction(aFolderId, anno);
let annoTxn = new PlacesSetItemAnnotationTransaction(aFolderId,
annotation);
txns.push(annoTxn);
let aggregate =
@ -987,7 +990,7 @@ let gEditItemOverlay = {
return;
if (aItemId == this._paneInfo.itemId) {
this._paneInfo.title = aNewTitle;
this._initTextField(this._namePicker);
this._initTextField(this._namePicker, aNewTitle);
}
else if (this._paneInfo.visibleRows.has("folderRow")) {
// If the title of a folder which is listed within the folders
@ -995,7 +998,7 @@ let gEditItemOverlay = {
// representing element.
let menupopup = this._folderMenuList.menupopup;
for (menuitem of menupopup.childNodes) {
if ("folderId" in menuItem && menuItem.folderId == aItemId) {
if ("folderId" in menuitem && menuitem.folderId == aItemId) {
menuitem.label = aNewTitle;
break;
}
@ -1006,16 +1009,18 @@ let gEditItemOverlay = {
// nsINavBookmarkObserver
onItemChanged(aItemId, aProperty, aIsAnnotationProperty, aValue,
aLastModified, aItemType) {
if (aProperty == "tags" && this._paneInfo.visibleRows.has("tagsRow"))
if (aProperty == "tags" && this._paneInfo.visibleRows.has("tagsRow")) {
this._onTagsChange(aItemId);
else if (!this._paneInfo.isItem || this._paneInfo.itemId != aItemId)
}
else if (aProperty == "title" && this._paneInfo.isItem) {
// This also updates titles of folders in the folder menu list.
this._onItemTitleChange(aItemId, aValue);
}
else if (!this._paneInfo.isItem || this._paneInfo.itemId != aItemId) {
return;
}
switch (aProperty) {
case "title":
if (this._paneInfo.isItem)
this._onItemTitleChange(aItemId, aValue);
break;
case "uri":
let newURI = NetUtil.newURI(aValue);
if (!newURI.equals(this._paneInfo.uri)) {