Skip to content

Commit

Permalink
Bug 1392189 - Fix deleting bookmark tags from the Library view with P…
Browse files Browse the repository at this point in the history
…laces Transactions enabled. r=mak

MozReview-Commit-ID: unNGjPpTX6
  • Loading branch information
Standard8 committed Aug 23, 2017
1 parent 3760e62 commit 27139c8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion browser/components/places/content/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ PlacesController.prototype = {
let tag = node.title;
let URIs = PlacesUtils.tagging.getURIsForTag(tag);
if (PlacesUIUtils.useAsyncTransactions) {
transactions.push(PlacesTransactions.Untag({ tag, uris: URIs }));
transactions.push(PlacesTransactions.Untag({ tag, urls: URIs }));
} else {
for (var j = 0; j < URIs.length; j++) {
let txn = new PlacesUntagURITransaction(URIs[j], [tag]);
Expand Down
1 change: 1 addition & 0 deletions browser/components/places/tests/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ support-files =
[browser_history_sidebar_search.js]
[browser_library_batch_delete.js]
[browser_library_commands.js]
[browser_library_delete_tags.js]
[browser_library_downloads.js]
[browser_library_infoBox.js]
[browser_library_left_pane_fixnames.js]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */

/**
* Test enabled commands in the left pane folder of the Library.
*/

registerCleanupFunction(async function() {
await PlacesUtils.bookmarks.eraseEverything();
await PlacesTestUtils.clearHistory();
});

add_task(async function test_tags() {
const TEST_URI = Services.io.newURI("http://example.com/");

await PlacesUtils.bookmarks.insert({ type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: TEST_URI,
title: "example page",
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
index: 0 });
PlacesUtils.tagging.tagURI(TEST_URI, ["test"]);

let library = await promiseLibrary();

// Select and open the left pane "Bookmarks Toolbar" folder.
let PO = library.PlacesOrganizer;

PO.selectLeftPaneQuery("Tags");
let tagsNode = PO._places.selectedNode;
Assert.notEqual(tagsNode, null, "Should have a valid selection");
let tagsTitle = PlacesUtils.getString("TagsFolderTitle");
Assert.equal(tagsNode.title, tagsTitle,
"Should have selected the Tags node");

// Now select the tag.
PlacesUtils.asContainer(tagsNode).containerOpen = true;
let tag = tagsNode.getChild(0);
PO._places.selectNode(tag);
Assert.equal(PO._places.selectedNode.title, "test",
"Should have selected the created tag");

PO._places.controller.doCommand("cmd_delete");

await PlacesTestUtils.promiseAsyncUpdates();

let tags = PlacesUtils.tagging.getTagsForURI(TEST_URI);

Assert.equal(tags.length, 0,
"There should be no tags for the URI");

tagsNode.containerOpen = false;

library.close();
});

0 comments on commit 27139c8

Please sign in to comment.