--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -2391,17 +2391,17 @@ BrowserGlue.prototype = {
title: bundle.GetStringFromName("mostVisitedTitle"),
url: "place:sort=" + queryOptions.SORT_BY_VISITCOUNT_DESCENDING +
"&maxResults=" + MAX_RESULTS,
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
newInVersion: 1
},
RecentTags: {
title: bundle.GetStringFromName("recentTagsTitle"),
- url: "place:type=" + queryOptions.RESULTS_AS_TAG_QUERY +
+ url: "place:type=" + queryOptions.RESULTS_AS_TAGS_ROOT +
"&sort=" + queryOptions.SORT_BY_LASTMODIFIED_DESCENDING +
"&maxResults=" + MAX_RESULTS,
parentGuid: PlacesUtils.bookmarks.menuGuid,
newInVersion: 1
},
};
// Set current guid, parentGuid and index of existing Smart Bookmarks.
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -800,17 +800,17 @@ PlacesController.prototype = {
// The parent may be the root node, that doesn't have a title.
tag = node.parent.query.tags[0];
}
transactions.push(PlacesTransactions.Untag({ urls: [node.uri], tag }));
} else if (PlacesUtils.nodeIsTagQuery(node) &&
node.parent &&
PlacesUtils.nodeIsQuery(node.parent) &&
PlacesUtils.asQuery(node.parent).queryOptions.resultType ==
- Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT) {
// This is a tag container.
// Untag all URIs tagged with this tag only if the tag container is
// child of the "Tags" query in the library, in all other places we
// must only remove the query node.
let tag = node.title;
let URIs = PlacesUtils.tagging.getURIsForTag(tag);
transactions.push(PlacesTransactions.Untag({ tag, urls: URIs }));
} else if (PlacesUtils.nodeIsURI(node) &&
--- a/browser/components/places/content/tree.xml
+++ b/browser/components/places/content/tree.xml
@@ -79,17 +79,17 @@
var queryNode = PlacesUtils.asQuery(this.result.root);
var options = queryNode.queryOptions.clone();
// Make sure we're getting uri results.
// We do not yet support searching into grouped queries or into
// tag containers, so we must fall to the default case.
if (PlacesUtils.nodeIsHistoryContainer(queryNode) ||
PlacesUtils.nodeIsTagQuery(queryNode) ||
- options.resultType == options.RESULTS_AS_TAG_QUERY ||
+ options.resultType == options.RESULTS_AS_TAGS_ROOT ||
options.resultType == options.RESULTS_AS_ROOTS_QUERY)
options.resultType = options.RESULTS_AS_URI;
var query = PlacesUtils.history.getNewQuery();
query.searchTerms = filterString;
if (folderRestrict) {
query.setFolders(folderRestrict, folderRestrict.length);
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -133,17 +133,17 @@ PlacesTreeView.prototype = {
// We don't know enough about non-query containers.
if (!(aContainer instanceof Ci.nsINavHistoryQueryResultNode))
return false;
switch (aContainer.queryOptions.resultType) {
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
- case Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT:
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY:
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_LEFT_PANE_QUERY:
return false;
}
// If it's a folder, it's not a plain container.
let nodeType = aContainer.type;
return nodeType != Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER &&
--- a/browser/components/places/tests/browser/browser_bookmark_folder_moveability.js
+++ b/browser/components/places/tests/browser/browser_bookmark_folder_moveability.js
@@ -68,17 +68,17 @@ add_task(async function() {
info("Test a tag container");
PlacesUtils.tagging.tagURI(Services.io.newURI(bookmark.url.href), ["bar"]);
// Add the tags root query.
let tagsQuery = await PlacesUtils.bookmarks.insert({
parentGuid: root.guid,
title: "",
- url: "place:type=" + Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY,
+ url: "place:type=" + Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT,
});
tree.selectItems([tagsQuery.guid]);
PlacesUtils.asQuery(tree.selectedNode).containerOpen = true;
Assert.equal(tree.selectedNode.childCount, 1, "has tags");
let tagNode = tree.selectedNode.getChild(0);
Assert.ok(!tree.controller.canMoveNode(tagNode),
"should not be able to move tag container node");
tree.selectedNode.containerOpen = false;
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -778,24 +778,24 @@ var PlacesUtils = {
* Determines whether or not a result-node is a tag container.
* @param aNode
* A result-node
* @returns true if the node is a tag container, false otherwise
*/
nodeIsTagQuery: function PU_nodeIsTagQuery(aNode) {
if (aNode.type != Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY)
return false;
- // Direct child of RESULTS_AS_TAG_QUERY.
+ // Direct child of RESULTS_AS_TAGS_ROOT.
let parent = aNode.parent;
if (parent && PlacesUtils.asQuery(parent).queryOptions.resultType ==
- Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY)
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT)
return true;
// We must also support the right pane of the Library, when the tag query
// is the root node. Unfortunately this is also valid for any tag query
- // selected in the left pane that is not a direct child of RESULTS_AS_TAG_QUERY.
+ // selected in the left pane that is not a direct child of RESULTS_AS_TAGS_ROOT.
if (!parent && aNode == aNode.parentResult.root &&
PlacesUtils.asQuery(aNode).query.tags.length == 1)
return true;
return false;
},
/**
* Determines whether or not a ResultNode is a container.
--- a/toolkit/components/places/nsINavHistoryService.idl
+++ b/toolkit/components/places/nsINavHistoryService.idl
@@ -1050,17 +1050,17 @@ interface nsINavHistoryQueryOptions : ns
/**
* This returns nsINavHistoryQueryResultNode nodes for each tag.
* The node contains information how to load its content:
* - list of bookmarks with the given tag will be loaded.
*
* @note Setting this resultType will force queryType to QUERY_TYPE_BOOKMARKS.
*/
- const unsigned short RESULTS_AS_TAG_QUERY = 6;
+ const unsigned short RESULTS_AS_TAGS_ROOT = 6;
/**
* DEPRECATED: This exists for Sync and also to avoid reusing this number.
*/
const unsigned short RESULTS_AS_TAG_CONTENTS = 7;
/**
* This returns nsINavHistoryQueryResultNode nodes for each top-level bookmark
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -1243,17 +1243,17 @@ PlacesSQLQueryBuilder::Select()
NS_ENSURE_SUCCESS(rv, rv);
break;
case nsINavHistoryQueryOptions::RESULTS_AS_SITE_QUERY:
rv = SelectAsSite();
NS_ENSURE_SUCCESS(rv, rv);
break;
- case nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY:
+ case nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT:
rv = SelectAsTag();
NS_ENSURE_SUCCESS(rv, rv);
break;
case nsINavHistoryQueryOptions::RESULTS_AS_ROOTS_QUERY:
rv = SelectAsRoots();
NS_ENSURE_SUCCESS(rv, rv);
break;
@@ -1715,17 +1715,17 @@ PlacesSQLQueryBuilder::SelectAsLeftPane(
"null, null, 0, 0, null, null, null, null, 'tags_______v', null), "
"(null, 'place:type=%d', :OrganizerQueryAllBookmarks, null, null, null, "
"null, null, 0, 0, null, null, null, null, 'allbms_____v', null) "
")",
nsINavHistoryQueryOptions::RESULTS_AS_DATE_QUERY,
nsINavHistoryQueryOptions::SORT_BY_DATE_DESCENDING,
nsINavHistoryService::TRANSITION_DOWNLOAD,
nsINavHistoryQueryOptions::SORT_BY_DATE_DESCENDING,
- nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY,
+ nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT,
nsINavHistoryQueryOptions::SORT_BY_TITLE_ASCENDING,
nsINavHistoryQueryOptions::RESULTS_AS_ROOTS_QUERY);
return NS_OK;
}
nsresult
PlacesSQLQueryBuilder::Where()
{
@@ -3495,18 +3495,18 @@ nsNavHistory::RowToResult(mozIStorageVal
}
RefPtr<nsNavHistoryResultNode> resultNode;
rv = QueryRowToResult(itemId, guid, url, title, accessCount, time,
getter_AddRefs(resultNode));
NS_ENSURE_SUCCESS(rv, rv);
if (itemId != -1 ||
- aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) {
- // RESULTS_AS_TAG_QUERY has date columns
+ aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT) {
+ // RESULTS_AS_TAGS_ROOT has date columns
resultNode->mDateAdded = aRow->AsInt64(kGetInfoIndex_ItemDateAdded);
resultNode->mLastModified = aRow->AsInt64(kGetInfoIndex_ItemLastModified);
if (resultNode->IsFolder()) {
// If it's a simple folder node (i.e. a shortcut to another folder), apply
// our options for it. However, if the parent type was tag query, we do not
// apply them, because it would not yield any results.
resultNode->GetAsContainer()->mOptions = aOptions;
}
--- a/toolkit/components/places/nsNavHistoryQuery.cpp
+++ b/toolkit/components/places/nsNavHistoryQuery.cpp
@@ -1289,17 +1289,17 @@ nsNavHistoryQueryOptions::GetResultType(
}
NS_IMETHODIMP
nsNavHistoryQueryOptions::SetResultType(uint16_t aType)
{
if (aType > RESULTS_AS_LEFT_PANE_QUERY)
return NS_ERROR_INVALID_ARG;
// Tag queries, containers and the roots query are bookmarks related, so we
// set the QueryType accordingly.
- if (aType == RESULTS_AS_TAG_QUERY || aType == RESULTS_AS_ROOTS_QUERY ||
+ if (aType == RESULTS_AS_TAGS_ROOT || aType == RESULTS_AS_ROOTS_QUERY ||
aType == RESULTS_AS_LEFT_PANE_QUERY) {
mQueryType = QUERY_TYPE_BOOKMARKS;
}
mResultType = aType;
return NS_OK;
}
// excludeItems
@@ -1393,17 +1393,17 @@ nsNavHistoryQueryOptions::GetQueryType(u
*_retval = mQueryType;
return NS_OK;
}
NS_IMETHODIMP
nsNavHistoryQueryOptions::SetQueryType(uint16_t aQueryType)
{
// Tag query and containers are forced to QUERY_TYPE_BOOKMARKS when the
// resultType is set.
- if (mResultType == RESULTS_AS_TAG_QUERY ||
+ if (mResultType == RESULTS_AS_TAGS_ROOT ||
mResultType == RESULTS_AS_LEFT_PANE_QUERY ||
mResultType == RESULTS_AS_ROOTS_QUERY)
return NS_OK;
mQueryType = aQueryType;
return NS_OK;
}
// asyncEnabled
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -113,17 +113,17 @@ getUpdateRequirements(const RefPtr<nsNav
!aQuery->Domain().IsVoid() ||
aQuery->Uri() != nullptr)
nonTimeBasedItems = true;
if (!aQuery->Domain().IsVoid())
domainBasedItems = true;
if (aOptions->ResultType() ==
- nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY)
+ nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT)
return QUERYUPDATE_COMPLEX_WITH_BOOKMARKS;
if (aOptions->ResultType() ==
nsINavHistoryQueryOptions::RESULTS_AS_ROOTS_QUERY)
return QUERYUPDATE_MOBILEPREF;
if (aOptions->ResultType() ==
nsINavHistoryQueryOptions::RESULTS_AS_LEFT_PANE_QUERY)
@@ -1947,17 +1947,17 @@ nsNavHistoryQueryResultNode::CanExpand()
* must be always expandable
*/
bool
nsNavHistoryQueryResultNode::IsContainersQuery()
{
uint16_t resultType = Options()->ResultType();
return resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_QUERY ||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_SITE_QUERY ||
- resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY ||
+ resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT ||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_SITE_QUERY ||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_ROOTS_QUERY ||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_LEFT_PANE_QUERY;
}
/**
* Here we do not want to call ContainerResultNode::OnRemoving since our own
@@ -2022,30 +2022,30 @@ nsNavHistoryQueryResultNode::GetHasChild
if (!CanExpand()) {
return NS_OK;
}
uint16_t resultType = mOptions->ResultType();
// Tags are always populated, otherwise they are removed.
if (mQuery->Tags().Length() == 1 && mParent &&
- mParent->mOptions->ResultType() == nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) {
+ mParent->mOptions->ResultType() == nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT) {
*aHasChildren = true;
return NS_OK;
}
// AllBookmarks and the left pane folder also always have children.
if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_ROOTS_QUERY ||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_LEFT_PANE_QUERY) {
*aHasChildren = true;
return NS_OK;
}
// For tag containers query we must check if we have any tag
- if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAG_QUERY) {
+ if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_TAGS_ROOT) {
nsCOMPtr<nsITaggingService> tagging =
do_GetService(NS_TAGGINGSERVICE_CONTRACTID);
if (tagging) {
bool hasTags;
*aHasChildren = NS_SUCCEEDED(tagging->GetHasTags(&hasTags)) && hasTags;
}
return NS_OK;
}
@@ -2278,17 +2278,17 @@ nsNavHistoryQueryResultNode::Refresh()
if (mIndentLevel > -1 && !mParent)
return NS_OK;
// Do not refresh if we are not expanded or if we are child of a query
// containing other queries. In this case calling Refresh for each child
// query could cause a major slowdown. We should not refresh nested
// queries, since we will already refresh the parent one.
// The only exception to this, is if the parent query is of QUERYUPDATE_NONE,
- // this can be the case for the RESULTS_AS_TAG_QUERY
+ // this can be the case for the RESULTS_AS_TAGS_ROOT
// under RESULTS_AS_LEFT_PANE_QUERY.
if (!mExpanded) {
ClearChildren(true);
return NS_OK;
}
if (mParent && mParent->IsQuery()) {
nsNavHistoryQueryResultNode* parent = mParent->GetAsQuery();
--- a/toolkit/components/places/tests/queries/test_containersQueries_sorting.js
+++ b/toolkit/components/places/tests/queries/test_containersQueries_sorting.js
@@ -13,17 +13,17 @@
*/
// Globals and Constants
var resultTypes = [
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY, name: "RESULTS_AS_DATE_QUERY"},
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY, name: "RESULTS_AS_SITE_QUERY"},
{value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY, name: "RESULTS_AS_DATE_SITE_QUERY"},
- {value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY, name: "RESULTS_AS_TAG_QUERY"},
+ {value: Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT, name: "RESULTS_AS_TAGS_ROOT"},
];
var sortingModes = [
{value: Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING, name: "SORT_BY_TITLE_ASCENDING"},
{value: Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_DESCENDING, name: "SORT_BY_TITLE_DESCENDING"},
{value: Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING, name: "SORT_BY_DATE_ASCENDING"},
{value: Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING, name: "SORT_BY_DATE_DESCENDING"},
{value: Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING, name: "SORT_BY_DATEADDED_ASCENDING"},
@@ -135,17 +135,17 @@ function cartProd(aSequences, aCallback)
*/
function test_query_callback(aSequence) {
Assert.equal(aSequence.length, 2);
var resultType = aSequence[0];
var sortingMode = aSequence[1];
print("\n\n*** Testing default sorting for resultType (" + resultType.name + ") and sortingMode (" + sortingMode.name + ")");
// Skip invalid combinations sorting queries by none.
- if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY &&
+ if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT &&
(sortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING ||
sortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING)) {
// This is a bookmark query, we can't sort by visit date.
sortingMode.value = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
}
if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY ||
resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY ||
resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY) {
@@ -188,17 +188,17 @@ function test_query_callback(aSequence)
// since the above level does not inherit it, so they will be sorted by
// title ascending.
let innerContainer = container.getChild(0)
.QueryInterface(Ci.nsINavHistoryContainerResultNode);
innerContainer.containerOpen = true;
check_children_sorting(innerContainer,
Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING);
innerContainer.containerOpen = false;
- } else if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
+ } else if (resultType.value == Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT) {
// Sorting mode for tag contents is hardcoded for now, to allow for faster
// duplicates filtering.
check_children_sorting(container,
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
} else
check_children_sorting(container, sortingMode.value);
container.containerOpen = false;
--- a/toolkit/components/places/tests/queries/test_results-as-left-pane.js
+++ b/toolkit/components/places/tests/queries/test_results-as-left-pane.js
@@ -7,17 +7,17 @@ const expectedRoots = [{
uri: `place:sort=${Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING}&type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY}`,
guid: "history____v",
}, {
title: "OrganizerQueryDownloads",
uri: `place:transition=${Ci.nsINavHistoryService.TRANSITION_DOWNLOAD}&sort=${Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING}`,
guid: "downloads__v",
}, {
title: "TagsFolderTitle",
- uri: `place:sort=${Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING}&type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY}`,
+ uri: `place:sort=${Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING}&type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAGS_ROOT}`,
guid: "tags_______v",
}, {
title: "OrganizerQueryAllBookmarks",
uri: `place:type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_ROOTS_QUERY}`,
guid: "allbms_____v",
}];
const placesStrings = Services.strings.createBundle("chrome://places/locale/places.properties");
--- a/toolkit/components/places/tests/queries/test_results-as-tag-query.js
+++ b/toolkit/components/places/tests/queries/test_results-as-tag-query.js
@@ -14,29 +14,29 @@ for (const [uri, tagArray] of Object.ent
title: `Title of ${uri}`,
uri,
isBookmark: true,
isTag: true,
tagArray
});
}
-add_task(async function test_results_as_tag_query() {
+add_task(async function test_results_as_tags_root() {
await task_populateDB(formattedTestData);
// Construct URL - tag mapping from tag query.
const actualData = {};
for (const uri in testData) {
if (testData.hasOwnProperty(uri)) {
actualData[uri] = [];
}
}
const options = PlacesUtils.history.getNewQueryOptions();
- options.resultType = options.RESULTS_AS_TAG_QUERY;
+ options.resultType = options.RESULTS_AS_TAGS_ROOT;
const query = PlacesUtils.history.getNewQuery();
const root = PlacesUtils.history.executeQuery(query, options).root;
root.containerOpen = true;
Assert.equal(root.childCount, 3, "We should get as many results as tags.");
displayResultSet(root);
for (let i = 0; i < root.childCount; ++i) {
--- a/toolkit/components/places/tests/unit/test_childlessTags.js
+++ b/toolkit/components/places/tests/unit/test_childlessTags.js
@@ -66,17 +66,17 @@ add_task(async function test_removing_fo
* tags exist.
*
* @param aTags
* An array of tags (strings)
*/
function ensureTagsExist(aTags) {
var query = histsvc.getNewQuery();
var opts = histsvc.getNewQueryOptions();
- opts.resultType = opts.RESULTS_AS_TAG_QUERY;
+ opts.resultType = opts.RESULTS_AS_TAGS_ROOT;
var resultRoot = histsvc.executeQuery(query, opts).root;
// Dupe aTags.
var tags = aTags.slice(0);
resultRoot.containerOpen = true;
// Ensure that the number of tags returned from the query is the same as the