From c880c0301db849408d29b5c81c1ef3811beada19 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Thu, 29 Jun 2017 04:00:21 +0200 Subject: [PATCH] Backed out changeset 5659f6c9a7c5 (bug 1119282) --- .../browser/browser_410196_paste_into_tags.js | 2 +- .../tests/browser/browser_416459_cut.js | 2 +- .../browser/browser_435851_copy_query.js | 4 +- .../places/tests/browser/browser_475045.js | 59 ++++++++----------- ...ser_bookmarkProperties_editTagContainer.js | 31 ++++------ .../browser/browser_library_batch_delete.js | 5 -- .../components/places/PlacesTransactions.jsm | 1 - toolkit/components/places/nsNavHistory.cpp | 2 - 8 files changed, 43 insertions(+), 63 deletions(-) diff --git a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js b/browser/components/places/tests/browser/browser_410196_paste_into_tags.js index 66f2ae0575c9..1640f97b8dd8 100644 --- a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js +++ b/browser/components/places/tests/browser/browser_410196_paste_into_tags.js @@ -43,7 +43,7 @@ add_task(async function() { await promiseClipboard(populate, PlacesUtils.TYPE_X_MOZ_PLACE); focusTag(PlacesOrganizer); - await PlacesOrganizer._places.controller.paste(); + PlacesOrganizer._places.controller.paste(); // re-focus the history again PlacesOrganizer.selectLeftPaneQuery("History"); diff --git a/browser/components/places/tests/browser/browser_416459_cut.js b/browser/components/places/tests/browser/browser_416459_cut.js index b70e7df6a323..e0c1caf3cd8e 100644 --- a/browser/components/places/tests/browser/browser_416459_cut.js +++ b/browser/components/places/tests/browser/browser_416459_cut.js @@ -54,7 +54,7 @@ add_task(async function() { info("Selecting UnfiledBookmarks in the left pane"); PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks"); info("Pasting clipboard"); - await ContentTree.view.controller.paste(); + ContentTree.view.controller.paste(); await selectBookmarksIn(organizer, bookmarks, "UnfiledBookmarks"); }); diff --git a/browser/components/places/tests/browser/browser_435851_copy_query.js b/browser/components/places/tests/browser/browser_435851_copy_query.js index ff699f475fdb..db701ae4c366 100644 --- a/browser/components/places/tests/browser/browser_435851_copy_query.js +++ b/browser/components/places/tests/browser/browser_435851_copy_query.js @@ -21,7 +21,7 @@ add_task(async function copy_toolbar_shortcut() { PlacesUtils.TYPE_X_MOZ_PLACE); library.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks"); - await library.ContentTree.view.controller.paste(); + library.ContentTree.view.controller.paste(); let toolbarCopyNode = library.ContentTree.view.view.nodeForTreeIndex(0); is(toolbarCopyNode.type, @@ -44,7 +44,7 @@ add_task(async function copy_history_query() { PlacesUtils.TYPE_X_MOZ_PLACE); library.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks"); - await library.ContentTree.view.controller.paste(); + library.ContentTree.view.controller.paste(); let historyCopyNode = library.ContentTree.view.view.nodeForTreeIndex(0); is(historyCopyNode.type, diff --git a/browser/components/places/tests/browser/browser_475045.js b/browser/components/places/tests/browser/browser_475045.js index 14f2bf810e78..e0e6617a10b5 100644 --- a/browser/components/places/tests/browser/browser_475045.js +++ b/browser/components/places/tests/browser/browser_475045.js @@ -34,27 +34,24 @@ add_task(async function test() { * @param aMimeType * The mime type to use for the drop operation. */ - let simulateDragDrop = async function(aEffect, aMimeType) { - const url = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7"; - let promiseItemAddedNotification = promiseBookmarksNotification( - "onItemAdded", (itemId, parentId, index, type, uri, guid) => uri.spec == url); - + let simulateDragDrop = function(aEffect, aMimeType) { + const uriSpec = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7"; + let uri = makeURI(uriSpec); EventUtils.synthesizeDrop(placesItems.childNodes[0], placesItems, [[{type: aMimeType, - data: url}]], + data: uriSpec}]], aEffect, window); - await promiseItemAddedNotification; - // Verify that the drop produces exactly one bookmark. - let bookmark = await PlacesUtils.bookmarks.fetch({url}); - Assert.ok(bookmark, "There should be exactly one bookmark"); + let bookmarkIds = PlacesUtils.bookmarks + .getBookmarkIdsForURI(uri); + ok(bookmarkIds.length == 1, "There should be exactly one bookmark"); - await PlacesUtils.bookmarks.remove(bookmark.guid); + PlacesUtils.bookmarks.removeItem(bookmarkIds[0]); // Verify that we removed the bookmark successfully. - Assert.equal(await PlacesUtils.bookmarks.fetch({url}), null, "URI should be removed"); + ok(!PlacesUtils.bookmarks.isBookmarked(uri), "URI should be removed"); }; /** @@ -65,48 +62,44 @@ add_task(async function test() { * @param aMimeType * The mime type to use for the drop operation. */ - let simulateDragDropMultiple = async function(aEffect, aMimeType) { - const urls = [ + let simulateDragDropMultiple = function(aEffect, aMimeType) { + const uriSpecs = [ "http://www.mozilla.org/C54263C6-A484-46CF-8E2B-FE131586348A", "http://www.mozilla.org/71381257-61E6-4376-AF7C-BF3C5FD8870D", "http://www.mozilla.org/091A88BD-5743-4C16-A005-3D2EA3A3B71E" ]; + let uris = uriSpecs.map(spec => makeURI(spec)); let data; if (aMimeType == "text/x-moz-url") - data = urls.map(spec => spec + "\n" + spec).join("\n"); + data = uriSpecs.map(spec => spec + "\n" + spec).join("\n"); else - data = urls.join("\n"); - - let promiseItemAddedNotification = promiseBookmarksNotification( - "onItemAdded", (itemId, parentId, index, type, uri, guid) => uri.spec == urls[2]); - + data = uriSpecs.join("\n"); EventUtils.synthesizeDrop(placesItems.childNodes[0], placesItems, [[{type: aMimeType, data}]], aEffect, window); - await promiseItemAddedNotification; - // Verify that the drop produces exactly one bookmark per each URL. - for (let url of urls) { - let bookmark = await PlacesUtils.bookmarks.fetch({url}); - Assert.equal(typeof(bookmark), "object", "There should be exactly one bookmark"); + for (let uri of uris) { + let bookmarkIds = PlacesUtils.bookmarks + .getBookmarkIdsForURI(uri); + ok(bookmarkIds.length == 1, "There should be exactly one bookmark"); - await PlacesUtils.bookmarks.remove(bookmark.guid); + PlacesUtils.bookmarks.removeItem(bookmarkIds[0]); // Verify that we removed the bookmark successfully. - Assert.equal(await PlacesUtils.bookmarks.fetch({url}), null, "URI should be removed"); + ok(!PlacesUtils.bookmarks.isBookmarked(uri), "URI should be removed"); } }; // Simulate a bookmark drop for all of the mime types and effects. let mimeTypes = ["text/plain", "text/unicode", "text/x-moz-url"]; let effects = ["move", "copy", "link"]; - for (let effect of effects) { - for (let mimeType of mimeTypes) { - await simulateDragDrop(effect, mimeType); - await simulateDragDropMultiple(effect, mimeType); - } - } + effects.forEach(function(effect) { + mimeTypes.forEach(function(mimeType) { + simulateDragDrop(effect, mimeType); + simulateDragDropMultiple(effect, mimeType); + }); + }); }); diff --git a/browser/components/places/tests/browser/browser_bookmarkProperties_editTagContainer.js b/browser/components/places/tests/browser/browser_bookmarkProperties_editTagContainer.js index 3da6f3db211b..c6ddf59b4fd7 100644 --- a/browser/components/places/tests/browser/browser_bookmarkProperties_editTagContainer.js +++ b/browser/components/places/tests/browser/browser_bookmarkProperties_editTagContainer.js @@ -2,7 +2,7 @@ add_task(async function() { info("Bug 479348 - Properties on a root should be read-only."); - let uri = Services.io.newURI("http://example.com/"); + let uri = NetUtil.newURI("http://example.com/"); let bm = await PlacesUtils.bookmarks.insert({ url: uri.spec, parentGuid: PlacesUtils.bookmarks.unfiledGuid @@ -26,13 +26,10 @@ add_task(async function() { let fooTag = tagsContainer.getChild(0); let tagNode = fooTag; tree.selectNode(fooTag); - Assert.equal(tagNode.title, "tag1", "tagNode title is correct"); + is(tagNode.title, "tag1", "tagNode title is correct"); - Assert.ok(tree.controller.isCommandEnabled("placesCmd_show:info"), - "'placesCmd_show:info' on current selected node is enabled"); - - let promiseTitleResetNotification = promiseBookmarksNotification( - "onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "tag1"); + ok(tree.controller.isCommandEnabled("placesCmd_show:info"), + "'placesCmd_show:info' on current selected node is enabled"); await withBookmarksDialog( true, @@ -41,12 +38,12 @@ add_task(async function() { }, async function test(dialogWin) { // Check that the dialog is not read-only. - Assert.ok(!dialogWin.gEditItemOverlay.readOnly, "Dialog should not be read-only"); + ok(!dialogWin.gEditItemOverlay.readOnly, "Dialog should not be read-only"); // Check that name picker is not read only let namepicker = dialogWin.document.getElementById("editBMPanel_namePicker"); - Assert.ok(!namepicker.readOnly, "Name field should not be read-only"); - Assert.equal(namepicker.value, "tag1", "Node title is correct"); + ok(!namepicker.readOnly, "Name field should not be read-only"); + is(namepicker.value, "tag1", "Node title is correct"); let promiseTitleChangeNotification = promiseBookmarksNotification( "onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "tag2"); @@ -55,22 +52,20 @@ add_task(async function() { await promiseTitleChangeNotification; - Assert.equal(namepicker.value, "tag2", "Node title has been properly edited"); + is(namepicker.value, "tag2", "Node title has been properly edited"); // Check the shortcut's title. - Assert.equal(tree.selectedNode.title, "tag2", "The node has the correct title"); + is(tree.selectedNode.title, "tag2", "The node has the correct title"); // Check the tags have been edited. let tags = PlacesUtils.tagging.getTagsForURI(uri); - Assert.equal(tags.length, 1, "Found the right number of tags"); - Assert.ok(tags.includes("tag2"), "Found the expected tag"); + is(tags.length, 1, "Found the right number of tags"); + ok(tags.includes("tag2"), "Found the expected tag"); } ); - await promiseTitleResetNotification; - // Check the tag change has been reverted. let tags = PlacesUtils.tagging.getTagsForURI(uri); - Assert.equal(tags.length, 1, "Found the right number of tags"); - Assert.deepEqual(tags, ["tag1"], "Found the expected tag"); + is(tags.length, 1, "Found the right number of tags"); + ok(tags.includes("tag1"), "Found the expected tag"); }); diff --git a/browser/components/places/tests/browser/browser_library_batch_delete.js b/browser/components/places/tests/browser/browser_library_batch_delete.js index 5f401a9346bc..28ff790fa09f 100644 --- a/browser/components/places/tests/browser/browser_library_batch_delete.js +++ b/browser/components/places/tests/browser/browser_library_batch_delete.js @@ -57,13 +57,8 @@ add_task(async function test_create_and_batch_remove_bookmarks() { Assert.equal(PO._places.selectedNode.title, "deleteme", "Folder node selected"); Assert.ok(PO._places.controller.isCommandEnabled("cmd_delete"), "Delete command is enabled"); - let promiseItemRemovedNotification = promiseBookmarksNotification( - "onItemRemoved", (itemId, parentId, index, type, uri, guid) => guid == folderNode.bookmarkGuid); // Execute the delete command and check bookmark has been removed. PO._places.controller.doCommand("cmd_delete"); - - await promiseItemRemovedNotification; - Assert.ok(!PlacesUtils.bookmarks.isBookmarked(testURI), "Bookmark has been correctly removed"); // Test live update. diff --git a/toolkit/components/places/PlacesTransactions.jsm b/toolkit/components/places/PlacesTransactions.jsm index ee96e88c5bb7..0843645a532b 100644 --- a/toolkit/components/places/PlacesTransactions.jsm +++ b/toolkit/components/places/PlacesTransactions.jsm @@ -1223,7 +1223,6 @@ PT.Move.prototype = Object.seal({ else PlacesUtils.bookmarks.moveItem(itemId, oldParentId, oldIndex); }; - return aGuid; } }); diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index 23222e55dd0d..66cbc8da04ad 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -3976,7 +3976,6 @@ nsNavHistory::QueryRowToResult(int64_t itemId, // This is a regular query. resultNode = new nsNavHistoryQueryResultNode(aTitle, aTime, queries, options); resultNode->mItemId = itemId; - resultNode->mBookmarkGuid = aBookmarkGuid; } } @@ -3987,7 +3986,6 @@ nsNavHistory::QueryRowToResult(int64_t itemId, // whole result. Instead make a generic empty query node. resultNode = new nsNavHistoryQueryResultNode(aTitle, aURI); resultNode->mItemId = itemId; - resultNode->mBookmarkGuid = aBookmarkGuid; // This is a perf hack to generate an empty query that skips filtering. resultNode->GetAsQuery()->Options()->SetExcludeItems(true); }