Backed out 2 changesets (bug 1410940) for failing browser-chrome's browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 03 Nov 2017 11:52:54 +0100
changeset 443264 c08ecbfbb50902b34bdfec572f5582d48fa4e829
parent 443263 ae52929709bdb293f0e16d88960320b9b2128038
child 443265 628b2f8e23b7aaa468e078138b51033ede6d97a2
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1410940
milestone58.0a1
backs out1c78029ded02384d293d27421ec5cce979f3d391
37ceb314b2b3ae5c629a028dd5ac46c222015a56
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1410940) for failing browser-chrome's browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js. r=backout Backed out changeset 1c78029ded02 (bug 1410940) Backed out changeset 37ceb314b2b3 (bug 1410940)
browser/components/places/content/controller.js
browser/components/places/tests/browser/browser.ini
browser/components/places/tests/browser/browser_controller_onDrop.js
browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js
browser/components/places/tests/browser/browser_paste_bookmarks.js
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1313,30 +1313,46 @@ PlacesController.prototype = {
     }
 
     let itemsToSelect = [];
     if (PlacesUIUtils.useAsyncTransactions) {
       if (ip.isTag) {
         let urls = items.filter(item => "uri" in item).map(item => Services.io.newURI(item.uri));
         await PlacesTransactions.Tag({ urls, tag: ip.tagName }).transact();
       } else {
-        let transactions = [];
+        let transactionData = [];
 
         let insertionIndex = await ip.getIndex();
-        let doCopy = action == "copy";
-        let newTransactions = await getTransactionsForTransferItems(type,
-          items, insertionIndex, ip.guid, doCopy);
-        if (newTransactions.length) {
-          transactions = [...transactions, ...newTransactions];
+        let parent = ip.guid;
+
+        for (let item of items) {
+          let doCopy = action == "copy";
+
+          // If this is not a copy, check for safety that we can move the
+          // source, otherwise report an error and fallback to a copy.
+          if (!doCopy &&
+              !PlacesControllerDragHelper.canMoveUnwrappedNode(item)) {
+            Components.utils.reportError("Tried to move an unmovable " +
+                           "Places node, reverting to a copy operation.");
+            doCopy = true;
+          }
+
+          transactionData.push([item, type, parent, insertionIndex, doCopy]);
+
+          // Adjust index to make sure items are pasted in the correct
+          // position.  If index is DEFAULT_INDEX, items are just appended.
+          if (insertionIndex != PlacesUtils.bookmarks.DEFAULT_INDEX)
+            insertionIndex++;
         }
 
-        await PlacesUIUtils.batchUpdatesForNode(this._view.result, transactions.length, async () => {
+        await PlacesUIUtils.batchUpdatesForNode(this._view.result, transactionData.length, async () => {
           await PlacesTransactions.batch(async () => {
-            for (let transaction of transactions) {
-              let guid = await transaction.transact();
+            for (let item of transactionData) {
+              let guid = await PlacesUIUtils.getTransactionForData(
+                ...item).transact();
               itemsToSelect.push(await PlacesUtils.promiseItemId(guid));
             }
           });
         });
       }
     } else {
       let transactions = [];
       let insertionIndex = await ip.getIndex();
@@ -1613,16 +1629,17 @@ var PlacesControllerDragHelper = {
    *                                dropped to. This allows batching to take
    *                                place.
    */
   async onDrop(insertionPoint, dt, view) {
     let doCopy = ["copy", "link"].includes(dt.dropEffect);
 
     let transactions = [];
     let dropCount = dt.mozItemCount;
+    let movedCount = 0;
     let parentGuid = insertionPoint.guid;
     let tagName = insertionPoint.tagName;
 
     // Following flavors may contain duplicated data.
     let duplicable = new Map();
     duplicable.set(PlacesUtils.TYPE_UNICODE, new Set());
     duplicable.set(PlacesUtils.TYPE_X_MOZ_URL, new Set());
 
@@ -1654,67 +1671,79 @@ var PlacesControllerDragHelper = {
         let uri = data.linkedBrowser.currentURI;
         let spec = uri ? uri.spec : "about:blank";
         nodes = [{ uri: spec,
                    title: data.label,
                    type: PlacesUtils.TYPE_X_MOZ_URL}];
       } else
         throw new Error("bogus data was passed as a tab");
 
-      if (PlacesUIUtils.useAsyncTransactions) {
-        // If dragging over a tag container we should tag the item.
-        if (insertionPoint.isTag) {
-          let urls = nodes.filter(item => "uri" in item).map(item => item.uri);
-          transactions.push(PlacesTransactions.Tag({ urls, tag: tagName }));
-        } else {
-          let insertionIndex = await insertionPoint.getIndex();
-          let newTransactions = await getTransactionsForTransferItems(flavor,
-            nodes, insertionIndex, parentGuid, doCopy);
-          if (newTransactions.length) {
-            transactions = [...transactions, ...newTransactions];
-          }
-        }
-      } else {
-        let movedCount = 0;
-        for (let unwrapped of nodes) {
-          let index = await insertionPoint.getIndex();
+      for (let unwrapped of nodes) {
+        let index = await insertionPoint.getIndex();
+
+        if (index != -1 && unwrapped.itemGuid) {
+          // Note: we use the parent from the existing bookmark as the sidebar
+          // gives us an unwrapped.parent that is actually a query and not the real
+          // parent.
+          let existingBookmark = await PlacesUtils.bookmarks.fetch(unwrapped.itemGuid);
 
-          if (index != -1 && unwrapped.itemGuid) {
-            // Note: we use the parent from the existing bookmark as the sidebar
-            // gives us an unwrapped.parent that is actually a query and not the real
-            // parent.
-            let existingBookmark = await PlacesUtils.bookmarks.fetch(unwrapped.itemGuid);
-
-            // If we're dropping on the same folder, then we may need to adjust
-            // the index to insert at the correct place.
-            if (existingBookmark && parentGuid == existingBookmark.parentGuid) {
+          // If we're dropping on the same folder, then we may need to adjust
+          // the index to insert at the correct place.
+          if (existingBookmark && parentGuid == existingBookmark.parentGuid) {
+            if (PlacesUIUtils.useAsyncTransactions) {
+              if (index < existingBookmark.index) {
+                // When you drag multiple elts upward: need to increment index or
+                // each successive elt will be inserted at the same index, each
+                // above the previous.
+                index += movedCount++;
+              } else if (index > existingBookmark.index) {
+                // If we're dragging down, we need to go one lower to insert at
+                // the real point as moving the element changes the index of
+                // everything below by 1.
+                index--;
+              } else {
+                // This isn't moving so we skip it.
+                continue;
+              }
+            } else {
               // Sync Transactions. Adjust insertion index to prevent reversal
               // of dragged items. When you drag multiple elts upward: need to
               // increment index or each successive elt will be inserted at the
               // same index, each above the previous.
               if (index < existingBookmark.index) { // eslint-disable-line no-lonely-if
                 index += movedCount++;
               }
             }
           }
+        }
 
-          // If dragging over a tag container we should tag the item.
-          // eslint-disable-next-line no-lonely-if
-          if (insertionPoint.isTag) {
-            let uri = NetUtil.newURI(unwrapped.uri);
-            let tagItemId = insertionPoint.itemId;
+        // If dragging over a tag container we should tag the item.
+        if (insertionPoint.isTag) {
+          let uri = NetUtil.newURI(unwrapped.uri);
+          let tagItemId = insertionPoint.itemId;
+          if (PlacesUIUtils.useAsyncTransactions)
+            transactions.push(PlacesTransactions.Tag({ uri, tag: tagName }));
+          else
             transactions.push(new PlacesTagURITransaction(uri, [tagItemId]));
+        } else {
+          // If this is not a copy, check for safety that we can move the
+          // source, otherwise report an error and fallback to a copy.
+          if (!doCopy && !PlacesControllerDragHelper.canMoveUnwrappedNode(unwrapped)) {
+            Components.utils.reportError("Tried to move an unmovable Places " +
+                                         "node, reverting to a copy operation.");
+            doCopy = true;
+          }
+          if (PlacesUIUtils.useAsyncTransactions) {
+            transactions.push(
+              PlacesUIUtils.getTransactionForData(unwrapped,
+                                                  flavor,
+                                                  parentGuid,
+                                                  index,
+                                                  doCopy));
           } else {
-            // If this is not a copy, check for safety that we can move the
-            // source, otherwise report an error and fallback to a copy.
-            if (!doCopy && !PlacesControllerDragHelper.canMoveUnwrappedNode(unwrapped)) {
-              Components.utils.reportError("Tried to move an unmovable Places " +
-                                           "node, reverting to a copy operation.");
-              doCopy = true;
-            }
             transactions.push(PlacesUIUtils.makeTransaction(unwrapped,
                                 flavor, insertionPoint.itemId,
                                 index, doCopy));
           }
         }
       }
     }
     // Check if we actually have something to add, if we don't it probably wasn't
@@ -1804,69 +1833,8 @@ function doGetPlacesControllerForCommand
   return null;
 }
 
 function goDoPlacesCommand(aCommand) {
   let controller = doGetPlacesControllerForCommand(aCommand);
   if (controller && controller.isCommandEnabled(aCommand))
     controller.doCommand(aCommand);
 }
-
-/**
- * Processes a set of transfer items and returns transactions to insert or
- * move them.
- *
- * @param {String} dataFlavor The transfer flavor for the items.
- * @param {Array} items A list of unwrapped nodes to get transactions for.
- * @param {Integer} insertionIndex The requested index for insertion.
- * @param {String} insertionParentGuid The guid of the parent folder to insert
- *                                     or move the items to.
- * @param {Boolean} doCopy Set to true to copy the items, false will move them
- *                         if possible.
- * @return {Array} Returns an array of created PlacesTransactions.
- */
-async function getTransactionsForTransferItems(dataFlavor, items, insertionIndex,
-                                               insertionParentGuid, doCopy) {
-  let transactions = [];
-  let index = insertionIndex;
-
-  for (let item of items) {
-    if (index != -1 && item.itemGuid) {
-      // Note: we use the parent from the existing bookmark as the sidebar
-      // gives us an unwrapped.parent that is actually a query and not the real
-      // parent.
-      let existingBookmark = await PlacesUtils.bookmarks.fetch(item.itemGuid);
-
-      // If we're dropping on the same folder, then we may need to adjust
-      // the index to insert at the correct place.
-      if (existingBookmark && insertionParentGuid == existingBookmark.parentGuid) {
-        if (index > existingBookmark.index) {
-          // If we're dragging down, we need to go one lower to insert at
-          // the real point as moving the element changes the index of
-          // everything below by 1.
-          index--;
-        } else if (index == existingBookmark.index) {
-          // This isn't moving so we skip it.
-          continue;
-        }
-      }
-    }
-
-    // If this is not a copy, check for safety that we can move the
-    // source, otherwise report an error and fallback to a copy.
-    if (!doCopy && !PlacesControllerDragHelper.canMoveUnwrappedNode(item)) {
-      Components.utils.reportError("Tried to move an unmovable Places " +
-                                   "node, reverting to a copy operation.");
-      doCopy = true;
-    }
-    transactions.push(
-      PlacesUIUtils.getTransactionForData(item,
-                                          dataFlavor,
-                                          insertionParentGuid,
-                                          index,
-                                          doCopy));
-
-    if (index != -1 && item.itemGuid) {
-      index++;
-    }
-  }
-  return transactions;
-}
--- a/browser/components/places/tests/browser/browser.ini
+++ b/browser/components/places/tests/browser/browser.ini
@@ -22,17 +22,16 @@ support-files =
 [browser_bookmarkProperties_addLivemark.js]
 [browser_bookmarkProperties_bookmarkAllTabs.js]
 [browser_bookmarkProperties_cancel.js]
 [browser_bookmarkProperties_editTagContainer.js]
 [browser_bookmarkProperties_readOnlyRoot.js]
 [browser_bookmarksProperties.js]
 [browser_check_correct_controllers.js]
 [browser_click_bookmarks_on_toolbar.js]
-[browser_controller_onDrop_tagFolder.js]
 [browser_controller_onDrop.js]
 [browser_copy_folder_tree.js]
 [browser_copy_query_without_tree.js]
 subsuite = clipboard
 [browser_cutting_bookmarks.js]
 subsuite = clipboard
 [browser_drag_bookmarks_on_toolbar.js]
 [browser_forgetthissite_single.js]
--- a/browser/components/places/tests/browser/browser_controller_onDrop.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop.js
@@ -148,21 +148,13 @@ add_task(async function test_simple_move
 });
 
 add_task(async function test_simple_move_to_same_index() {
   // If we move to the same index, then we don't expect any transactions to be
   // created.
   await run_drag_test(1, 1, null, 1, false);
 });
 
-add_task(async function test_simple_move_different_folder_append() {
-  // When we move items to a different folder, the insertion index will be -1
-  // and shouldn't change.
-  await run_drag_test(0, -1, bookmarks[3].guid, -1);
-  await run_drag_test(2, -1, bookmarks[3].guid, -1);
+add_task(async function test_simple_move_different_folder() {
+  // When we move items to a different folder, the index should never change.
+  await run_drag_test(0, 2, bookmarks[3].guid, 2);
+  await run_drag_test(2, 0, bookmarks[3].guid, 0);
 });
-
-add_task(async function test_move_different_folder_insert_at() {
-  // When we move items to a different folder, the insertion index will be -1
-  // and shouldn't change.
-  await run_drag_test(0, 0, bookmarks[3].guid, 0);
-  await run_drag_test(2, 2, bookmarks[3].guid, 2);
-});
deleted file mode 100644
--- a/browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/* global sinon */
-Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js");
-
-const sandbox = sinon.sandbox.create();
-const TAG_NAME = "testTag";
-
-var bookmarks;
-var bookmarkId;
-
-add_task(async function setup() {
-  registerCleanupFunction(async function() {
-    sandbox.restore();
-    delete window.sinon;
-    await PlacesUtils.bookmarks.eraseEverything();
-    await PlacesTestUtils.clearHistory();
-  });
-
-  sandbox.stub(PlacesTransactions, "batch");
-  sandbox.stub(PlacesTransactions, "Tag");
-
-  bookmarks = await PlacesUtils.bookmarks.insertTree({
-    guid: PlacesUtils.bookmarks.unfiledGuid,
-    children: [{
-      title: "bm1",
-      url: "http://example1.com"
-    }, {
-      title: "bm2",
-      url: "http://example2.com",
-      tags: [TAG_NAME]
-    }]
-  });
-  bookmarkId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
-});
-
-async function run_drag_test(startBookmarkIndex, newParentGuid) {
-  if (!PlacesUIUtils.useAsyncTransactions) {
-    Assert.ok(true, "Skipping test as async transactions are turned off");
-    return;
-  }
-
-  if (!newParentGuid) {
-    newParentGuid = PlacesUtils.bookmarks.unfiledGuid;
-  }
-
-  // Reset the stubs so that previous test runs don't count against us.
-  PlacesTransactions.Tag.reset();
-  PlacesTransactions.batch.reset();
-
-  let dragBookmark = bookmarks[startBookmarkIndex];
-
-  await withSidebarTree("bookmarks", async (tree) => {
-    tree.selectItems([PlacesUtils.unfiledBookmarksFolderId]);
-    PlacesUtils.asContainer(tree.selectedNode).containerOpen = true;
-
-    // Simulating a drag-drop with a tree view turns out to be really difficult
-    // as you can't get a node for the source/target. Hence, we fake the
-    // insertion point and drag data and call the function direct.
-    let ip = new InsertionPoint({
-      isTag: true,
-      tagName: TAG_NAME,
-      orientation: Ci.nsITreeView.DROP_ON
-    });
-
-    let bookmarkWithId = JSON.stringify(Object.assign({
-      id: bookmarkId,
-      itemGuid: dragBookmark.guid,
-      parent: PlacesUtils.unfiledBookmarksFolderId,
-      uri: dragBookmark.url
-    }, dragBookmark));
-
-    let dt = {
-      dropEffect: "move",
-      mozCursor: "auto",
-      mozItemCount: 1,
-      types: [ PlacesUtils.TYPE_X_MOZ_PLACE ],
-      mozTypesAt(i) {
-        return this.types;
-      },
-      mozGetDataAt(i) {
-        return bookmarkWithId;
-      }
-    };
-
-    await PlacesControllerDragHelper.onDrop(ip, dt);
-
-    Assert.ok(PlacesTransactions.Tag.calledOnce,
-      "Should have called getTransactionForData at least once.");
-
-    let arg = PlacesTransactions.Tag.args[0][0];
-
-    Assert.equal(arg.urls.length, 1,
-      "Should have called PlacesTransactions.Tag with an array of one url");
-    Assert.equal(arg.urls[0].spec, dragBookmark.url,
-      "Should have called PlacesTransactions.Tag with the correct url");
-    Assert.equal(arg.tag, TAG_NAME,
-      "Should have called PlacesTransactions.Tag with the correct tag name");
-  });
-}
-
-add_task(async function test_simple_drop_and_tag() {
-  // When we move items down the list, we'll get a drag index that is one higher
-  // than where we actually want to insert to - as the item is being moved up,
-  // everything shifts down one. Hence the index to pass to the transaction should
-  // be one less than the supplied index.
-  await run_drag_test(0, PlacesUtils.bookmarks.tagGuid);
-});
--- a/browser/components/places/tests/browser/browser_paste_bookmarks.js
+++ b/browser/components/places/tests/browser/browser_paste_bookmarks.js
@@ -1,50 +1,52 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TEST_URL = "http://example.com/";
-const TEST_URL1 = "https://example.com/otherbrowser/";
+const TEST_URL1 = "https://example.com/otherbrowser";
 
 var PlacesOrganizer;
 var ContentTree;
+var bookmark;
+var bookmarkId;
 
 add_task(async function setup() {
   await PlacesUtils.bookmarks.eraseEverything();
   let organizer = await promiseLibrary();
 
   registerCleanupFunction(async function() {
     await promiseLibraryClosed(organizer);
     await PlacesUtils.bookmarks.eraseEverything();
   });
 
   PlacesOrganizer = organizer.PlacesOrganizer;
   ContentTree = organizer.ContentTree;
-});
 
-add_task(async function paste() {
   info("Selecting BookmarksToolbar in the left pane");
   PlacesOrganizer.selectLeftPaneQuery("BookmarksToolbar");
 
-  let bookmark = await PlacesUtils.bookmarks.insert({
+  bookmark = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
     url: TEST_URL,
     title: "0"
   });
-  let bookmarkId = await PlacesUtils.promiseItemId(bookmark.guid);
+  bookmarkId = await PlacesUtils.promiseItemId(bookmark.guid);
 
   ContentTree.view.selectItems([bookmarkId]);
 
   await promiseClipboard(() => {
-    info("Cutting selection");
+    info("Copying selection");
     ContentTree.view.controller.cut();
   }, PlacesUtils.TYPE_X_MOZ_PLACE);
+});
 
+add_task(async function paste() {
   info("Selecting UnfiledBookmarks in the left pane");
   PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
 
   info("Pasting clipboard");
   await ContentTree.view.controller.paste();
 
   let tree = await PlacesUtils.promiseBookmarksTree(PlacesUtils.bookmarks.unfiledGuid);
 
@@ -53,174 +55,16 @@ add_task(async function paste() {
   Assert.equal(tree.children[0].title, "0",
                "Should have the correct title");
   Assert.equal(tree.children[0].uri, TEST_URL,
                "Should have the correct URL");
 
   await PlacesUtils.bookmarks.remove(tree.children[0].guid);
 });
 
-
-add_task(async function paste_check_indexes() {
-  info("Selecting BookmarksToolbar in the left pane");
-  PlacesOrganizer.selectLeftPaneQuery("BookmarksToolbar");
-
-  let copyChildren = [];
-  let targetChildren = [];
-  for (let i = 0; i < 10; i++) {
-    copyChildren.push({
-      url: `${TEST_URL}${i}`,
-      title: `Copy ${i}`
-    });
-    targetChildren.push({
-      url: `${TEST_URL1}${i}`,
-      title: `Target ${i}`
-    });
-  }
-
-  let copyBookmarks = await PlacesUtils.bookmarks.insertTree({
-    guid: PlacesUtils.bookmarks.toolbarGuid,
-    children: copyChildren
-  });
-
-  let targetBookmarks = await PlacesUtils.bookmarks.insertTree({
-    guid: PlacesUtils.bookmarks.unfiledGuid,
-    children: targetChildren
-  });
-
-  let bookmarkIds = await PlacesUtils.promiseManyItemIds([
-    copyBookmarks[0].guid,
-    copyBookmarks[3].guid,
-    copyBookmarks[6].guid,
-    copyBookmarks[9].guid
-  ]);
-
-  ContentTree.view.selectItems([
-    bookmarkIds.get(copyBookmarks[0].guid),
-    bookmarkIds.get(copyBookmarks[3].guid),
-    bookmarkIds.get(copyBookmarks[6].guid),
-    bookmarkIds.get(copyBookmarks[9].guid),
-  ]);
-
-  await promiseClipboard(() => {
-    info("Cutting multiple selection");
-    ContentTree.view.controller.cut();
-  }, PlacesUtils.TYPE_X_MOZ_PLACE);
-
-  info("Selecting UnfiledBookmarks in the left pane");
-  PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
-
-  let insertionBookmarkId = await PlacesUtils.promiseItemId(targetBookmarks[4].guid);
-
-  ContentTree.view.selectItems([insertionBookmarkId]);
-
-  info("Pasting clipboard");
-  await ContentTree.view.controller.paste();
-
-  let tree = await PlacesUtils.promiseBookmarksTree(PlacesUtils.bookmarks.unfiledGuid);
-
-  const expectedBookmarkOrder = [
-    targetBookmarks[0].guid,
-    targetBookmarks[1].guid,
-    targetBookmarks[2].guid,
-    targetBookmarks[3].guid,
-    copyBookmarks[0].guid,
-    copyBookmarks[3].guid,
-    copyBookmarks[6].guid,
-    copyBookmarks[9].guid,
-    targetBookmarks[4].guid,
-    targetBookmarks[5].guid,
-    targetBookmarks[6].guid,
-    targetBookmarks[7].guid,
-    targetBookmarks[8].guid,
-    targetBookmarks[9].guid,
-  ];
-
-  Assert.equal(tree.children.length, expectedBookmarkOrder.length,
-               "Should be the expected amount of bookmarks in the unfiled folder.");
-
-  for (let i = 0; i < expectedBookmarkOrder.length; ++i) {
-    Assert.equal(tree.children[i].guid, expectedBookmarkOrder[i],
-                 `Should be the expected item at index ${i}`);
-  }
-
-  await PlacesUtils.bookmarks.eraseEverything();
-});
-
-add_task(async function paste_check_indexes_same_folder() {
-  info("Selecting BookmarksToolbar in the left pane");
-  PlacesOrganizer.selectLeftPaneQuery("BookmarksToolbar");
-
-  let copyChildren = [];
-  for (let i = 0; i < 10; i++) {
-    copyChildren.push({
-      url: `${TEST_URL}${i}`,
-      title: `Copy ${i}`
-    });
-  }
-
-  let copyBookmarks = await PlacesUtils.bookmarks.insertTree({
-    guid: PlacesUtils.bookmarks.toolbarGuid,
-    children: copyChildren
-  });
-
-  let bookmarkIds = await PlacesUtils.promiseManyItemIds([
-    copyBookmarks[0].guid,
-    copyBookmarks[3].guid,
-    copyBookmarks[6].guid,
-    copyBookmarks[9].guid
-  ]);
-
-  ContentTree.view.selectItems([
-    bookmarkIds.get(copyBookmarks[0].guid),
-    bookmarkIds.get(copyBookmarks[3].guid),
-    bookmarkIds.get(copyBookmarks[6].guid),
-    bookmarkIds.get(copyBookmarks[9].guid),
-  ]);
-
-  await promiseClipboard(() => {
-    info("Cutting multiple selection");
-    ContentTree.view.controller.cut();
-  }, PlacesUtils.TYPE_X_MOZ_PLACE);
-
-  let insertionBookmarkId = await PlacesUtils.promiseItemId(copyBookmarks[4].guid);
-
-  ContentTree.view.selectItems([insertionBookmarkId]);
-
-  info("Pasting clipboard");
-  await ContentTree.view.controller.paste();
-
-  let tree = await PlacesUtils.promiseBookmarksTree(PlacesUtils.bookmarks.toolbarGuid);
-
-  // Although we've inserted at index 4, we've taken out two items below it, so
-  // we effectively insert after the third item.
-  const expectedBookmarkOrder = [
-    copyBookmarks[1].guid,
-    copyBookmarks[2].guid,
-    copyBookmarks[0].guid,
-    copyBookmarks[3].guid,
-    copyBookmarks[6].guid,
-    copyBookmarks[9].guid,
-    copyBookmarks[4].guid,
-    copyBookmarks[5].guid,
-    copyBookmarks[7].guid,
-    copyBookmarks[8].guid,
-  ];
-
-  Assert.equal(tree.children.length, expectedBookmarkOrder.length,
-               "Should be the expected amount of bookmarks in the unfiled folder.");
-
-  for (let i = 0; i < expectedBookmarkOrder.length; ++i) {
-    Assert.equal(tree.children[i].guid, expectedBookmarkOrder[i],
-                 `Should be the expected item at index ${i}`);
-  }
-
-  await PlacesUtils.bookmarks.eraseEverything();
-});
-
 add_task(async function paste_from_different_instance() {
   let xferable = Cc["@mozilla.org/widget/transferable;1"]
                    .createInstance(Ci.nsITransferable);
   xferable.init(null);
 
   // Fake data on the clipboard to pretend this is from a different instance
   // of Firefox.
   let data = {
@@ -237,20 +81,18 @@ add_task(async function paste_from_diffe
   data = JSON.stringify(data);
 
   xferable.addDataFlavor(PlacesUtils.TYPE_X_MOZ_PLACE);
   xferable.setTransferData(PlacesUtils.TYPE_X_MOZ_PLACE, PlacesUtils.toISupportsString(data),
                            data.length * 2);
 
   Services.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
 
-  info("Selecting UnfiledBookmarks in the left pane");
-  PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
+  info("Pasting clipboard");
 
-  info("Pasting clipboard");
   await ContentTree.view.controller.paste();
 
   let tree = await PlacesUtils.promiseBookmarksTree(PlacesUtils.bookmarks.unfiledGuid);
 
   Assert.equal(tree.children.length, 1,
                "Should be one bookmark in the unfiled folder.");
   Assert.equal(tree.children[0].title, "test",
                "Should have the correct title");