Bug 1415877 - Remove unused type parameter to PlacesUIUtils#getTransactionForData. r?mak
MozReview-Commit-ID: 3kZQ4vnCk3b
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -514,29 +514,27 @@ this.PlacesUIUtils = {
/**
* ********* PlacesTransactions version of the function defined above ********
*
* Constructs a Places Transaction for the drop or paste of a blob of data
* into a container.
*
* @param aData
* The unwrapped data blob of dropped or pasted data.
- * @param aType
- * The content type of the data.
* @param aNewParentGuid
* GUID of the container the data was dropped or pasted into.
* @param aIndex
* The index within the container the item was dropped or pasted at.
* @param aCopy
* The drag action was copy, so don't move folders or links.
*
* @return a Places Transaction that can be transacted for performing the
* move/insert command.
*/
- getTransactionForData(aData, aType, aNewParentGuid, aIndex, aCopy) {
+ getTransactionForData(aData, aNewParentGuid, aIndex, aCopy) {
if (!this.SUPPORTED_FLAVORS.includes(aData.type))
throw new Error(`Unsupported '${aData.type}' data type`);
if ("itemGuid" in aData && "instanceId" in aData &&
aData.instanceId == PlacesUtils.instanceId) {
if (!this.PLACES_FLAVORS.includes(aData.type))
throw new Error(`itemGuid unexpectedly set on ${aData.type} data`);
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1317,17 +1317,17 @@ PlacesController.prototype = {
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 insertionIndex = await ip.getIndex();
let doCopy = action == "copy";
- let newTransactions = await getTransactionsForTransferItems(type,
+ let newTransactions = await getTransactionsForTransferItems(
items, insertionIndex, ip.guid, doCopy);
if (newTransactions.length) {
transactions = [...transactions, ...newTransactions];
}
// Note: this._view may be a view or the tree element.
let resultForBatching = getResultForBatching(this._view);
@@ -1664,17 +1664,17 @@ var PlacesControllerDragHelper = {
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,
+ let newTransactions = await getTransactionsForTransferItems(
nodes, insertionIndex, parentGuid, doCopy);
if (newTransactions.length) {
transactions = [...transactions, ...newTransactions];
}
}
} else {
let movedCount = 0;
for (let unwrapped of nodes) {
@@ -1838,26 +1838,25 @@ function getResultForBatching(viewOrElem
return null;
}
/**
* 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,
+async function getTransactionsForTransferItems(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
@@ -1883,17 +1882,16 @@ async function getTransactionsForTransfe
// 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++;
}
}
--- a/browser/components/places/tests/browser/browser_controller_onDrop.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop.js
@@ -117,23 +117,21 @@ async function run_drag_test(startBookma
Assert.ok(PlacesUIUtils.getTransactionForData.calledOnce,
"Should have called getTransactionForData at least once.");
let args = PlacesUIUtils.getTransactionForData.args[0];
Assert.deepEqual(args[0], JSON.parse(bookmarkWithId),
"Should have called getTransactionForData with the correct unwrapped bookmark");
- Assert.equal(args[1], PlacesUtils.TYPE_X_MOZ_PLACE,
- "Should have called getTransactionForData with the correct flavor");
- Assert.equal(args[2], newParentGuid,
+ Assert.equal(args[1], newParentGuid,
"Should have called getTransactionForData with the correct parent guid");
- Assert.equal(args[3], expectedInsertionIndex,
+ Assert.equal(args[2], expectedInsertionIndex,
"Should have called getTransactionForData with the correct index");
- Assert.equal(args[4], false,
+ Assert.equal(args[3], false,
"Should have called getTransactionForData with a move");
});
}
add_task(async function test_simple_move_down() {
// 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