--- a/browser/components/extensions/test/xpcshell/test_ext_bookmarks.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_bookmarks.js
@@ -660,17 +660,17 @@ add_task(async function test_get_recent_
createdBookmarks.unshift(bookmark);
await PlacesUtils.bookmarks.insert(bookmark);
}
// Add a tag to the most recent url to prove it doesn't get returned.
PlacesUtils.tagging.tagURI(NetUtil.newURI("http://example.com/${i}"), ["Test Tag"]);
// Add a query bookmark.
- let queryURL = `place:folder=${PlacesUtils.bookmarksMenuFolderId}&queryType=1`;
+ let queryURL = `place:parent=${PlacesUtils.bookmarks.menuGuid}&queryType=1`;
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: queryURL,
title: "a test query"});
await extension.startup();
let receivedBookmarks = await extension.awaitMessage("bookmarks");
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1819,17 +1819,17 @@ BrowserGlue.prototype = {
const NUM_TOOLBAR_BOOKMARKS_TO_UNHIDE = 3;
let xulStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
if (!xulStore.hasValue(BROWSER_DOCURL, "PersonalToolbar", "collapsed")) {
// We consider the toolbar customized if it has more than NUM_TOOLBAR_BOOKMARKS_TO_UNHIDE
// children, or if it has a persisted currentset value.
let toolbarIsCustomized = xulStore.hasValue(BROWSER_DOCURL, "PersonalToolbar", "currentset");
let getToolbarFolderCount = () => {
- let toolbarFolder = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
+ let toolbarFolder = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid).root;
let toolbarChildCount = toolbarFolder.childCount;
toolbarFolder.containerOpen = false;
return toolbarChildCount;
};
if (toolbarIsCustomized || getToolbarFolderCount() > NUM_TOOLBAR_BOOKMARKS_TO_UNHIDE) {
xulStore.setValue(BROWSER_DOCURL, "PersonalToolbar", "collapsed", "false");
}
--- a/browser/components/places/tests/browser/browser_bookmark_folder_moveability.js
+++ b/browser/components/places/tests/browser/browser_bookmark_folder_moveability.js
@@ -18,29 +18,28 @@ add_task(async function() {
await withSidebarTree("bookmarks", async function(tree) {
info("Test a regular folder");
let folder = await PlacesUtils.bookmarks.insert({
parentGuid: root.guid,
title: "",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
});
- let folderId = await PlacesUtils.promiseItemId(folder.guid);
tree.selectItems([folder.guid]);
Assert.equal(tree.selectedNode.bookmarkGuid, folder.guid,
"Selected the expected node");
Assert.equal(tree.selectedNode.type, 6, "node is a folder");
Assert.ok(tree.controller.canMoveNode(tree.selectedNode),
"can move regular folder node");
info("Test a folder shortcut");
let shortcut = await PlacesUtils.bookmarks.insert({
parentGuid: root.guid,
title: "bar",
- url: `place:folder=${folderId}`
+ url: `place:parent=${folder.guid}`
});
tree.selectItems([shortcut.guid]);
Assert.equal(tree.selectedNode.bookmarkGuid, shortcut.guid,
"Selected the expected node");
Assert.equal(tree.selectedNode.type, 9, "node is a folder shortcut");
Assert.equal(PlacesUtils.getConcreteItemGuid(tree.selectedNode),
folder.guid, "shortcut node guid and concrete guid match");
Assert.ok(tree.controller.canMoveNode(tree.selectedNode),
@@ -89,21 +88,20 @@ add_task(async function() {
PlacesUtils.bookmarks.unfiledGuid,
PlacesUtils.bookmarks.toolbarGuid,
];
for (let guid of roots) {
tree.selectItems([guid]);
Assert.ok(!tree.controller.canMoveNode(tree.selectedNode),
"shouldn't be able to move default shortcuts to roots");
- let id = await PlacesUtils.promiseItemId(guid);
let s = await PlacesUtils.bookmarks.insert({
parentGuid: root.guid,
title: "bar",
- url: `place:folder=${id}`,
+ url: `place:parent=${guid}`,
});
tree.selectItems([s.guid]);
Assert.equal(tree.selectedNode.bookmarkGuid, s.guid,
"Selected the expected node");
Assert.ok(tree.controller.canMoveNode(tree.selectedNode),
"should be able to move user-created shortcuts to roots");
}
});
--- a/browser/components/places/tests/browser/browser_controller_onDrop_sidebar.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop_sidebar.js
@@ -119,17 +119,17 @@ add_task(async function test_try_move_ro
});
Assert.notEqual(newFolder.guid, menuFolder.guid,
"Should have created a different folder");
Assert.equal(newFolder.title, PlacesUtils.bookmarks.getLocalizedTitle(menuFolder),
"Should have copied the folder title.");
Assert.equal(newFolder.type, PlacesUtils.bookmarks.TYPE_BOOKMARK,
"Should have a bookmark type (for a folder shortcut).");
- Assert.equal(newFolder.url, "place:folder=BOOKMARKS_MENU",
+ Assert.equal(newFolder.url, `place:parent=${PlacesUtils.bookmarks.menuGuid}`,
"Should have the correct url for the folder shortcut.");
});
add_task(async function test_try_move_bm_within_two_root_folder_queries() {
await PlacesUtils.bookmarks.eraseEverything();
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
--- a/browser/components/places/tests/browser/browser_copy_query_without_tree.js
+++ b/browser/components/places/tests/browser/browser_copy_query_without_tree.js
@@ -1,15 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* test that copying a non movable query or folder shortcut makes a new query with the same url, not a deep copy */
-const SHORTCUT_URL = "place:folder=2";
const QUERY_URL = "place:sort=8&maxResults=10";
add_task(async function copy_toolbar_shortcut() {
await promisePlacesInitComplete();
let library = await promiseLibrary();
registerCleanupFunction(async () => {
--- a/browser/components/places/tests/browser/browser_library_infoBox.js
+++ b/browser/components/places/tests/browser/browser_library_infoBox.js
@@ -70,17 +70,17 @@ add_task(async function() {
checkInfoBoxSelected();
ok(infoBoxExpanderWrapper.hidden,
"Expander button is hidden for bookmarks menu node.");
checkAddInfoFieldsCollapsed(PO);
// open recently bookmarked node
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
- url: "place:folder=BOOKMARKS_MENU&folder=UNFILED_BOOKMARKS&folder=TOOLBAR" +
+ url: "place:" + PlacesUtils.bookmarks.userContentRoots.map(guid => `parent=${guid}`).join("&") +
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
"&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
"&maxResults=10" +
"&excludeQueries=1",
title: "Recent Bookmarks",
index: 0
});
await PlacesUtils.bookmarks.insert({
--- a/browser/components/places/tests/chrome/test_bug1163447_selectItems_through_shortcut.xul
+++ b/browser/components/places/tests/chrome/test_bug1163447_selectItems_through_shortcut.xul
@@ -43,38 +43,38 @@
(async function() {
let bmu = PlacesUtils.bookmarks;
await bmu.insert({
parentGuid: bmu.toolbarGuid,
index: bmu.DEFAULT_INDEX,
type: bmu.TYPE_BOOKMARK,
- url: "place:folder=TOOLBAR",
+ url: `place:parent=${PlacesUtils.bookmarks.toolbarGuid}`,
title: "shortcut to self - causing infinite recursion if not handled properly"
});
await bmu.insert({
parentGuid: bmu.toolbarGuid,
index: bmu.DEFAULT_INDEX,
type: bmu.TYPE_BOOKMARK,
- url: "place:folder=UNFILED_BOOKMARKS",
+ url: `place:parent=${PlacesUtils.bookmarks.unfiledGuid}`,
title: "shortcut to unfiled, within toolbar"
});
let folder = await bmu.insert({
parentGuid: bmu.unfiledGuid,
index: bmu.DEFAULT_INDEX,
type: bmu.TYPE_FOLDER,
title: "folder within unfiled"
});
// Setup the places tree contents.
let tree = document.getElementById("tree");
- tree.place = "place:folder=TOOLBAR";
+ tree.place = `place:parent=${PlacesUtils.bookmarks.toolbarGuid}`;
// Select the folder via the selectItems(folder.guid) API being tested
tree.selectItems([folder.guid]);
is(tree.selectedNode && tree.selectedNode.bookmarkGuid, folder.guid, "The node was selected through the shortcut");
// Cleanup
await bmu.eraseEverything();
--- a/browser/components/places/tests/chrome/test_selectItems_on_nested_tree.xul
+++ b/browser/components/places/tests/chrome/test_selectItems_on_nested_tree.xul
@@ -39,25 +39,25 @@
function runTest() {
SimpleTest.waitForExplicitFinish();
(async function() {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
- url: "place:folder=UNFILED_BOOKMARKS",
+ url: `place:parent=${PlacesUtils.bookmarks.unfiledGuid}`,
title: "shortcut"
});
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
- url: "place:folder=UNFILED_BOOKMARKS&maxResults=10",
+ url: `place:parent=${PlacesUtils.bookmarks.unfiledGuid}&maxResults=10`,
title: "query"
});
let folder = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: "folder"
@@ -68,17 +68,17 @@
index: PlacesUtils.bookmarks.DEFAULT_INDEX,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: "http://www.mozilla.org/",
title: "bookmark"
});
// Setup the places tree contents.
let tree = document.getElementById("tree");
- tree.place = "place:folder=UNFILED_BOOKMARKS";
+ tree.place = `place:parent=${PlacesUtils.bookmarks.unfiledGuid}`;
// Select the last bookmark.
tree.selectItems([bm.guid]);
is (tree.selectedNode.bookmarkGuid, bm.guid, "The right node was selected");
})().then(SimpleTest.finish);
}
]]></script>
</window>
--- a/browser/components/places/tests/unit/test_browserGlue_smartBookmarks.js
+++ b/browser/components/places/tests/unit/test_browserGlue_smartBookmarks.js
@@ -17,18 +17,18 @@ const PREF_RESTORE_DEFAULT_BOOKMARKS = "
function run_test() {
remove_bookmarks_html();
remove_all_JSON_backups();
run_next_test();
}
registerCleanupFunction(() => PlacesUtils.bookmarks.eraseEverything());
-function countFolderChildren(aFolderItemId) {
- let rootNode = PlacesUtils.getFolderContents(aFolderItemId).root;
+function countFolderChildren(aFolderGuid) {
+ let rootNode = PlacesUtils.getFolderContents(aFolderGuid).root;
let cc = rootNode.childCount;
// Dump contents.
for (let i = 0; i < cc ; i++) {
let node = rootNode.getChild(i);
let title = PlacesUtils.nodeIsSeparator(node) ? "---" : node.title;
print("Found child(" + i + "): " + title);
}
rootNode.containerOpen = false;
@@ -68,19 +68,19 @@ add_task(async function test_version_0()
}));
// Set preferences.
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 0);
await rebuildSmartBookmarks();
// Count items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Check version has been updated.
Assert.equal(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
SMART_BOOKMARKS_VERSION);
});
add_task(async function test_version_change() {
@@ -94,30 +94,30 @@ add_task(async function test_version_cha
await checkItemHasAnnotation(bm.guid, SMART_BOOKMARKS_ANNO);
// Change its title.
await PlacesUtils.bookmarks.update({guid: bm.guid, title: "new title"});
bm = await PlacesUtils.bookmarks.fetch({guid: bm.guid});
Assert.equal(bm.title, "new title");
// Sanity check items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Set preferences.
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
await rebuildSmartBookmarks();
// Count items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Check smart bookmark has been replaced, itemId has changed.
bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
});
await checkItemHasAnnotation(bm.guid, SMART_BOOKMARKS_ANNO);
@@ -127,37 +127,37 @@ add_task(async function test_version_cha
Assert.equal(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
SMART_BOOKMARKS_VERSION);
});
add_task(async function test_version_change_pos() {
info("bookmarks position is retained when version changes.");
// Sanity check items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0
});
await checkItemHasAnnotation(bm.guid, SMART_BOOKMARKS_ANNO);
let firstItemTitle = bm.title;
// Set preferences.
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
await rebuildSmartBookmarks();
// Count items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Check smart bookmarks are still in correct position.
bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0
});
await checkItemHasAnnotation(bm.guid, SMART_BOOKMARKS_ANNO);
@@ -167,19 +167,19 @@ add_task(async function test_version_cha
Assert.equal(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
SMART_BOOKMARKS_VERSION);
});
add_task(async function test_version_change_pos_moved() {
info("moved bookmarks position is retained when version changes.");
// Sanity check items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
let bm1 = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: 0
});
await checkItemHasAnnotation(bm1.guid, SMART_BOOKMARKS_ANNO);
let firstItemTitle = bm1.title;
@@ -198,19 +198,19 @@ add_task(async function test_version_cha
Assert.equal(bm.guid, bm1.guid);
// Set preferences.
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
await rebuildSmartBookmarks();
// Count items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
bm1 = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.menuGuid,
index: PlacesUtils.bookmarks.DEFAULT_INDEX
});
await checkItemHasAnnotation(bm1.guid, SMART_BOOKMARKS_ANNO);
Assert.equal(bm1.title, firstItemTitle);
@@ -233,55 +233,55 @@ add_task(async function test_recreation(
// Remove toolbar's smart bookmarks
let bm = await PlacesUtils.bookmarks.fetch({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
index: 0
});
await PlacesUtils.bookmarks.remove(bm.guid);
// Sanity check items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Set preferences.
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 1);
await rebuildSmartBookmarks();
// Count items.
// We should not have recreated the smart bookmark on toolbar.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Check version has been updated.
Assert.equal(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
SMART_BOOKMARKS_VERSION);
});
add_task(async function test_recreation_version_0() {
info("Even if a smart bookmark has been removed recreate it if version is 0.");
// Sanity check items.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Set preferences.
Services.prefs.setIntPref(PREF_SMART_BOOKMARKS_VERSION, 0);
await rebuildSmartBookmarks();
// Count items.
// We should not have recreated the smart bookmark on toolbar.
- Assert.equal(countFolderChildren(PlacesUtils.toolbarFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.toolbarGuid),
SMART_BOOKMARKS_ON_TOOLBAR + DEFAULT_BOOKMARKS_ON_TOOLBAR);
- Assert.equal(countFolderChildren(PlacesUtils.bookmarksMenuFolderId),
+ Assert.equal(countFolderChildren(PlacesUtils.bookmarks.menuGuid),
SMART_BOOKMARKS_ON_MENU + DEFAULT_BOOKMARKS_ON_MENU);
// Check version has been updated.
Assert.equal(Services.prefs.getIntPref(PREF_SMART_BOOKMARKS_VERSION),
SMART_BOOKMARKS_VERSION);
});
--- a/browser/components/preferences/selectBookmark.js
+++ b/browser/components/preferences/selectBookmark.js
@@ -60,17 +60,17 @@ var SelectBookmarkDialog = {
accept: function SBD_accept() {
var bookmarks = document.getElementById("bookmarks");
if (!bookmarks.hasSelection)
throw new Error("Should not be able to accept dialog if there is no selected URL!");
var urls = [];
var names = [];
var selectedNode = bookmarks.selectedNode;
if (PlacesUtils.nodeIsFolder(selectedNode)) {
- var contents = PlacesUtils.getFolderContents(selectedNode.itemId).root;
+ var contents = PlacesUtils.getFolderContents(selectedNode.bookmarkGuid).root;
var cc = contents.childCount;
for (var i = 0; i < cc; ++i) {
var node = contents.getChild(i);
if (PlacesUtils.nodeIsURI(node)) {
urls.push(node.uri);
names.push(node.title);
}
}
--- a/toolkit/components/places/PlacesTransactions.jsm
+++ b/toolkit/components/places/PlacesTransactions.jsm
@@ -1443,18 +1443,17 @@ PT.SortByName.prototype = {
return node_a.title.localeCompare(node_b.title);
};
let oldOrderGuids = [];
let newOrderGuids = [];
let preSepNodes = [];
// This is not great, since it does main-thread IO.
// PromiseBookmarksTree can't be used, since it' won't stop at the first level'.
- let folderId = await PlacesUtils.promiseItemId(guid);
- let root = PlacesUtils.getFolderContents(folderId, false, false).root;
+ let root = PlacesUtils.getFolderContents(guid, false, false).root;
for (let i = 0; i < root.childCount; ++i) {
let node = root.getChild(i);
oldOrderGuids.push(node.bookmarkGuid);
if (PlacesUtils.nodeIsSeparator(node)) {
if (preSepNodes.length > 0) {
preSepNodes.sort(sortingMethod);
newOrderGuids.push(...preSepNodes.map(n => n.bookmarkGuid));
preSepNodes = [];
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -852,17 +852,17 @@ var PlacesUtils = {
// query options are excluding them.
// This can happen when copying from the left hand pane of the bookmarks
// organizer.
// @return [node, shouldClose]
function gatherDataFromNode(node, gatherDataFunc) {
if (PlacesUtils.nodeIsFolder(node) &&
node.type != Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT &&
asQuery(node).queryOptions.excludeItems) {
- let folderRoot = PlacesUtils.getFolderContents(node.itemId, false, true).root;
+ let folderRoot = PlacesUtils.getFolderContents(node.bookmarkGuid, false, true).root;
try {
return gatherDataFunc(folderRoot);
} finally {
folderRoot.containerOpen = false;
}
}
// If we didn't create our own query, do not alter the node's state.
return gatherDataFunc(node);
@@ -1140,35 +1140,34 @@ var PlacesUtils = {
if (key instanceof Ci.nsIURI) {
return new URL(key.spec);
}
throw new TypeError("Invalid url or guid: " + key);
},
/**
* Generates a nsINavHistoryResult for the contents of a folder.
- * @param folderId
+ * @param aFolderGuid
* The folder to open
* @param [optional] excludeItems
* True to hide all items (individual bookmarks). This is used on
* the left places pane so you just get a folder hierarchy.
* @param [optional] expandQueries
* True to make query items expand as new containers. For managing,
* you want this to be false, for menus and such, you want this to
* be true.
* @returns A nsINavHistoryResult containing the contents of the
* folder. The result.root is guaranteed to be open.
*/
- getFolderContents:
- function PU_getFolderContents(aFolderId, aExcludeItems, aExpandQueries) {
- if (typeof aFolderId !== "number") {
- throw new Error("aFolderId should be a number.");
+ getFolderContents(aFolderGuid, aExcludeItems, aExpandQueries) {
+ if (!this.isValidGuid(aFolderGuid)) {
+ throw new Error("aFolderGuid should be a valid GUID.");
}
var query = this.history.getNewQuery();
- query.setFolders([aFolderId], 1);
+ query.setParents([aFolderGuid], 1);
var options = this.history.getNewQueryOptions();
options.excludeItems = aExcludeItems;
options.expandQueries = aExpandQueries;
var result = this.history.executeQuery(query, options);
result.root.containerOpen = true;
return result;
},
--- a/toolkit/components/places/tests/bookmarks/test_384228.js
+++ b/toolkit/components/places/tests/bookmarks/test_384228.js
@@ -69,26 +69,22 @@ add_task(async function search_bookmark_
parentGuid: testFolder1_1.guid,
url: "http://foo.tld/",
title: "title b5 (folder 1.1)"
});
Assert.equal(b5.index, 0);
// query folder 1, folder 2 and get 4 bookmarks
- let folderIds = [];
- folderIds.push(await PlacesUtils.promiseItemId(testFolder1.guid));
- folderIds.push(await PlacesUtils.promiseItemId(testFolder2.guid));
-
let hs = PlacesUtils.history;
let options = hs.getNewQueryOptions();
let query = hs.getNewQuery();
query.searchTerms = "title";
options.queryType = options.QUERY_TYPE_BOOKMARKS;
- query.setFolders(folderIds, folderIds.length);
+ query.setParents([testFolder1.guid, testFolder2.guid], 2);
let rootNode = hs.executeQuery(query, options).root;
rootNode.containerOpen = true;
// should not match item from folder 3
Assert.equal(rootNode.childCount, 4);
Assert.equal(rootNode.getChild(0).bookmarkGuid, b1.guid);
Assert.equal(rootNode.getChild(1).bookmarkGuid, b2.guid);
Assert.equal(rootNode.getChild(2).bookmarkGuid, b3.guid);
--- a/toolkit/components/places/tests/bookmarks/test_385829.js
+++ b/toolkit/components/places/tests/bookmarks/test_385829.js
@@ -61,19 +61,17 @@ add_task(async function search_bookmark_
lastModified: new Date(modifiedTime.getTime() + 1000)
});
let hs = PlacesUtils.history;
let options = hs.getNewQueryOptions();
let query = hs.getNewQuery();
options.queryType = options.QUERY_TYPE_BOOKMARKS;
options.maxResults = 3;
- let folderIds = [];
- folderIds.push(await PlacesUtils.promiseItemId(folder.guid));
- query.setFolders(folderIds, 1);
+ query.setParents([folder.guid], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
// test SORT_BY_DATEADDED_ASCENDING (live update)
result.sortingMode = options.SORT_BY_DATEADDED_ASCENDING;
Assert.equal(rootNode.childCount, 3);
--- a/toolkit/components/places/tests/bookmarks/test_393498.js
+++ b/toolkit/components/places/tests/bookmarks/test_393498.js
@@ -92,18 +92,17 @@ add_task(async function test_bookmark_up
Assert.equal(observer._itemChangedProperty, "title");
Assert.equal(observer._itemChangedValue, "Google");
// Check lastModified has been updated.
Assert.ok(is_time_ordered(PAST_DATE,
updatedBookmark.lastModified.getTime()));
// Check that node properties are updated.
- let testFolderId = await PlacesUtils.promiseItemId(testFolder.guid);
- let root = PlacesUtils.getFolderContents(testFolderId).root;
+ let root = PlacesUtils.getFolderContents(testFolder.guid).root;
Assert.equal(root.childCount, 1);
let childNode = root.getChild(0);
// confirm current dates match node properties
Assert.equal(PlacesUtils.toPRTime(updatedBookmark.dateAdded),
childNode.dateAdded);
Assert.equal(PlacesUtils.toPRTime(updatedBookmark.lastModified),
childNode.lastModified);
--- a/toolkit/components/places/tests/bookmarks/test_405938_restore_queries.js
+++ b/toolkit/components/places/tests/bookmarks/test_405938_restore_queries.js
@@ -77,33 +77,27 @@ var test = {
type: PlacesUtils.bookmarks.TYPE_FOLDER,
children: testFolderItems
}]
};
let insertedBookmarks = await PlacesUtils.bookmarks.insertTree(bookmarksTree);
// create a query URI with 1 folder (ie: folder shortcut)
- let folderIdsMap = await PlacesUtils.promiseManyItemIds(this._folderGuids);
- let folderIds = [];
- for (let id of folderIdsMap.values()) {
- folderIds.push(id);
- }
-
- this._queryURI1 = `place:folder=${folderIdsMap.get(this._folderGuids[0])}&queryType=1`;
+ this._queryURI1 = `place:parent=${this._folderGuids[0]}&queryType=1`;
this._queryTitle1 = "query1";
await PlacesUtils.bookmarks.insert({
parentGuid: insertedBookmarks[0].guid,
dateAdded,
url: this._queryURI1,
title: this._queryTitle1
});
// create a query URI with _count folders
- this._queryURI2 = `place:folder=${folderIds.join("&folder=")}&queryType=1`;
+ this._queryURI2 = `place:parent=${this._folderGuids.join("&parent=")}&queryType=1`;
this._queryTitle2 = "query2";
await PlacesUtils.bookmarks.insert({
parentGuid: insertedBookmarks[0].guid,
dateAdded,
url: this._queryURI2,
title: this._queryTitle2
});
@@ -130,17 +124,17 @@ var test = {
parentGuid: PlacesUtils.bookmarks.menuGuid,
url: uri("http://aaaa" + i),
dateAdded: new Date(date + ((this._extraBookmarksCount - i) * 1000)),
});
}
}
var toolbar =
- PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId,
+ PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid,
false, true).root;
Assert.equal(toolbar.childCount, 1);
var folderNode = toolbar.getChild(0);
Assert.equal(folderNode.type, folderNode.RESULT_TYPE_FOLDER);
Assert.equal(folderNode.title, this._testRootTitle);
folderNode.QueryInterface(Ci.nsINavHistoryQueryResultNode);
folderNode.containerOpen = true;
--- a/toolkit/components/places/tests/bookmarks/test_424958-json-quoted-folders.js
+++ b/toolkit/components/places/tests/bookmarks/test_424958-json-quoted-folders.js
@@ -2,17 +2,17 @@
* 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/. */
"use strict";
const FOLDER_TITLE = '"quoted folder"';
function checkQuotedFolder() {
- let toolbar = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarFolder).root;
+ let toolbar = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid).root;
// test for our quoted folder
Assert.equal(toolbar.childCount, 1);
var folderNode = toolbar.getChild(0);
Assert.equal(folderNode.type, folderNode.RESULT_TYPE_FOLDER);
Assert.equal(folderNode.title, FOLDER_TITLE);
// clean up
--- a/toolkit/components/places/tests/bookmarks/test_448584.js
+++ b/toolkit/components/places/tests/bookmarks/test_448584.js
@@ -16,17 +16,17 @@ try {
- don't try to add invalid uri nodes to a JSON backup
*/
const ITEM_TITLE = "invalid uri";
const ITEM_URL = "http://test.mozilla.org";
function validateResults(expectedValidItemsCount) {
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var options = PlacesUtils.history.getNewQueryOptions();
var result = PlacesUtils.history.executeQuery(query, options);
var toolbar = result.root;
toolbar.containerOpen = true;
// test for our bookmark
Assert.equal(toolbar.childCount, expectedValidItemsCount);
--- a/toolkit/components/places/tests/bookmarks/test_458683.js
+++ b/toolkit/components/places/tests/bookmarks/test_458683.js
@@ -10,17 +10,17 @@
bogus items (separators, folders)
*/
const ITEM_TITLE = "invalid uri";
const ITEM_URL = "http://test.mozilla.org/";
const TAG_NAME = "testTag";
function validateResults() {
- let toolbar = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
+ let toolbar = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid).root;
// test for our bookmark
Assert.equal(toolbar.childCount, 1);
for (var i = 0; i < toolbar.childCount; i++) {
var folderNode = toolbar.getChild(0);
Assert.equal(folderNode.type, folderNode.RESULT_TYPE_URI);
Assert.equal(folderNode.title, ITEM_TITLE);
}
toolbar.containerOpen = false;
@@ -39,17 +39,17 @@ add_task(async function() {
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: ITEM_TITLE,
url: ITEM_URL,
});
// create a tag
PlacesUtils.tagging.tagURI(Services.io.newURI(ITEM_URL), [TAG_NAME]);
// get tag folder id
- let tagRoot = PlacesUtils.getFolderContents(PlacesUtils.tagsFolderId).root;
+ let tagRoot = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.tagsGuid).root;
Assert.equal(tagRoot.childCount, 1);
let tagItemGuid = PlacesUtils.asContainer(tagRoot.getChild(0)).bookmarkGuid;
tagRoot.containerOpen = false;
function insert({type, parentGuid}) {
return PlacesUtils.withConnectionWrapper("test_458683: insert", async db => {
await db.executeCached(
`INSERT INTO moz_bookmarks (type, parent, position, guid)
--- a/toolkit/components/places/tests/bookmarks/test_818587_compress-bookmarks-backups.js
+++ b/toolkit/components/places/tests/bookmarks/test_818587_compress-bookmarks-backups.js
@@ -37,17 +37,17 @@ add_task(async function compress_bookmar
url,
});
// Force create a compressed backup, Remove the bookmark, the restore the backup
await PlacesBackups.create(undefined, true);
let recentBackup = await PlacesBackups.getMostRecentBackup();
await PlacesUtils.bookmarks.remove(bm);
await BookmarkJSONUtils.importFromFile(recentBackup, { replace: true });
- let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
let node = root.getChild(0);
Assert.equal(node.uri, url);
root.containerOpen = false;
await PlacesUtils.bookmarks.eraseEverything();
// Cleanup.
await OS.File.remove(jsonFile);
--- a/toolkit/components/places/tests/bookmarks/test_992901-backup-unsorted-hierarchy.js
+++ b/toolkit/components/places/tests/bookmarks/test_992901-backup-unsorted-hierarchy.js
@@ -35,17 +35,17 @@ add_task(async function() {
await PlacesBackups.create();
// Remove the bookmarks, then restore the backup.
await PlacesUtils.bookmarks.remove(folder1);
await BookmarkJSONUtils.importFromFile((await PlacesBackups.getMostRecentBackup()),
{ replace: true });
info("Checking first level");
- let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
let level1 = root.getChild(0);
Assert.equal(level1.title, "f1");
info("Checking second level");
PlacesUtils.asContainer(level1).containerOpen = true;
let level2 = level1.getChild(0);
Assert.equal(level2.title, "f2");
info("Checking bookmark");
PlacesUtils.asContainer(level2).containerOpen = true;
--- a/toolkit/components/places/tests/bookmarks/test_997030-bookmarks-html-encode.js
+++ b/toolkit/components/places/tests/bookmarks/test_997030-bookmarks-html-encode.js
@@ -19,15 +19,15 @@ add_task(async function() {
}
await BookmarkHTMLUtils.exportToFile(file);
// Remove the bookmarks, then restore the backup.
await PlacesUtils.bookmarks.remove(bm);
await BookmarkHTMLUtils.importFromFile(file, { replace: true });
info("Checking first level");
- let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
let node = root.getChild(0);
Assert.equal(node.uri, url);
root.containerOpen = false;
await PlacesUtils.bookmarks.eraseEverything();
});
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_getRecent.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_getRecent.js
@@ -36,17 +36,17 @@ add_task(async function getRecent_return
// Add a separator.
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
type: PlacesUtils.bookmarks.TYPE_SEPARATOR
});
// Add a query bookmark.
- let queryURL = `place:folder=${PlacesUtils.bookmarksMenuFolderId}&queryType=1`;
+ let queryURL = `place:parent=${PlacesUtils.bookmarks.menuGuid}&queryType=1`;
let bm5 = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: queryURL,
title: "a test query" });
checkBookmarkObject(bm5);
// Verify that getRecent only returns actual bookmarks.
let results = await PlacesUtils.bookmarks.getRecent(100);
Assert.equal(results.length, 4, "The expected number of bookmarks was returned.");
--- a/toolkit/components/places/tests/bookmarks/test_savedsearches.js
+++ b/toolkit/components/places/tests/bookmarks/test_savedsearches.js
@@ -3,28 +3,26 @@
/* 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/. */
// a search term that matches a default bookmark
const searchTerm = "about";
var testRoot;
-var testRootId;
add_task(async function setup() {
// create a folder to hold all the tests
// this makes the tests more tolerant of changes to the default bookmarks set
// also, name it using the search term, for testing that containers that match don't show up in query results
testRoot = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
title: searchTerm,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
});
- testRootId = await PlacesUtils.promiseItemId(testRoot.guid);
});
add_task(async function test_savedsearches_bookmarks() {
// add a bookmark that matches the search term
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
title: searchTerm,
url: "http://foo.com",
@@ -38,17 +36,17 @@ add_task(async function test_savedsearch
});
// query for the test root, expandQueries=0
// the query should show up as a regular bookmark
try {
let options = PlacesUtils.history.getNewQueryOptions();
options.expandQueries = 0;
let query = PlacesUtils.history.getNewQuery();
- query.setFolders([testRootId], 1);
+ query.setParents([testRoot.guid], 1);
let result = PlacesUtils.history.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
Assert.equal(cc, 1);
for (let i = 0; i < cc; i++) {
let node = rootNode.getChild(i);
// test that queries have valid itemId
@@ -64,17 +62,17 @@ add_task(async function test_savedsearch
// bookmark saved search
// query for the test root, expandQueries=1
// the query should show up as a query container, with 1 child
try {
let options = PlacesUtils.history.getNewQueryOptions();
options.expandQueries = 1;
let query = PlacesUtils.history.getNewQuery();
- query.setFolders([testRootId], 1);
+ query.setParents([testRoot.guid], 1);
let result = PlacesUtils.history.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
Assert.equal(cc, 1);
for (let i = 0; i < cc; i++) {
let node = rootNode.getChild(i);
// test that query node type is container when expandQueries=1
@@ -140,17 +138,17 @@ add_task(async function test_savedsearch
});
// query for the test root, expandQueries=1
// the query should show up as a query container, with 1 child
try {
var options = PlacesUtils.history.getNewQueryOptions();
options.expandQueries = 1;
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([testRootId], 1);
+ query.setParents([testRoot.guid], 1);
var result = PlacesUtils.history.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
var cc = rootNode.childCount;
Assert.equal(cc, 1);
for (var i = 0; i < cc; i++) {
var node = rootNode.getChild(i);
// test that query node type is container when expandQueries=1
--- a/toolkit/components/places/tests/bookmarks/test_untitled.js
+++ b/toolkit/components/places/tests/bookmarks/test_untitled.js
@@ -5,17 +5,17 @@ add_task(async function test_untitled_vi
url: fxURI,
title: "Get Firefox!",
visits: [{
date: new Date(),
transition: PlacesUtils.history.TRANSITIONS.TYPED,
}],
});
- let {root: node} = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId);
+ let {root: node} = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid);
try {
let fxBmk = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: fxURI,
});
strictEqual(fxBmk.title, "", "Visited bookmark should not have title");
@@ -34,17 +34,17 @@ add_task(async function test_untitled_vi
}
await PlacesUtils.bookmarks.eraseEverything();
});
add_task(async function test_untitled_unvisited_bookmark() {
let tbURI = uri("http://getthunderbird.com");
- let {root: node} = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId);
+ let {root: node} = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid);
try {
let tbBmk = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: tbURI,
});
strictEqual(tbBmk.title, "", "Unvisited bookmark should not have title");
@@ -61,17 +61,17 @@ add_task(async function test_untitled_un
} finally {
node.containerOpen = false;
}
await PlacesUtils.bookmarks.eraseEverything();
});
add_task(async function test_untitled_folder() {
- let {root: node} = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId);
+ let {root: node} = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid);
try {
let folder = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
});
await PlacesTestUtils.promiseAsyncUpdates();
--- a/toolkit/components/places/tests/chrome/test_371798.xul
+++ b/toolkit/components/places/tests/chrome/test_371798.xul
@@ -50,17 +50,17 @@ function promiseOnItemChanged() {
});
let bm2 = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: TEST_URI
});
// query for bookmarks
- let rootNode = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
+ let rootNode = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid).root;
// set up observer
let promiseObserved = promiseOnItemChanged();
// modify the bookmark's title
await PlacesUtils.bookmarks.update({
guid: bm2.guid, title: "foo"
});
--- a/toolkit/components/places/tests/favicons/test_query_result_favicon_changed_on_child.js
+++ b/toolkit/components/places/tests/favicons/test_query_result_favicon_changed_on_child.js
@@ -11,18 +11,18 @@ add_task(async function test_query_resul
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
title: "test_bookmark",
url: PAGE_URI
});
// Get the last 10 bookmarks added to the menu or the toolbar.
let query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.toolbarFolderId], 2);
+ query.setParents([PlacesUtils.bookmarks.menuGuid,
+ PlacesUtils.bookmarks.toolbarGuid], 2);
let options = PlacesUtils.history.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
options.maxResults = 10;
options.excludeQueries = 1;
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
let result = PlacesUtils.history.executeQuery(query, options);
@@ -75,17 +75,17 @@ add_task(async function test_query_resul
// Bookmark our test page, so it will appear in the query resultset.
const PAGE_URI2 = Services.io.newURI("http://example.com/test_query_result");
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
title: "test_bookmark",
url: PAGE_URI2
});
- let result = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId);
+ let result = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.menuGuid);
Assert.equal(result.root.childCount, 1,
"Should have only one item in the query");
Assert.equal(result.root.getChild(0).uri, PAGE_URI2.spec,
"Should have the correct child");
Assert.equal(result.root.getChild(0).lastModified, PlacesUtils.toPRTime(bm.lastModified),
"Should have the expected last modified date.");
--- a/toolkit/components/places/tests/legacy/test_bookmarks.js
+++ b/toolkit/components/places/tests/legacy/test_bookmarks.js
@@ -102,16 +102,17 @@ add_task(async function test_bookmarks()
Assert.equal(bs.getFolderIdForItem(bs.tagsFolder), bs.placesRoot);
Assert.equal(bs.getFolderIdForItem(bs.toolbarFolder), bs.placesRoot);
Assert.equal(bs.getFolderIdForItem(bs.unfiledBookmarksFolder), bs.placesRoot);
// create a folder to hold all the tests
// this makes the tests more tolerant of changes to default_places.html
let testRoot = bs.createFolder(root, "places bookmarks xpcshell tests",
bs.DEFAULT_INDEX);
+ let testRootGuid = await PlacesUtils.promiseItemGuid(testRoot);
Assert.equal(bookmarksObserver._itemAddedId, testRoot);
Assert.equal(bookmarksObserver._itemAddedParent, root);
Assert.equal(bookmarksObserver._itemAddedIndex, bmStartIndex);
Assert.equal(bookmarksObserver._itemAddedURI, null);
let testStartIndex = 0;
// insert a bookmark.
// the time before we insert, in microseconds
@@ -244,17 +245,17 @@ add_task(async function test_bookmarks()
// change item
bs.setItemTitle(newId6, "Google Sites");
Assert.equal(bookmarksObserver._itemChangedProperty, "title");
// test bookmark id in query output
try {
let options = hs.getNewQueryOptions();
let query = hs.getNewQuery();
- query.setFolders([testRoot], 1);
+ query.setParents([testRootGuid], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
info("bookmark itemId test: CC = " + cc);
Assert.ok(cc > 0);
for (let i = 0; i < cc; ++i) {
let node = rootNode.getChild(i);
@@ -274,24 +275,25 @@ add_task(async function test_bookmarks()
// test that multiple bookmarks with same URI show up right in bookmark
// folder queries, todo: also to do for complex folder queries
try {
// test uri
let mURI = uri("http://multiple.uris.in.query");
let testFolder = bs.createFolder(testRoot, "test Folder", bs.DEFAULT_INDEX);
+ let testFolderGuid = await PlacesUtils.promiseItemGuid(testFolder);
// add 2 bookmarks
bs.insertBookmark(testFolder, mURI, bs.DEFAULT_INDEX, "title 1");
bs.insertBookmark(testFolder, mURI, bs.DEFAULT_INDEX, "title 2");
// query
let options = hs.getNewQueryOptions();
let query = hs.getNewQuery();
- query.setFolders([testFolder], 1);
+ query.setParents([testFolderGuid], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
Assert.equal(cc, 2);
Assert.equal(rootNode.getChild(0).title, "title 1");
Assert.equal(rootNode.getChild(1).title, "title 2");
rootNode.containerOpen = false;
@@ -378,17 +380,17 @@ add_task(async function test_bookmarks()
do_throw("bookmarks query: " + ex);
}
// test dateAdded and lastModified properties
// for a folder query
try {
let options = hs.getNewQueryOptions();
let query = hs.getNewQuery();
- query.setFolders([testRoot], 1);
+ query.setParents([testRootGuid], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
Assert.ok(cc > 0);
for (let i = 0; i < cc; i++) {
let node = rootNode.getChild(i);
@@ -436,27 +438,28 @@ add_task(async function test_bookmarks()
// test title length after updates
bs.setItemTitle(newId15, title15 + " updated");
Assert.equal(bs.getItemTitle(newId15).length,
title15expected.length);
Assert.equal(bookmarksObserver._itemChangedId, newId15);
Assert.equal(bookmarksObserver._itemChangedProperty, "title");
Assert.equal(bookmarksObserver._itemChangedValue, title15expected);
- testSimpleFolderResult();
+ await testSimpleFolderResult();
});
-function testSimpleFolderResult() {
+async function testSimpleFolderResult() {
// the time before we create a folder, in microseconds
// Workaround possible VM timers issues subtracting 1us.
let beforeCreate = Date.now() * 1000 - 1;
Assert.ok(beforeCreate > 0);
// create a folder
let parent = bs.createFolder(root, "test", bs.DEFAULT_INDEX);
+ let parentGuid = await PlacesUtils.promiseItemGuid(parent);
// the time before we insert, in microseconds
// Workaround possible VM timers issues subtracting 1ms.
let beforeInsert = Date.now() * 1000 - 1;
Assert.ok(beforeInsert > 0);
// re-set item title separately so can test nodes' last modified
let item = bs.insertBookmark(parent, uri("about:blank"),
@@ -468,17 +471,17 @@ function testSimpleFolderResult() {
bs.setItemTitle(folder, "test folder");
let longName = Array(TITLE_LENGTH_MAX + 5).join("A");
let folderLongName = bs.createFolder(parent, longName, bs.DEFAULT_INDEX);
Assert.equal(bookmarksObserver._itemAddedTitle, longName.substring(0, TITLE_LENGTH_MAX));
let options = hs.getNewQueryOptions();
let query = hs.getNewQuery();
- query.setFolders([parent], 1);
+ query.setParents([parentGuid], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
Assert.equal(rootNode.childCount, 3);
let node = rootNode.getChild(0);
Assert.equal(node.itemId, item);
Assert.ok(node.dateAdded > 0);
@@ -501,25 +504,8 @@ function testSimpleFolderResult() {
Assert.equal(bookmarksObserver._itemChangedProperty, "title");
Assert.equal(bookmarksObserver._itemChangedValue, longName.substring(0, TITLE_LENGTH_MAX));
node = rootNode.getChild(2);
Assert.equal(node.title, longName.substring(0, TITLE_LENGTH_MAX));
rootNode.containerOpen = false;
}
-
-function getChildCount(aFolderId) {
- let cc = -1;
- try {
- let options = hs.getNewQueryOptions();
- let query = hs.getNewQuery();
- query.setFolders([aFolderId], 1);
- let result = hs.executeQuery(query, options);
- let rootNode = result.root;
- rootNode.containerOpen = true;
- cc = rootNode.childCount;
- rootNode.containerOpen = false;
- } catch (ex) {
- do_throw("getChildCount failed: " + ex);
- }
- return cc;
-}
--- a/toolkit/components/places/tests/queries/test_async.js
+++ b/toolkit/components/places/tests/queries/test_async.js
@@ -236,17 +236,17 @@ Test.prototype = {
{ type: "separator" },
{ type: "folder" },
{ type: "bookmark", uri: "place:terms=foo" }
]);
await task_populateDB(this.data);
// Make a query.
this.query = PlacesUtils.history.getNewQuery();
- this.query.setFolders([DataHelper.defaults.bookmark.parent], 1);
+ this.query.setParents([DataHelper.defaults.bookmark.parentGuid], 1);
this.opts = PlacesUtils.history.getNewQueryOptions();
this.opts.asyncEnabled = true;
this.result = PlacesUtils.history.executeQuery(this.query, this.opts);
},
/**
* Call this when the test has succeeded. It cleans up resources and starts
* the next test.
@@ -260,30 +260,27 @@ Test.prototype = {
};
/**
* This makes it a little bit easier to use the functions of head_queries.js.
*/
var DataHelper = {
defaults: {
bookmark: {
- parent: PlacesUtils.bookmarks.unfiledBookmarksFolder,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
uri: "http://example.com/",
title: "test bookmark"
},
folder: {
- parent: PlacesUtils.bookmarks.unfiledBookmarksFolder,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
title: "test folder"
},
separator: {
- parent: PlacesUtils.bookmarks.unfiledBookmarksFolder,
parentGuid: PlacesUtils.bookmarks.unfiledGuid
}
},
/**
* Converts an array of simple bookmark item descriptions to the more verbose
* format required by task_populateDB() in head_queries.js.
*
--- a/toolkit/components/places/tests/queries/test_bookmarks.js
+++ b/toolkit/components/places/tests/queries/test_bookmarks.js
@@ -14,26 +14,26 @@ add_task(async function test_eraseEveryt
{ title: "sub-folder",
type: PlacesUtils.bookmarks.TYPE_FOLDER },
{ type: PlacesUtils.bookmarks.TYPE_SEPARATOR },
]
}
]
});
- let unfiled = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ let unfiled = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
Assert.equal(unfiled.childCount, 1, "There should be 1 folder");
let folder = unfiled.getChild(0);
// Test dateAdded and lastModified properties.
Assert.equal(typeof folder.dateAdded, "number");
Assert.ok(folder.dateAdded > 0);
Assert.equal(typeof folder.lastModified, "number");
Assert.ok(folder.lastModified > 0);
- let root = PlacesUtils.getFolderContents(folder.itemId).root;
+ let root = PlacesUtils.getFolderContents(folder.bookmarkGuid).root;
Assert.equal(root.childCount, 4, "The folder should have 4 children");
for (let i = 0; i < root.childCount; ++i) {
let node = root.getChild(i);
Assert.ok(node.itemId > 0, "The node should have an itemId");
}
Assert.equal(root.getChild(0).title, "title 1");
Assert.equal(root.getChild(1).title, "title 2");
await PlacesUtils.bookmarks.eraseEverything();
@@ -72,17 +72,17 @@ add_task(async function test_search_titl
add_task(async function test_long_title() {
let title = Array(TITLE_LENGTH_MAX + 5).join("A");
let bm = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "http://mozilla.org/",
title,
});
- let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
root.containerOpen = true;
Assert.equal(root.childCount, 1);
let node = root.getChild(0);
Assert.equal(node.title, title.substr(0, TITLE_LENGTH_MAX));
// Update with another long title.
let newTitle = Array(TITLE_LENGTH_MAX + 5).join("B");
bm.title = newTitle;
--- a/toolkit/components/places/tests/queries/test_excludeQueries.js
+++ b/toolkit/components/places/tests/queries/test_excludeQueries.js
@@ -17,17 +17,17 @@ add_task(async function setup() {
});
fakeQuery = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "place:terms=foo",
title: "a bookmark"
});
folderShortcut = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
- url: "place:folder=TOOLBAR",
+ url: `place:parent=${PlacesUtils.bookmarks.toolbarGuid}`,
title: "a bookmark"
});
checkBookmarkObject(bm);
checkBookmarkObject(fakeQuery);
checkBookmarkObject(folderShortcut);
});
@@ -53,17 +53,17 @@ add_task(async function test_bookmarks_u
root.containerOpen = false;
});
add_task(async function test_bookmarks_excludeQueries() {
// When excluding queries, we exclude actual queries, but not folder shortcuts.
let expectedGuids = [bm.guid, folderShortcut.guid];
let query = {}, options = {};
- let queryString = `place:folder=${PlacesUtils.unfiledBookmarksFolderId}&excludeQueries=1`;
+ let queryString = `place:parent=${PlacesUtils.bookmarks.unfiledGuid}&excludeQueries=1`;
PlacesUtils.history.queryStringToQuery(queryString, query, options);
let root = PlacesUtils.history.executeQuery(query.value, options.value).root;
root.containerOpen = true;
Assert.equal(root.childCount, expectedGuids.length, "Checking root child count");
for (let i = 0; i < expectedGuids.length; i++) {
Assert.equal(root.getChild(i).bookmarkGuid, expectedGuids[i],
--- a/toolkit/components/places/tests/queries/test_history_queries_tags_liveUpdate.js
+++ b/toolkit/components/places/tests/queries/test_history_queries_tags_liveUpdate.js
@@ -90,17 +90,17 @@ add_task(function visits_query() {
PlacesUtils.tagging.untagURI(uri, ["test-tag"]);
Assert.equal(node.tags, null);
}
});
});
add_task(function bookmarks_query() {
let [query, options] = newQueryWithOptions();
- query.setFolders([PlacesUtils.unfiledBookmarksFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.unfiledGuid], 1);
testQueryContents(query, options, function(root) {
compareArrayToResult([gTestData[0], gTestData[1], gTestData[2]], root);
for (let i = 0; i < root.childCount; i++) {
let node = root.getChild(i);
let uri = NetUtil.newURI(node.uri);
Assert.equal(node.tags, null);
PlacesUtils.tagging.tagURI(uri, ["test-tag"]);
Assert.equal(node.tags, "test-tag");
--- a/toolkit/components/places/tests/queries/test_onlyBookmarked.js
+++ b/toolkit/components/places/tests/queries/test_onlyBookmarked.js
@@ -42,17 +42,17 @@ var testData = [
add_task(async function test_onlyBookmarked() {
// This function in head_queries.js creates our database with the above data
await task_populateDB(testData);
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.queryType = options.QUERY_TYPE_HISTORY;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
--- a/toolkit/components/places/tests/queries/test_options_inherit.js
+++ b/toolkit/components/places/tests/queries/test_options_inherit.js
@@ -40,17 +40,17 @@ add_task(async function() {
await test_query({ expandQueries: false }, 3, 3, 0);
await test_query({ excludeItems: true }, 1, 1, 0);
await test_query({ excludeItems: true, expandQueries: false }, 1, 1, 0);
await test_query({ excludeItems: true, excludeQueries: true }, 1, 0, 0);
});
async function test_query(opts, expectedRootCc, expectedFolderCc, expectedQueryCc) {
let query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.unfiledBookmarksFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.unfiledGuid], 1);
let options = PlacesUtils.history.getNewQueryOptions();
for (const [o, v] of Object.entries(opts)) {
info(`Setting ${o} to ${v}`);
options[o] = v;
}
let root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
--- a/toolkit/components/places/tests/queries/test_queryMultipleFolder.js
+++ b/toolkit/components/places/tests/queries/test_queryMultipleFolder.js
@@ -11,49 +11,48 @@ add_task(async function setup() {
// adding bookmarks in the folders
for (let i = 0; i < 3; ++i) {
let folder = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.menuGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: `Folder${i}`
});
folderGuids.push(folder.guid);
- folderIds.push(await PlacesUtils.promiseItemId(folder.guid));
for (let j = 0; j < 7; ++j) {
let bm = await PlacesUtils.bookmarks.insert({
- parentGuid: (await PlacesUtils.promiseItemGuid(folderIds[i])),
+ parentGuid: folderGuids[i],
url: `http://Bookmark${i}_${j}.com`,
title: ""
});
bookmarkGuids.push(bm.guid);
}
}
});
add_task(async function test_queryMultipleFolders_ids() {
// using queryStringToQuery
let query = {}, options = {};
let maxResults = 20;
- let queryString = `place:${folderIds.map((id) => "folder=" + id).join("&")}&sort=5&maxResults=${maxResults}`;
+ let queryString = `place:${folderGuids.map(guid => "parent=" + guid).join("&")}&sort=5&maxResults=${maxResults}`;
PlacesUtils.history.queryStringToQuery(queryString, query, options);
let rootNode = PlacesUtils.history.executeQuery(query.value, options.value).root;
rootNode.containerOpen = true;
let resultLength = rootNode.childCount;
Assert.equal(resultLength, maxResults);
for (let i = 0; i < resultLength; ++i) {
let node = rootNode.getChild(i);
Assert.equal(bookmarkGuids[i], node.bookmarkGuid, node.uri);
}
rootNode.containerOpen = false;
// using getNewQuery and getNewQueryOptions
query = PlacesUtils.history.getNewQuery();
options = PlacesUtils.history.getNewQueryOptions();
- query.setFolders(folderIds, folderIds.length);
+ query.setParents(folderGuids, folderGuids.length);
options.sortingMode = options.SORT_BY_URI_ASCENDING;
options.maxResults = maxResults;
rootNode = PlacesUtils.history.executeQuery(query, options).root;
rootNode.containerOpen = true;
resultLength = rootNode.childCount;
Assert.equal(resultLength, maxResults);
for (let i = 0; i < resultLength; ++i) {
let node = rootNode.getChild(i);
--- a/toolkit/components/places/tests/queries/test_querySerialization.js
+++ b/toolkit/components/places/tests/queries/test_querySerialization.js
@@ -208,41 +208,42 @@ const querySwitches = [
runs: [
function(aQuery, aQueryOptions) {
aQuery.onlyBookmarked = true;
}
]
},
// getFolders
{
- desc: "nsINavHistoryQuery.getFolders",
+ desc: "nsINavHistoryQuery.getParents",
matches(aQuery1, aQuery2) {
- var q1Folders = aQuery1.getFolders();
- var q2Folders = aQuery2.getFolders();
- if (q1Folders.length !== q2Folders.length)
+ var q1Parents = aQuery1.getParents();
+ var q2Parents = aQuery2.getParents();
+ if (q1Parents.length !== q2Parents.length)
return false;
- for (let i = 0; i < q1Folders.length; i++) {
- if (!q2Folders.includes(q1Folders[i]))
+ for (let i = 0; i < q1Parents.length; i++) {
+ if (!q2Parents.includes(q1Parents[i]))
return false;
}
- for (let i = 0; i < q2Folders.length; i++) {
- if (!q1Folders.includes(q2Folders[i]))
+ for (let i = 0; i < q2Parents.length; i++) {
+ if (!q1Parents.includes(q2Parents[i]))
return false;
}
return true;
},
runs: [
function(aQuery, aQueryOptions) {
- aQuery.setFolders([], 0);
+ aQuery.setParents([], 0);
},
function(aQuery, aQueryOptions) {
- aQuery.setFolders([PlacesUtils.placesRootId], 1);
+ aQuery.setParents([PlacesUtils.bookmarks.rootGuid], 1);
},
function(aQuery, aQueryOptions) {
- aQuery.setFolders([PlacesUtils.placesRootId, PlacesUtils.tagsFolderId], 2);
+ aQuery.setParents([PlacesUtils.bookmarks.rootGuid,
+ PlacesUtils.bookmarks.tagsGuid], 2);
}
]
},
// tags
{
desc: "nsINavHistoryQuery.getTags",
matches(aQuery1, aQuery2) {
if (aQuery1.tagsAreNot !== aQuery2.tagsAreNot)
--- a/toolkit/components/places/tests/queries/test_query_uri_liveupdate.js
+++ b/toolkit/components/places/tests/queries/test_query_uri_liveupdate.js
@@ -6,17 +6,17 @@ add_task(async function test_results_as_
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [
{ url: "http://tag1.moz.com/", tags: ["tag1"] },
{ url: "http://tag2.moz.com/", tags: ["tag2"] },
{ url: "place:tag=tag1" },
]
});
- let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId, false, true).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid, false, true).root;
Assert.equal(root.childCount, 3, "We should get 3 results");
let queryRoot = root.getChild(2);
PlacesUtils.asContainer(queryRoot).containerOpen = true;
Assert.equal(queryRoot.uri, "place:tag=tag1", "Found the query");
Assert.equal(queryRoot.childCount, 1, "We should get 1 result");
Assert.equal(queryRoot.getChild(0).uri, "http://tag1.moz.com/", "Found the tagged bookmark");
--- a/toolkit/components/places/tests/queries/test_results-as-roots.js
+++ b/toolkit/components/places/tests/queries/test_results-as-roots.js
@@ -1,29 +1,29 @@
"use strict";
const MOBILE_BOOKMARKS_PREF = "browser.bookmarks.showMobileBookmarks";
const expectedRoots = [{
title: "BookmarksToolbarFolderTitle",
- uri: "place:folder=TOOLBAR",
+ uri: `place:parent=${PlacesUtils.bookmarks.toolbarGuid}`,
guid: PlacesUtils.bookmarks.virtualToolbarGuid,
}, {
title: "BookmarksMenuFolderTitle",
- uri: "place:folder=BOOKMARKS_MENU",
+ uri: `place:parent=${PlacesUtils.bookmarks.menuGuid}`,
guid: PlacesUtils.bookmarks.virtualMenuGuid,
}, {
title: "OtherBookmarksFolderTitle",
- uri: "place:folder=UNFILED_BOOKMARKS",
+ uri: `place:parent=${PlacesUtils.bookmarks.unfiledGuid}`,
guid: PlacesUtils.bookmarks.virtualUnfiledGuid,
}];
const expectedRootsWithMobile = [...expectedRoots, {
title: "MobileBookmarksFolderTitle",
- uri: "place:folder=MOBILE_BOOKMARKS",
+ uri: `place:parent=${PlacesUtils.bookmarks.mobileGuid}`,
guid: PlacesUtils.bookmarks.virtualMobileGuid,
}];
const placesStrings = Services.strings.createBundle("chrome://places/locale/places.properties");
function getAllBookmarksQuery() {
var query = PlacesUtils.history.getNewQuery();
--- a/toolkit/components/places/tests/queries/test_search_tags.js
+++ b/toolkit/components/places/tests/queries/test_search_tags.js
@@ -22,17 +22,17 @@ add_task(async function test_search_for_
// tag the bookmarked URI
PlacesUtils.tagging.tagURI(uri(testURI), ["elephant", "walrus", "giraffe", "turkey", "hiPPo", "BABOON", "alf"]);
// search for the bookmark, using a tag
var query = PlacesUtils.history.getNewQuery();
query.searchTerms = "elephant";
var options = PlacesUtils.history.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
- query.setFolders([folder], 1);
+ query.setParents([folder.guid], 1);
var result = PlacesUtils.history.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
Assert.equal(rootNode.childCount, 1);
Assert.equal(rootNode.getChild(0).bookmarkGuid, bookmark.guid);
rootNode.containerOpen = false;
--- a/toolkit/components/places/tests/queries/test_sorting.js
+++ b/toolkit/components/places/tests/queries/test_sorting.js
@@ -39,17 +39,17 @@ tests.push({
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
@@ -110,17 +110,17 @@ tests.push({
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
@@ -208,17 +208,17 @@ tests.push({
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
@@ -313,17 +313,17 @@ tests.push({
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
var root = result.root;
@@ -411,17 +411,17 @@ tests.push({
{ uri: uri("http://example.com/c"), transition: TRANSITION_TYPED, visitDate: timeInMicroseconds },
{ uri: uri("http://example.com/c"), transition: TRANSITION_TYPED, visitDate: timeInMicroseconds },
]);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
@@ -499,17 +499,17 @@ tests.push({
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
@@ -595,17 +595,17 @@ tests.push({
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
@@ -693,17 +693,17 @@ tests.push({
// This function in head_queries.js creates our database with the above data
await task_populateDB(this._unsortedData);
},
check() {
// Query
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarks.toolbarFolder], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
query.onlyBookmarked = true;
// query options
var options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = this._sortingMode;
// Results - this gets the result set and opens it for reading and modification.
var result = PlacesUtils.history.executeQuery(query, options);
--- a/toolkit/components/places/tests/sync/test_bookmark_value_changes.js
+++ b/toolkit/components/places/tests/sync/test_bookmark_value_changes.js
@@ -965,17 +965,17 @@ add_task(async function test_rewrite_tag
deepEqual(urisWithTaggy.map(uri => uri.spec).sort(), ["http://example.com/e"],
"Should insert bookmark with new tag");
let urisWithKitty = PlacesUtils.tagging.getURIsForTag("kitty");
deepEqual(urisWithKitty.map(uri => uri.spec).sort(), ["http://example.com/d"],
"Should retain existing tag");
let { root: toolbarContainer } = PlacesUtils.getFolderContents(
- PlacesUtils.toolbarFolderId, false, true);
+ PlacesUtils.bookmarks.toolbarGuid, false, true);
equal(toolbarContainer.childCount, 3,
"Should add queries and bookmark to toolbar");
let containerForB = PlacesUtils.asContainer(toolbarContainer.getChild(0));
containerForB.containerOpen = true;
for (let i = 0; i < containerForB.childCount; ++i) {
let child = containerForB.getChild(i);
equal(child.uri, "http://example.com/e",
--- a/toolkit/components/places/tests/unit/test_1085291.js
+++ b/toolkit/components/places/tests/unit/test_1085291.js
@@ -1,14 +1,14 @@
add_task(async function() {
// test that nodes inserted by incremental update for bookmarks of all types
// have the extra bookmark properties (bookmarkGuid, dateAdded, lastModified).
// getFolderContents opens the root node.
- let root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid).root;
async function insertAndTest(bmInfo) {
bmInfo = await PlacesUtils.bookmarks.insert(bmInfo);
let node = root.getChild(root.childCount - 1);
Assert.equal(node.bookmarkGuid, bmInfo.guid);
Assert.equal(node.dateAdded, bmInfo.dateAdded * 1000);
Assert.equal(node.lastModified, bmInfo.lastModified * 1000);
}
@@ -18,17 +18,17 @@ add_task(async function() {
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
title: "Test Bookmark",
url: "http://test.url.tld" });
// place: query
await insertAndTest({ parentGuid: root.bookmarkGuid,
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
title: "Test Query",
- url: "place:folder=BOOKMARKS_MENU" });
+ url: `place:parent=${PlacesUtils.bookmarks.menuGuid}` });
// folder
await insertAndTest({ parentGuid: root.bookmarkGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: "Test Folder" });
// separator
await insertAndTest({ parentGuid: root.bookmarkGuid,
--- a/toolkit/components/places/tests/unit/test_1105208.js
+++ b/toolkit/components/places/tests/unit/test_1105208.js
@@ -2,25 +2,23 @@
// the shortcut itself has no title set.
add_task(async function() {
let folder = await PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_FOLDER,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "fake"
});
- let folderId = await PlacesUtils.promiseItemId(folder.guid);
-
let shortcutInfo = await PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
- url: `place:folder=${folderId}`
+ url: `place:parent=${folder.guid}`
});
let unfiledRoot =
- PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
let shortcutNode = unfiledRoot.getChild(unfiledRoot.childCount - 1);
Assert.equal(shortcutNode.bookmarkGuid, shortcutInfo.guid);
Assert.equal(shortcutNode.title, folder.title);
unfiledRoot.containerOpen = false;
});
--- a/toolkit/components/places/tests/unit/test_1105866.js
+++ b/toolkit/components/places/tests/unit/test_1105866.js
@@ -1,31 +1,31 @@
add_task(async function test_folder_shortcuts() {
let shortcutInfo = await PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
- url: "place:folder=TOOLBAR"
+ url: `place:parent=${PlacesUtils.bookmarks.toolbarGuid}`
});
let unfiledRoot =
- PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
let shortcutNode = unfiledRoot.getChild(unfiledRoot.childCount - 1);
Assert.strictEqual(shortcutNode.itemId,
await PlacesUtils.promiseItemId(shortcutInfo.guid));
Assert.strictEqual(PlacesUtils.asQuery(shortcutNode).folderItemId,
PlacesUtils.toolbarFolderId);
Assert.strictEqual(shortcutNode.bookmarkGuid, shortcutInfo.guid);
Assert.strictEqual(PlacesUtils.asQuery(shortcutNode).targetFolderGuid,
PlacesUtils.bookmarks.toolbarGuid);
// test that a node added incrementally also behaves just as well.
shortcutInfo = await PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
- url: "place:folder=BOOKMARKS_MENU"
+ url: `place:parent=${PlacesUtils.bookmarks.menuGuid}`
});
shortcutNode = unfiledRoot.getChild(unfiledRoot.childCount - 1);
Assert.strictEqual(shortcutNode.itemId,
await PlacesUtils.promiseItemId(shortcutInfo.guid));
Assert.strictEqual(PlacesUtils.asQuery(shortcutNode).folderItemId,
PlacesUtils.bookmarksMenuFolderId);
Assert.strictEqual(shortcutNode.bookmarkGuid, shortcutInfo.guid);
Assert.strictEqual(PlacesUtils.asQuery(shortcutNode).targetFolderGuid,
@@ -36,17 +36,17 @@ add_task(async function test_folder_shor
add_task(async function test_plain_folder() {
let folderInfo = await PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_FOLDER,
parentGuid: PlacesUtils.bookmarks.unfiledGuid
});
let unfiledRoot =
- PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
let lastChild = unfiledRoot.getChild(unfiledRoot.childCount - 1);
Assert.strictEqual(lastChild.bookmarkGuid, folderInfo.guid);
Assert.strictEqual(PlacesUtils.asQuery(lastChild).targetFolderGuid,
folderInfo.guid);
});
add_task(async function test_non_item_query() {
let options = PlacesUtils.history.getNewQueryOptions();
--- a/toolkit/components/places/tests/unit/test_331487.js
+++ b/toolkit/components/places/tests/unit/test_331487.js
@@ -35,27 +35,25 @@ add_task(async function test_hierarchica
}]
}]
}]
}]
});
let [folderGuid, b1, sf1, b2, sf2, b3] = bookmarks.map((bookmark) => bookmark.guid);
- let testFolderId = await PlacesUtils.promiseItemId(folderGuid);
-
// bookmark query that should result in the "hierarchical" result
// because there is one query, one folder,
// no begin time, no end time, no domain, no uri, no search term
// and no max results. See GetSimpleBookmarksQueryFolder()
// for more details.
var options = histsvc.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
var query = histsvc.getNewQuery();
- query.setFolders([testFolderId], 1);
+ query.setParents([folderGuid], 1);
var result = histsvc.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
Assert.equal(root.childCount, 2);
Assert.equal(root.getChild(0).bookmarkGuid, b1);
Assert.equal(root.getChild(1).bookmarkGuid, sf1);
// check the contents of the subfolder
@@ -78,17 +76,17 @@ add_task(async function test_hierarchica
root.containerOpen = false;
// bookmark query that should result in a flat list
// because we specified max results
options = histsvc.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
options.maxResults = 10;
query = histsvc.getNewQuery();
- query.setFolders([testFolderId], 1);
+ query.setParents([folderGuid], 1);
result = histsvc.executeQuery(query, options);
root = result.root;
root.containerOpen = true;
Assert.equal(root.childCount, 3);
Assert.equal(root.getChild(0).bookmarkGuid, b1);
Assert.equal(root.getChild(1).bookmarkGuid, b2);
Assert.equal(root.getChild(2).bookmarkGuid, b3);
root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_384370.js
+++ b/toolkit/components/places/tests/unit/test_384370.js
@@ -75,17 +75,17 @@ async function validate(infoMsg) {
info(`Validating ${infoMsg}: testTags`);
testTags();
await PlacesTestUtils.promiseAsyncUpdates();
}
// Tests a bookmarks datastore that has a set of bookmarks, etc
// that flex each supported field and feature.
async function testMenuBookmarks() {
- let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.menuGuid).root;
Assert.equal(root.childCount, 3);
let separatorNode = root.getChild(1);
Assert.equal(separatorNode.type, separatorNode.RESULT_TYPE_SEPARATOR);
let folderNode = root.getChild(2);
Assert.equal(folderNode.type, folderNode.RESULT_TYPE_FOLDER);
Assert.equal(folderNode.title, "test");
@@ -119,17 +119,17 @@ async function testMenuBookmarks() {
PlacesUtils.annotations.getItemAnnotation(bookmarkNode.itemId,
DESCRIPTION_ANNO));
folderNode.containerOpen = false;
root.containerOpen = false;
}
async function testToolbarBookmarks() {
- let root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid).root;
// child count (add 3 for pre-existing items)
Assert.equal(root.childCount, bookmarkData.length + 3);
let livemarkNode = root.getChild(1);
Assert.equal("Latest Headlines", livemarkNode.title);
let livemark = await PlacesUtils.livemarks.getLivemark({ id: livemarkNode.itemId });
@@ -153,17 +153,17 @@ async function testToolbarBookmarks() {
bookmarkNode = root.getChild(4);
Assert.equal(bookmarkNode.uri, bookmarkData[1].uri.spec);
Assert.equal(bookmarkNode.title, bookmarkData[1].title);
root.containerOpen = false;
}
function testUnfiledBookmarks() {
- let root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
// child count (add 1 for pre-existing item)
Assert.equal(root.childCount, bookmarkData.length + 1);
for (let i = 1; i < root.childCount; ++i) {
let child = root.getChild(i);
Assert.equal(child.uri, bookmarkData[i - 1].uri.spec);
Assert.equal(child.title, bookmarkData[i - 1].title);
if (child.tags)
Assert.equal(child.tags, bookmarkData[i - 1].title);
deleted file mode 100644
--- a/toolkit/components/places/tests/unit/test_399264_query_to_string.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- 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/. */
-
-/**
- * Obtains the id of the folder obtained from the query.
- *
- * @param aFolderID
- * The id of the folder we want to generate a query for.
- * @returns the string representation of the query for the given folder.
- */
-function query_string(aFolderID) {
- var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsINavHistoryService);
-
- var query = hs.getNewQuery();
- query.setFolders([aFolderID], 1);
- var options = hs.getNewQueryOptions();
- return hs.queryToQueryString(query, options);
-}
-
-function run_test() {
- const QUERIES = [
- "folder=PLACES_ROOT",
- "folder=BOOKMARKS_MENU",
- "folder=TAGS",
- "folder=UNFILED_BOOKMARKS",
- "folder=TOOLBAR"
- ];
- const FOLDER_IDS = [
- PlacesUtils.placesRootId,
- PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.tagsFolderId,
- PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.toolbarFolderId,
- ];
-
- for (var i = 0; i < QUERIES.length; i++) {
- var result = query_string(FOLDER_IDS[i]);
- dump("Looking for '" + QUERIES[i] + "' in '" + result + "'\n");
- Assert.notEqual(-1, result.indexOf(QUERIES[i]));
- }
-}
deleted file mode 100644
--- a/toolkit/components/places/tests/unit/test_399264_string_to_query.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- 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/. */
-
-/**
- * Obtains the id of the folder obtained from the query.
- *
- * @param aQuery
- * The query to obtain the folder id from.
- * @returns the folder id of the folder of the root node of the query.
- */
-function folder_id(aQuery) {
- info("Checking query '" + aQuery + "'\n");
- let query = {}, options = {};
- PlacesUtils.history.queryStringToQuery(aQuery, query, options);
- var result = PlacesUtils.history.executeQuery(query.value, options.value);
- var root = result.root;
- root.containerOpen = true;
- Assert.ok(root.hasChildren);
- var folderID = root.getChild(0).parent.itemId;
- root.containerOpen = false;
- return folderID;
-}
-
-add_task(async function test_history_string_to_query() {
- const QUERIES = [
- "place:folder=PLACES_ROOT",
- "place:folder=BOOKMARKS_MENU",
- "place:folder=TAGS",
- "place:folder=UNFILED_BOOKMARKS",
- "place:folder=TOOLBAR"
- ];
- const FOLDER_IDS = [
- PlacesUtils.placesRootId,
- PlacesUtils.bookmarksMenuFolderId,
- PlacesUtils.tagsFolderId,
- PlacesUtils.unfiledBookmarksFolderId,
- PlacesUtils.toolbarFolderId,
- ];
-
- // add something in the bookmarks menu folder so a query to it returns results
- await PlacesUtils.bookmarks.insert({
- parentGuid: PlacesUtils.bookmarks.menuGuid,
- title: "bmf",
- url: "http://example.com/bmf/",
- });
-
- // add something to the tags folder
- PlacesUtils.tagging.tagURI(uri("http://www.example.com/"), ["tag"]);
-
- // add something to the unfiled bookmarks folder
- await PlacesUtils.bookmarks.insert({
- parentGuid: PlacesUtils.bookmarks.unfiledGuid,
- title: "ubf",
- url: "http://example.com/ubf/",
- });
-
- // add something to the toolbar folder
- await PlacesUtils.bookmarks.insert({
- parentGuid: PlacesUtils.bookmarks.toolbarGuid,
- title: "tf",
- url: "http://example.com/tf/",
- });
-
- for (let i = 0; i < QUERIES.length; i++) {
- let result = folder_id(QUERIES[i]);
- Assert.equal(FOLDER_IDS[i], result);
- }
-});
--- a/toolkit/components/places/tests/unit/test_419792_node_tags_property.js
+++ b/toolkit/components/places/tests/unit/test_419792_node_tags_property.js
@@ -9,17 +9,17 @@ var histsvc = Cc["@mozilla.org/browser/n
getService(Ci.nsINavHistoryService);
var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
getService(Ci.nsITaggingService);
add_task(async function test_query_node_tags_property() {
// get toolbar node
var options = histsvc.getNewQueryOptions();
var query = histsvc.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var result = histsvc.executeQuery(query, options);
var toolbarNode = result.root;
toolbarNode.containerOpen = true;
// add a bookmark
var bookmarkURI = uri("http://foo.com");
let bookmark = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
--- a/toolkit/components/places/tests/unit/test_429505_remove_shortcuts.js
+++ b/toolkit/components/places/tests/unit/test_429505_remove_shortcuts.js
@@ -16,25 +16,23 @@
add_task(async function test_query_with_remove_shortcut() {
let folder = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
});
- let folderId = await PlacesUtils.promiseItemId(folder.guid);
-
let query = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "",
- url: `place:folder=${folderId}`,
+ url: `place:parent=${folder.guid}`,
});
- var root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId, false, true).root;
+ var root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid, false, true).root;
var oldCount = root.childCount;
await PlacesUtils.bookmarks.remove(query.guid);
Assert.equal(root.childCount, oldCount - 1);
root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_433317_query_title_update.js
+++ b/toolkit/components/places/tests/unit/test_433317_query_title_update.js
@@ -17,17 +17,17 @@ add_task(async function test_query_title
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "test query",
url: "place:",
});
// query for that query
var options = histsvc.getNewQueryOptions();
let query = histsvc.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var result = histsvc.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
var queryNode = root.getChild(0);
Assert.equal(queryNode.title, "test query");
// change the title
await PlacesUtils.bookmarks.update({
--- a/toolkit/components/places/tests/unit/test_433525_hasChildren_crash.js
+++ b/toolkit/components/places/tests/unit/test_433525_hasChildren_crash.js
@@ -34,17 +34,17 @@ add_task(async function test_execute() {
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "test query",
url: queryURI,
});
// query for that query
options = histsvc.getNewQueryOptions();
query = histsvc.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
result = histsvc.executeQuery(query, options);
root = result.root;
root.containerOpen = true;
var queryNode = root.getChild(0);
Assert.equal(queryNode.title, "test query");
queryNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
Assert.equal(queryNode.hasChildren, true);
root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -1533,18 +1533,17 @@ add_task(async function test_sort_folder
for (let info of originalOrder) {
info.parentGuid = folder_info.guid;
info.guid = await (info == sep ?
PT.NewSeparator(info).transact() :
PT.NewBookmark(info).transact());
}
});
- let folderId = await PlacesUtils.promiseItemId(folder_info.guid);
- let folderContainer = PlacesUtils.getFolderContents(folderId).root;
+ let folderContainer = PlacesUtils.getFolderContents(folder_info.guid).root;
function ensureOrder(aOrder) {
for (let i = 0; i < folderContainer.childCount; i++) {
Assert.equal(folderContainer.getChild(i).bookmarkGuid, aOrder[i].guid);
}
}
ensureOrder(originalOrder);
await PT.SortByName(folder_info.guid).transact();
--- a/toolkit/components/places/tests/unit/test_bookmarks_html.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html.js
@@ -262,28 +262,17 @@ add_task(async function test_import_onto
await PlacesTestUtils.promiseAsyncUpdates();
await PlacesUtils.bookmarks.eraseEverything();
});
async function testImportedBookmarks() {
for (let group in test_bookmarks) {
info("[testImportedBookmarks()] Checking group '" + group + "'");
- let root;
- switch (group) {
- case "menu":
- root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
- break;
- case "toolbar":
- root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
- break;
- case "unfiled":
- root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
- break;
- }
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks[`${group}Guid`]).root;
let items = test_bookmarks[group];
Assert.equal(root.childCount, items.length);
for (let key in items) {
await checkItem(items[key], root.getChild(key));
}
--- a/toolkit/components/places/tests/unit/test_bookmarks_html_corrupt.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html_corrupt.js
@@ -48,17 +48,17 @@ add_task(async function test_corrupt_dat
* Check for imported bookmarks correctness
*
* @return {Promise}
* @resolves When the checks are finished.
* @rejects Never.
*/
var database_check = async function() {
// BOOKMARKS MENU
- let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.menuGuid).root;
Assert.equal(root.childCount, 2);
let folderNode = root.getChild(1);
Assert.equal(folderNode.type, folderNode.RESULT_TYPE_FOLDER);
Assert.equal(folderNode.title, "test");
let bookmark = await PlacesUtils.bookmarks.fetch({
guid: folderNode.bookmarkGuid
@@ -94,17 +94,17 @@ var database_check = async function() {
PlacesUtils.annotations.getItemAnnotation(bookmarkNode.itemId,
DESCRIPTION_ANNO));
// clean up
folderNode.containerOpen = false;
root.containerOpen = false;
// BOOKMARKS TOOLBAR
- root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
+ root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.toolbarGuid).root;
Assert.equal(root.childCount, 3);
// For now some promises are resolved later, so we can't guarantee an order.
let foundLivemark = false;
for (let i = 0; i < root.childCount; ++i) {
let node = root.getChild(i);
if (node.title == "Latest Headlines") {
foundLivemark = true;
@@ -118,17 +118,17 @@ var database_check = async function() {
}
}
Assert.ok(foundLivemark);
// cleanup
root.containerOpen = false;
// UNFILED BOOKMARKS
- root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid).root;
Assert.equal(root.childCount, 1);
root.containerOpen = false;
// favicons
await new Promise(resolve => {
PlacesUtils.favicons.getFaviconDataForPage(uri(TEST_FAVICON_PAGE_URL),
(aURI, aDataLen, aData, aMimeType) => {
// aURI should never be null when aDataLen > 0.
--- a/toolkit/components/places/tests/unit/test_bookmarks_html_singleframe.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html_singleframe.js
@@ -8,17 +8,17 @@
// Get Services
ChromeUtils.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
add_task(async function test_bookmarks_html_singleframe() {
let bookmarksFile = OS.Path.join(do_get_cwd().path, "bookmarks_html_singleframe.html");
await BookmarkHTMLUtils.importFromFile(bookmarksFile, { replace: true });
- let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks.menuGuid).root;
Assert.equal(root.childCount, 1);
let folder = root.getChild(0);
PlacesUtils.asContainer(folder).containerOpen = true;
Assert.equal(folder.title, "Subtitle");
Assert.equal(folder.childCount, 1);
let bookmark = folder.getChild(0);
Assert.equal(bookmark.uri, "http://www.mozilla.org/");
Assert.equal(bookmark.title, "Mozilla");
--- a/toolkit/components/places/tests/unit/test_bookmarks_json.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_json.js
@@ -133,31 +133,17 @@ add_task(async function test_import_onto
add_task(async function test_clean() {
await PlacesUtils.bookmarks.eraseEverything();
});
async function testImportedBookmarks() {
for (let group in test_bookmarks) {
info("[testImportedBookmarks()] Checking group '" + group + "'");
- let root;
- switch (group) {
- case "menu":
- root =
- PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
- break;
- case "toolbar":
- root =
- PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
- break;
- case "unfiled":
- root =
- PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
- break;
- }
+ let root = PlacesUtils.getFolderContents(PlacesUtils.bookmarks[`${group}Guid`]).root;
let items = test_bookmarks[group];
Assert.equal(root.childCount, items.length);
for (let key in items) {
await checkItem(items[key], root.getChild(key));
}
--- a/toolkit/components/places/tests/unit/test_broken_folderShortcut_result.js
+++ b/toolkit/components/places/tests/unit/test_broken_folderShortcut_result.js
@@ -3,71 +3,71 @@
add_task(async function test_brokenFolderShortcut() {
let bookmarks = await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.unfiledGuid,
children: [{
url: "http://1.moz.org/",
title: "Bookmark 1",
}, {
- url: "place:folder=1234",
+ url: "place:parent=1234",
title: "Shortcut 1",
}, {
- url: "place:folder=-1",
+ url: "place:parent=-1",
title: "Shortcut 2",
}, {
url: "http://2.moz.org/",
title: "Bookmark 2",
}]
});
// Add also a simple visit.
await PlacesTestUtils.addVisits(uri(("http://3.moz.org/")));
// Query containing a broken folder shortcuts among results.
let query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.unfiledBookmarksFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.unfiledGuid], 1);
let options = PlacesUtils.history.getNewQueryOptions();
let root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
Assert.equal(root.childCount, 4);
let shortcut = root.getChild(1);
- Assert.equal(shortcut.uri, "place:folder=1234");
+ Assert.equal(shortcut.uri, "place:parent=1234");
PlacesUtils.asContainer(shortcut);
shortcut.containerOpen = true;
Assert.equal(shortcut.childCount, 0);
shortcut.containerOpen = false;
// Remove the broken shortcut while the containing result is open.
await PlacesUtils.bookmarks.remove(bookmarks[1]);
Assert.equal(root.childCount, 3);
shortcut = root.getChild(1);
- Assert.equal(shortcut.uri, "place:folder=-1");
+ Assert.equal(shortcut.uri, "place:parent=-1");
PlacesUtils.asContainer(shortcut);
shortcut.containerOpen = true;
Assert.equal(shortcut.childCount, 0);
shortcut.containerOpen = false;
// Remove the broken shortcut while the containing result is open.
await PlacesUtils.bookmarks.remove(bookmarks[2]);
Assert.equal(root.childCount, 2);
root.containerOpen = false;
// Broken folder shortcut as root node.
query = PlacesUtils.history.getNewQuery();
- query.setFolders([1234], 1);
+ query.setParents([1234], 1);
options = PlacesUtils.history.getNewQueryOptions();
root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
Assert.equal(root.childCount, 0);
root.containerOpen = false;
// Broken folder shortcut as root node with folder=-1.
query = PlacesUtils.history.getNewQuery();
- query.setFolders([-1], 1);
+ query.setParents([-1], 1);
options = PlacesUtils.history.getNewQueryOptions();
root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
Assert.equal(root.childCount, 0);
root.containerOpen = false;
});
--- a/toolkit/components/places/tests/unit/test_browserhistory.js
+++ b/toolkit/components/places/tests/unit/test_browserhistory.js
@@ -46,17 +46,17 @@ add_task(async function test_removePages
PlacesUtils.annotations.setPageAnnotation(pages[BOOKMARK_INDEX],
ANNO_NAME, ANNO_VALUE, 0,
Ci.nsIAnnotationService.EXPIRE_NEVER);
await PlacesUtils.history.remove(pages);
Assert.ok(await checkEmptyHistory(), "History is empty");
// Check that the bookmark and its annotation still exist.
- let folder = await PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId);
+ let folder = await PlacesUtils.getFolderContents(PlacesUtils.bookmarks.unfiledGuid);
Assert.equal(folder.root.childCount, 1);
Assert.equal(PlacesUtils.annotations.getPageAnnotation(pages[BOOKMARK_INDEX], ANNO_NAME),
ANNO_VALUE);
// Check the annotation on the non-bookmarked page does not exist anymore.
try {
PlacesUtils.annotations.getPageAnnotation(pages[ANNO_INDEX], ANNO_NAME);
do_throw("did not expire expire_never anno on a not bookmarked item");
--- a/toolkit/components/places/tests/unit/test_getChildIndex.js
+++ b/toolkit/components/places/tests/unit/test_getChildIndex.js
@@ -19,24 +19,24 @@ add_task(async function test_get_child_i
// Add a bookmark to unfiled folder.
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "http://test.mozilla.org/unfiled/",
title: "Unfiled bookmark"
});
// Get the unfiled bookmark node.
- let unfiledNode = getNodeAt(PlacesUtils.unfiledBookmarksFolderId, 0);
+ let unfiledNode = getNodeAt(PlacesUtils.bookmarks.unfiledGuid, 0);
if (!unfiledNode)
do_throw("Unable to find bookmark in hierarchy!");
Assert.equal(unfiledNode.title, "Unfiled bookmark");
let hs = PlacesUtils.history;
let query = hs.getNewQuery();
- query.setFolders([PlacesUtils.bookmarksMenuFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.menuGuid], 1);
let options = hs.getNewQueryOptions();
options.queryType = options.QUERY_TYPE_BOOKMARKS;
let root = hs.executeQuery(query, options).root;
root.containerOpen = true;
// Check functionality for proper nodes.
for (let i = 0; i < root.childCount; i++) {
let node = root.getChild(i);
@@ -50,20 +50,20 @@ add_task(async function test_get_child_i
do_throw("Searching for an invalid node should have thrown.");
} catch (ex) {
print("We correctly got an exception.");
}
root.containerOpen = false;
});
-function getNodeAt(aFolderId, aIndex) {
+function getNodeAt(aFolderGuid, aIndex) {
let hs = PlacesUtils.history;
let query = hs.getNewQuery();
- query.setFolders([aFolderId], 1);
+ query.setParents([aFolderGuid], 1);
let options = hs.getNewQueryOptions();
options.queryType = options.QUERY_TYPE_BOOKMARKS;
let root = hs.executeQuery(query, options).root;
root.containerOpen = true;
if (root.childCount < aIndex)
do_throw("Not enough children to find bookmark!");
let node = root.getChild(aIndex);
root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_history_clear.js
+++ b/toolkit/components/places/tests/unit/test_history_clear.js
@@ -20,17 +20,17 @@ add_task(async function test_history_cle
{ uri: uri("http://redir_perm.mozilla.org/"),
transition: TRANSITION_REDIRECT_PERMANENT,
referrer: "http://link.mozilla.org/"},
]);
// add a place: bookmark
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
- url: "place:folder=4",
+ url: `place:parent=${PlacesUtils.bookmarks.tagsGuid}`,
title: "shortcut"
});
// Add an expire never annotation
// Actually expire never annotations are removed as soon as a page is removed
// from the database, so this should act as a normal visit.
PlacesUtils.annotations.setPageAnnotation(uri("http://download.mozilla.org/"),
"never", "never", 0,
--- a/toolkit/components/places/tests/unit/test_history_sidebar.js
+++ b/toolkit/components/places/tests/unit/test_history_sidebar.js
@@ -394,17 +394,17 @@ async function task_test_date_liveupdate
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
url: "place:type=" + aResultType,
title: "",
});
// Query toolbar and open our query container, then check again liveupdate.
options = hs.getNewQueryOptions();
query = hs.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
result = hs.executeQuery(query, options);
root = result.root;
root.containerOpen = true;
Assert.equal(root.childCount, 1);
var dateContainer = root.getChild(0).QueryInterface(Ci.nsINavHistoryContainerResultNode);
dateContainer.containerOpen = true;
Assert.equal(dateContainer.childCount, visibleContainers.length);
--- a/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
+++ b/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
@@ -130,17 +130,17 @@ add_task(async function check_history_qu
result.removeObserver(resultObserver);
resultObserver.reset();
await PlacesTestUtils.promiseAsyncUpdates();
});
add_task(async function check_bookmarks_query() {
let options = PlacesUtils.history.getNewQueryOptions();
let query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.bookmarksMenuFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.menuGuid], 1);
let result = PlacesUtils.history.executeQuery(query, options);
result.addObserver(resultObserver);
let root = result.root;
root.containerOpen = true;
Assert.notEqual(resultObserver.openedContainer, null);
// nsINavHistoryResultObserver.nodeInserted
--- a/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
+++ b/toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js
@@ -25,19 +25,17 @@ add_task(async function test_addBookmark
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
}, {
title: "test folder 2",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
}]
}]
});
- let folderId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
-
- let root = PlacesUtils.getFolderContents(folderId).root;
+ let root = PlacesUtils.getFolderContents(bookmarks[0].guid).root;
Assert.equal(root.childCount, 5);
// check bookmark guids
let bookmarkGuidZero = root.getChild(0).bookmarkGuid;
Assert.equal(bookmarkGuidZero.length, 12);
// bookmarks have bookmark guids
Assert.equal(root.getChild(1).bookmarkGuid.length, 12);
Assert.equal(root.getChild(2).bookmarkGuid.length, 12);
@@ -80,19 +78,17 @@ add_task(async function test_updateBookm
title: "1 title",
}, {
title: "test folder 2",
type: PlacesUtils.bookmarks.TYPE_FOLDER,
}]
}]
});
- let folderId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
-
- let root = PlacesUtils.getFolderContents(folderId).root;
+ let root = PlacesUtils.getFolderContents(bookmarks[0].guid).root;
Assert.equal(root.childCount, 2);
// ensure the bookmark and page guids remain the same after modifing other property.
let bookmarkGuidZero = root.getChild(0).bookmarkGuid;
let pageGuidZero = root.getChild(0).pageGuid;
await PlacesUtils.bookmarks.update({
guid: bookmarks[1].guid,
title: "1 title mod",
@@ -193,19 +189,17 @@ add_task(async function test_addItemsWit
guid: BOOKMARK_GUID,
}, {
type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
guid: SEPARATOR_GUID,
}]
}]
});
- let folderId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
-
- let root = PlacesUtils.getFolderContents(folderId).root;
+ let root = PlacesUtils.getFolderContents(bookmarks[0].guid).root;
Assert.equal(root.childCount, 2);
Assert.equal(root.bookmarkGuid, FOLDER_GUID);
Assert.equal(root.getChild(0).bookmarkGuid, BOOKMARK_GUID);
Assert.equal(root.getChild(1).bookmarkGuid, SEPARATOR_GUID);
root.containerOpen = false;
await PlacesUtils.bookmarks.eraseEverything();
});
--- a/toolkit/components/places/tests/unit/test_placeURIs.js
+++ b/toolkit/components/places/tests/unit/test_placeURIs.js
@@ -5,24 +5,23 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
// TODO: Improve testing coverage for QueryToQueryString and QueryStringToQuery
// Bug 376798
let query = PlacesUtils.history.getNewQuery();
let options = PlacesUtils.history.getNewQueryOptions();
- query.setFolders([PlacesUtils.bookmarks.placesRoot], 1);
+ query.setParents([PlacesUtils.bookmarks.rootGuid], 1);
Assert.equal(PlacesUtils.history.queryToQueryString(query, options),
- "place:folder=PLACES_ROOT");
+ `place:parent=${PlacesUtils.bookmarks.rootGuid}`);
// Bug 378828
options.sortingAnnotation = "test anno";
options.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING;
var placeURI =
- "place:folder=PLACES_ROOT&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING +
- "&sortingAnnotation=test%20anno";
+ `place:parent=${PlacesUtils.bookmarks.rootGuid}&sort=${Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING}&sortingAnnotation=test%20anno`;
Assert.equal(PlacesUtils.history.queryToQueryString(query, options), placeURI);
options = {};
PlacesUtils.history.queryStringToQuery(placeURI, {}, options);
Assert.equal(options.value.sortingAnnotation, "test anno");
Assert.equal(options.value.sortingMode, Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING);
}
--- a/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
+++ b/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
@@ -184,22 +184,20 @@ async function test_promiseBookmarksTree
if (child.itemId != PlacesUtils.tagsFolderId)
await test_promiseBookmarksTreeForEachNode(child,
{ includeItemIds: true },
aExcludedGuids);
}
return item;
}
-async function test_promiseBookmarksTreeAgainstResult(aItemGuid = "",
+async function test_promiseBookmarksTreeAgainstResult(aItemGuid = PlacesUtils.bookmarks.rootGuid,
aOptions = { includeItemIds: true },
aExcludedGuids) {
- let itemId = aItemGuid ?
- await PlacesUtils.promiseItemId(aItemGuid) : PlacesUtils.placesRootId;
- let node = PlacesUtils.getFolderContents(itemId).root;
+ let node = PlacesUtils.getFolderContents(aItemGuid).root;
return test_promiseBookmarksTreeForEachNode(node, aOptions, aExcludedGuids);
}
add_task(async function() {
// Add some bookmarks to cover various use cases.
await new_bookmark({ parentGuid: PlacesUtils.bookmarks.toolbarGuid });
await new_folder({ parentGuid: PlacesUtils.bookmarks.menuGuid,
annotations: [{ name: "TestAnnoA", value: "TestVal" },
--- a/toolkit/components/places/tests/unit/test_result_sort.js
+++ b/toolkit/components/places/tests/unit/test_result_sort.js
@@ -41,24 +41,22 @@ add_task(async function test() {
}, {
// url of the first child, title of second
title: "a",
url: uri1,
}, ]
}]
});
- let testFolderId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
-
let guid1 = bookmarks[1].guid;
let guid2 = bookmarks[2].guid;
let guid3 = bookmarks[3].guid;
// query with natural order
- let result = PlacesUtils.getFolderContents(testFolderId);
+ let result = PlacesUtils.getFolderContents(bookmarks[0].guid);
let root = result.root;
Assert.equal(root.childCount, 3);
function checkOrder(a, b, c) {
Assert.equal(root.getChild(0).bookmarkGuid, a);
Assert.equal(root.getChild(1).bookmarkGuid, b);
Assert.equal(root.getChild(2).bookmarkGuid, c);
--- a/toolkit/components/places/tests/unit/test_resultsAsVisit_details.js
+++ b/toolkit/components/places/tests/unit/test_resultsAsVisit_details.js
@@ -70,19 +70,17 @@ add_task(async function test_bookmarkFie
type: PlacesUtils.bookmarks.TYPE_FOLDER,
children: [{
title: "test title",
url: "http://test4.com",
}]
}],
});
- let folderId = await PlacesUtils.promiseItemId(bookmarks[0].guid);
-
- let root = PlacesUtils.getFolderContents(folderId).root;
+ let root = PlacesUtils.getFolderContents(bookmarks[0].guid).root;
equal(root.childCount, 1);
equal(root.visitType, 0, "Visit type should be 0");
equal(root.visitId, -1, "Visit ID should be -1");
equal(root.fromVisitId, -1, "Referrer visit id should be -1");
let child = root.getChild(0);
equal(child.visitType, 0, "Visit type should be 0");
--- a/toolkit/components/places/tests/unit/test_tagging.js
+++ b/toolkit/components/places/tests/unit/test_tagging.js
@@ -8,17 +8,17 @@
// service and restart it.
var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
createInstance().QueryInterface(Ci.nsITaggingService);
function run_test() {
var options = PlacesUtils.history.getNewQueryOptions();
var query = PlacesUtils.history.getNewQuery();
- query.setFolders([PlacesUtils.tagsFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.tagsGuid], 1);
var result = PlacesUtils.history.executeQuery(query, options);
var tagRoot = result.root;
tagRoot.containerOpen = true;
Assert.equal(tagRoot.childCount, 0);
var uri1 = uri("http://foo.tld/");
var uri2 = uri("https://bar.tld/");
--- a/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
+++ b/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
@@ -30,17 +30,17 @@ add_task(async function test_getURLsForC
url: "place:sort=1",
title: "inside query",
}]
}]
}],
});
var query = hs.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var options = hs.getNewQueryOptions();
info("Check folder without uri nodes");
check_uri_nodes(query, options, 0);
info("Check folder with uri nodes");
// Add an uri node, this should be considered.
await PlacesUtils.bookmarks.insert({
@@ -70,17 +70,17 @@ add_task(async function test_getURLsForC
url: "place:sort=1",
title: "inside query",
}]
}]
}],
});
var query = hs.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var options = hs.getNewQueryOptions();
options.excludeItems = true;
info("Check folder without uri nodes");
check_uri_nodes(query, options, 0);
info("Check folder with uri nodes");
// Add an uri node, this should be considered.
@@ -95,17 +95,17 @@ add_task(async function test_getURLsForC
});
add_task(async function test_getURLsForContainerNode_query() {
info("*** TEST: query");
// This is the query we will check for children.
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "inside query",
- url: "place:folder=BOOKMARKS_MENU&sort=1",
+ url: `place:parent=${PlacesUtils.bookmarks.menuGuid}&sort=1`,
});
// Create a folder and a query node inside it, these should not be considered
// uri nodes.
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.menuGuid,
children: [{
title: "inside folder",
@@ -113,17 +113,17 @@ add_task(async function test_getURLsForC
children: [{
url: "place:sort=1",
title: "inside query",
}]
}],
});
var query = hs.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var options = hs.getNewQueryOptions();
info("Check query without uri nodes");
check_uri_nodes(query, options, 0);
info("Check query with uri nodes");
// Add an uri node, this should be considered.
await PlacesUtils.bookmarks.insert({
@@ -137,17 +137,17 @@ add_task(async function test_getURLsForC
});
add_task(async function test_getURLsForContainerNode_query_excludeItems() {
info("*** TEST: excludeItems Query");
// This is the query we will check for children.
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "inside query",
- url: "place:folder=BOOKMARKS_MENU&sort=1",
+ url: `place:parent=${PlacesUtils.bookmarks.menuGuid}&sort=1`,
});
// Create a folder and a query node inside it, these should not be considered
// uri nodes.
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.menuGuid,
children: [{
title: "inside folder",
@@ -155,17 +155,17 @@ add_task(async function test_getURLsForC
children: [{
url: "place:sort=1",
title: "inside query",
}]
}],
});
var query = hs.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var options = hs.getNewQueryOptions();
options.excludeItems = true;
info("Check folder without uri nodes");
check_uri_nodes(query, options, 0);
info("Check folder with uri nodes");
// Add an uri node, this should be considered.
@@ -180,17 +180,17 @@ add_task(async function test_getURLsForC
});
add_task(async function test_getURLsForContainerNode_query_excludeQueries() {
info("*** TEST: !expandQueries Query");
// This is the query we will check for children.
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "inside query",
- url: "place:folder=BOOKMARKS_MENU&sort=1",
+ url: `place:parent=${PlacesUtils.bookmarks.menuGuid}&sort=1`,
});
// Create a folder and a query node inside it, these should not be considered
// uri nodes.
await PlacesUtils.bookmarks.insertTree({
guid: PlacesUtils.bookmarks.menuGuid,
children: [{
title: "inside folder",
@@ -198,17 +198,17 @@ add_task(async function test_getURLsForC
children: [{
url: "place:sort=1",
title: "inside query",
}]
}],
});
var query = hs.getNewQuery();
- query.setFolders([PlacesUtils.toolbarFolderId], 1);
+ query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
var options = hs.getNewQueryOptions();
options.expandQueries = false;
info("Check folder without uri nodes");
check_uri_nodes(query, options, 0);
info("Check folder with uri nodes");
// Add an uri node, this should be considered.
--- a/toolkit/components/places/tests/unit/xpcshell.ini
+++ b/toolkit/components/places/tests/unit/xpcshell.ini
@@ -15,18 +15,16 @@ support-files =
mobile_bookmarks_root_merge.json
places.sparse.sqlite
[test_000_frecency.js]
[test_317472.js]
[test_331487.js]
[test_384370.js]
[test_385397.js]
-[test_399264_query_to_string.js]
-[test_399264_string_to_query.js]
[test_399266.js]
# Bug 821781: test fails intermittently on Linux
skip-if = os == "linux"
[test_402799.js]
[test_408221.js]
[test_412132.js]
[test_413784.js]
[test_415460.js]