Bug 1442597 - Can't drag/copy the Mobile bookmarks folder shortcut. r=mak

MozReview-Commit-ID: OqKDMEqxeA

--HG--
extra : rebase_source : d716baa2dc2cf6433a7e7c4be79882b085d1ed51
This commit is contained in:
Mark Banner 2018-03-02 15:42:25 +00:00
parent 7bb7b24179
commit 8e43da7d18
2 changed files with 39 additions and 3 deletions

View File

@ -31,7 +31,42 @@ add_task(async function copy_toolbar_shortcut() {
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT,
"copy is still a folder shortcut");
PlacesUtils.bookmarks.removeItem(toolbarCopyNode.itemId);
await PlacesUtils.bookmarks.remove(toolbarCopyNode.bookmarkGuid);
library.PlacesOrganizer.selectLeftPaneBuiltIn("BookmarksToolbar");
is(library.PlacesOrganizer._places.selectedNode.type,
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT,
"original is still a folder shortcut");
});
add_task(async function copy_mobile_shortcut() {
SpecialPowers.pushPrefEnv({ set: [["browser.bookmarks.showMobileBookmarks", true]]});
await promisePlacesInitComplete();
let library = await promiseLibrary();
registerCleanupFunction(async () => {
library.close();
await PlacesUtils.bookmarks.eraseEverything();
});
library.PlacesOrganizer.selectLeftPaneContainerByHierarchy([
PlacesUIUtils.leftPaneQueries.AllBookmarks,
PlacesUtils.bookmarks.virtualMobileGuid,
]);
await promiseClipboard(function() { library.PlacesOrganizer._places.controller.copy(); },
PlacesUtils.TYPE_X_MOZ_PLACE);
library.PlacesOrganizer.selectLeftPaneBuiltIn("UnfiledBookmarks");
await library.ContentTree.view.controller.paste();
let mobileCopyNode = library.ContentTree.view.view.nodeForTreeIndex(0);
is(mobileCopyNode.type,
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT,
"copy is still a folder shortcut");
await PlacesUtils.bookmarks.remove(mobileCopyNode.bookmarkGuid);
library.PlacesOrganizer.selectLeftPaneBuiltIn("BookmarksToolbar");
is(library.PlacesOrganizer._places.selectedNode.type,
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT,
@ -54,7 +89,7 @@ add_task(async function copy_history_query() {
Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY,
"copy is still a query");
PlacesUtils.bookmarks.removeItem(historyCopyNode.itemId);
await PlacesUtils.bookmarks.remove(historyCopyNode.bookmarkGuid);
library.PlacesOrganizer.selectLeftPaneBuiltIn("History");
is(library.PlacesOrganizer._places.selectedNode.type,
Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY,

View File

@ -169,7 +169,8 @@ var Bookmarks = Object.freeze({
isVirtualRootItem(guid) {
return guid == PlacesUtils.bookmarks.virtualMenuGuid ||
guid == PlacesUtils.bookmarks.virtualToolbarGuid ||
guid == PlacesUtils.bookmarks.virtualUnfiledGuid;
guid == PlacesUtils.bookmarks.virtualUnfiledGuid ||
guid == PlacesUtils.bookmarks.virtualMobileGuid;
},
/**