Bug 1404909 - Improve view batching when dropping/pasting to tags, use the actual bookmarks count, not the count of transactions.
MozReview-Commit-ID: B6Bt8bHhh3e
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1815,21 +1815,24 @@ function getResultForBatching(viewOrElem
* @param {Object} insertionPoint The requested point for insertion.
* @param {Boolean} doCopy Set to true to copy the items, false will move them
* if possible.
* @return {Array} Returns an empty array when the insertion point is a tag, else
* returns an array of copied or moved guids.
*/
async function handleTransferItems(items, insertionPoint, doCopy, view) {
let transactions;
+ let itemsCount;
if (insertionPoint.isTag) {
let urls = items.filter(item => "uri" in item).map(item => item.uri);
+ itemsCount = urls.length;
transactions = [PlacesTransactions.Tag({ urls, tag: insertionPoint.tagName })];
} else {
let insertionIndex = await insertionPoint.getIndex();
+ itemsCount = items.length;
transactions = await getTransactionsForTransferItems(
items, insertionIndex, insertionPoint.guid, doCopy);
}
// Check if we actually have something to add, if we don't it probably wasn't
// valid, or it was moving to the same location, so just ignore it.
if (!transactions.length) {
return [];
@@ -1848,20 +1851,19 @@ async function handleTransferItems(items
let guid = await transaction.transact();
if (guid) {
guidsToSelect.push(guid);
}
}
};
}
- await PlacesUIUtils.batchUpdatesForNode(resultForBatching,
- transactions.length, async () => {
- await PlacesTransactions.batch(batchingItem);
- });
+ await PlacesUIUtils.batchUpdatesForNode(resultForBatching, itemsCount, async () => {
+ await PlacesTransactions.batch(batchingItem);
+ });
return guidsToSelect;
}
/**
* Processes a set of transfer items and returns transactions to insert or
* move them.
*