diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js index 32d90d4a13f..4950ec54a57 100644 --- a/browser/components/places/content/controller.js +++ b/browser/components/places/content/controller.js @@ -139,7 +139,6 @@ PlacesController.prototype = { case "placesCmd_new:folder": case "placesCmd_new:livemark": case "placesCmd_new:bookmark": - case "placesCmd_sortBy:name": case "placesCmd_createBookmark": return false; } @@ -297,7 +296,7 @@ PlacesController.prototype = { this.reloadSelectedLivemark(); break; case "placesCmd_sortBy:name": - this.sortFolderByName(); + this.sortFolderByName().then(null, Cu.reportError); break; case "placesCmd_createBookmark": let node = this._view.selectedNode; @@ -781,7 +780,7 @@ PlacesController.prototype = { throw Cr.NS_ERROR_NOT_AVAILABLE; if (!PlacesUIUtils.useAsyncTransactions) { - var txn = new PlacesCreateSeparatorTransaction(ip.itemId, ip.index); + let txn = new PlacesCreateSeparatorTransaction(ip.itemId, ip.index); PlacesUtils.transactionManager.doTransaction(txn); // Select the new item. let insertedNodeId = PlacesUtils.bookmarks @@ -810,11 +809,16 @@ PlacesController.prototype = { /** * Sort the selected folder by name */ - sortFolderByName: function PC_sortFolderByName() { - var itemId = PlacesUtils.getConcreteItemId(this._view.selectedNode); - var txn = new PlacesSortFolderByNameTransaction(itemId); - PlacesUtils.transactionManager.doTransaction(txn); - }, + sortFolderByName: Task.async(function* () { + let itemId = PlacesUtils.getConcreteItemId(this._view.selectedNode); + if (!PlacesUIUtils.useAsyncTransactions) { + var txn = new PlacesSortFolderByNameTransaction(itemId); + PlacesUtils.transactionManager.doTransaction(txn); + return; + } + let guid = yield PlacesUtils.promiseItemGUID(itemId); + yield PlacesTransactions.transact(PlacesTransactions.SortByName(guid)); + }), /** * Walk the list of folders we're removing in this delete operation, and