Backed out changeset 5659f6c9a7c5 (bug 1119282)

This commit is contained in:
Sebastian Hengst 2017-06-29 04:00:21 +02:00
Родитель 22eedb837d
Коммит c880c0301d
8 изменённых файлов: 43 добавлений и 63 удалений

Просмотреть файл

@ -43,7 +43,7 @@ add_task(async function() {
await promiseClipboard(populate, PlacesUtils.TYPE_X_MOZ_PLACE);
focusTag(PlacesOrganizer);
await PlacesOrganizer._places.controller.paste();
PlacesOrganizer._places.controller.paste();
// re-focus the history again
PlacesOrganizer.selectLeftPaneQuery("History");

Просмотреть файл

@ -54,7 +54,7 @@ add_task(async function() {
info("Selecting UnfiledBookmarks in the left pane");
PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
info("Pasting clipboard");
await ContentTree.view.controller.paste();
ContentTree.view.controller.paste();
await selectBookmarksIn(organizer, bookmarks, "UnfiledBookmarks");
});

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function copy_toolbar_shortcut() {
PlacesUtils.TYPE_X_MOZ_PLACE);
library.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
await library.ContentTree.view.controller.paste();
library.ContentTree.view.controller.paste();
let toolbarCopyNode = library.ContentTree.view.view.nodeForTreeIndex(0);
is(toolbarCopyNode.type,
@ -44,7 +44,7 @@ add_task(async function copy_history_query() {
PlacesUtils.TYPE_X_MOZ_PLACE);
library.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
await library.ContentTree.view.controller.paste();
library.ContentTree.view.controller.paste();
let historyCopyNode = library.ContentTree.view.view.nodeForTreeIndex(0);
is(historyCopyNode.type,

Просмотреть файл

@ -34,27 +34,24 @@ add_task(async function test() {
* @param aMimeType
* The mime type to use for the drop operation.
*/
let simulateDragDrop = async function(aEffect, aMimeType) {
const url = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7";
let promiseItemAddedNotification = promiseBookmarksNotification(
"onItemAdded", (itemId, parentId, index, type, uri, guid) => uri.spec == url);
let simulateDragDrop = function(aEffect, aMimeType) {
const uriSpec = "http://www.mozilla.org/D1995729-A152-4e30-8329-469B01F30AA7";
let uri = makeURI(uriSpec);
EventUtils.synthesizeDrop(placesItems.childNodes[0],
placesItems,
[[{type: aMimeType,
data: url}]],
data: uriSpec}]],
aEffect, window);
await promiseItemAddedNotification;
// Verify that the drop produces exactly one bookmark.
let bookmark = await PlacesUtils.bookmarks.fetch({url});
Assert.ok(bookmark, "There should be exactly one bookmark");
let bookmarkIds = PlacesUtils.bookmarks
.getBookmarkIdsForURI(uri);
ok(bookmarkIds.length == 1, "There should be exactly one bookmark");
await PlacesUtils.bookmarks.remove(bookmark.guid);
PlacesUtils.bookmarks.removeItem(bookmarkIds[0]);
// Verify that we removed the bookmark successfully.
Assert.equal(await PlacesUtils.bookmarks.fetch({url}), null, "URI should be removed");
ok(!PlacesUtils.bookmarks.isBookmarked(uri), "URI should be removed");
};
/**
@ -65,48 +62,44 @@ add_task(async function test() {
* @param aMimeType
* The mime type to use for the drop operation.
*/
let simulateDragDropMultiple = async function(aEffect, aMimeType) {
const urls = [
let simulateDragDropMultiple = function(aEffect, aMimeType) {
const uriSpecs = [
"http://www.mozilla.org/C54263C6-A484-46CF-8E2B-FE131586348A",
"http://www.mozilla.org/71381257-61E6-4376-AF7C-BF3C5FD8870D",
"http://www.mozilla.org/091A88BD-5743-4C16-A005-3D2EA3A3B71E"
];
let uris = uriSpecs.map(spec => makeURI(spec));
let data;
if (aMimeType == "text/x-moz-url")
data = urls.map(spec => spec + "\n" + spec).join("\n");
data = uriSpecs.map(spec => spec + "\n" + spec).join("\n");
else
data = urls.join("\n");
let promiseItemAddedNotification = promiseBookmarksNotification(
"onItemAdded", (itemId, parentId, index, type, uri, guid) => uri.spec == urls[2]);
data = uriSpecs.join("\n");
EventUtils.synthesizeDrop(placesItems.childNodes[0],
placesItems,
[[{type: aMimeType,
data}]],
aEffect, window);
await promiseItemAddedNotification;
// Verify that the drop produces exactly one bookmark per each URL.
for (let url of urls) {
let bookmark = await PlacesUtils.bookmarks.fetch({url});
Assert.equal(typeof(bookmark), "object", "There should be exactly one bookmark");
for (let uri of uris) {
let bookmarkIds = PlacesUtils.bookmarks
.getBookmarkIdsForURI(uri);
ok(bookmarkIds.length == 1, "There should be exactly one bookmark");
await PlacesUtils.bookmarks.remove(bookmark.guid);
PlacesUtils.bookmarks.removeItem(bookmarkIds[0]);
// Verify that we removed the bookmark successfully.
Assert.equal(await PlacesUtils.bookmarks.fetch({url}), null, "URI should be removed");
ok(!PlacesUtils.bookmarks.isBookmarked(uri), "URI should be removed");
}
};
// Simulate a bookmark drop for all of the mime types and effects.
let mimeTypes = ["text/plain", "text/unicode", "text/x-moz-url"];
let effects = ["move", "copy", "link"];
for (let effect of effects) {
for (let mimeType of mimeTypes) {
await simulateDragDrop(effect, mimeType);
await simulateDragDropMultiple(effect, mimeType);
}
}
effects.forEach(function(effect) {
mimeTypes.forEach(function(mimeType) {
simulateDragDrop(effect, mimeType);
simulateDragDropMultiple(effect, mimeType);
});
});
});

Просмотреть файл

@ -2,7 +2,7 @@
add_task(async function() {
info("Bug 479348 - Properties on a root should be read-only.");
let uri = Services.io.newURI("http://example.com/");
let uri = NetUtil.newURI("http://example.com/");
let bm = await PlacesUtils.bookmarks.insert({
url: uri.spec,
parentGuid: PlacesUtils.bookmarks.unfiledGuid
@ -26,13 +26,10 @@ add_task(async function() {
let fooTag = tagsContainer.getChild(0);
let tagNode = fooTag;
tree.selectNode(fooTag);
Assert.equal(tagNode.title, "tag1", "tagNode title is correct");
is(tagNode.title, "tag1", "tagNode title is correct");
Assert.ok(tree.controller.isCommandEnabled("placesCmd_show:info"),
"'placesCmd_show:info' on current selected node is enabled");
let promiseTitleResetNotification = promiseBookmarksNotification(
"onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "tag1");
ok(tree.controller.isCommandEnabled("placesCmd_show:info"),
"'placesCmd_show:info' on current selected node is enabled");
await withBookmarksDialog(
true,
@ -41,12 +38,12 @@ add_task(async function() {
},
async function test(dialogWin) {
// Check that the dialog is not read-only.
Assert.ok(!dialogWin.gEditItemOverlay.readOnly, "Dialog should not be read-only");
ok(!dialogWin.gEditItemOverlay.readOnly, "Dialog should not be read-only");
// Check that name picker is not read only
let namepicker = dialogWin.document.getElementById("editBMPanel_namePicker");
Assert.ok(!namepicker.readOnly, "Name field should not be read-only");
Assert.equal(namepicker.value, "tag1", "Node title is correct");
ok(!namepicker.readOnly, "Name field should not be read-only");
is(namepicker.value, "tag1", "Node title is correct");
let promiseTitleChangeNotification = promiseBookmarksNotification(
"onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "tag2");
@ -55,22 +52,20 @@ add_task(async function() {
await promiseTitleChangeNotification;
Assert.equal(namepicker.value, "tag2", "Node title has been properly edited");
is(namepicker.value, "tag2", "Node title has been properly edited");
// Check the shortcut's title.
Assert.equal(tree.selectedNode.title, "tag2", "The node has the correct title");
is(tree.selectedNode.title, "tag2", "The node has the correct title");
// Check the tags have been edited.
let tags = PlacesUtils.tagging.getTagsForURI(uri);
Assert.equal(tags.length, 1, "Found the right number of tags");
Assert.ok(tags.includes("tag2"), "Found the expected tag");
is(tags.length, 1, "Found the right number of tags");
ok(tags.includes("tag2"), "Found the expected tag");
}
);
await promiseTitleResetNotification;
// Check the tag change has been reverted.
let tags = PlacesUtils.tagging.getTagsForURI(uri);
Assert.equal(tags.length, 1, "Found the right number of tags");
Assert.deepEqual(tags, ["tag1"], "Found the expected tag");
is(tags.length, 1, "Found the right number of tags");
ok(tags.includes("tag1"), "Found the expected tag");
});

Просмотреть файл

@ -57,13 +57,8 @@ add_task(async function test_create_and_batch_remove_bookmarks() {
Assert.equal(PO._places.selectedNode.title, "deleteme", "Folder node selected");
Assert.ok(PO._places.controller.isCommandEnabled("cmd_delete"),
"Delete command is enabled");
let promiseItemRemovedNotification = promiseBookmarksNotification(
"onItemRemoved", (itemId, parentId, index, type, uri, guid) => guid == folderNode.bookmarkGuid);
// Execute the delete command and check bookmark has been removed.
PO._places.controller.doCommand("cmd_delete");
await promiseItemRemovedNotification;
Assert.ok(!PlacesUtils.bookmarks.isBookmarked(testURI),
"Bookmark has been correctly removed");
// Test live update.

Просмотреть файл

@ -1223,7 +1223,6 @@ PT.Move.prototype = Object.seal({
else
PlacesUtils.bookmarks.moveItem(itemId, oldParentId, oldIndex);
};
return aGuid;
}
});

Просмотреть файл

@ -3976,7 +3976,6 @@ nsNavHistory::QueryRowToResult(int64_t itemId,
// This is a regular query.
resultNode = new nsNavHistoryQueryResultNode(aTitle, aTime, queries, options);
resultNode->mItemId = itemId;
resultNode->mBookmarkGuid = aBookmarkGuid;
}
}
@ -3987,7 +3986,6 @@ nsNavHistory::QueryRowToResult(int64_t itemId,
// whole result. Instead make a generic empty query node.
resultNode = new nsNavHistoryQueryResultNode(aTitle, aURI);
resultNode->mItemId = itemId;
resultNode->mBookmarkGuid = aBookmarkGuid;
// This is a perf hack to generate an empty query that skips filtering.
resultNode->GetAsQuery()->Options()->SetExcludeItems(true);
}