Bug 1380835 - Don't check queries with `excludeQueries` for cycles in the bookmark validator. r=tcsc

MozReview-Commit-ID: DsPzrCxWWMG

--HG--
extra : rebase_source : 25281ab8f8d53901d960a738212361831b12fc55
This commit is contained in:
Kit Cambridge 2017-07-13 19:52:57 -07:00
Родитель cc13392457
Коммит 8893010bae
2 изменённых файлов: 15 добавлений и 0 удалений

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

@ -254,6 +254,13 @@ class BookmarkValidator {
continue;
}
let params = new URLSearchParams(entry.bmkUri.slice(QUERY_PROTOCOL.length));
// Queries with `excludeQueries` won't form cycles because they'll
// exclude all queries, including themselves, from the result set.
let excludeQueries = params.get("excludeQueries");
if (excludeQueries === "1" || excludeQueries === "true") {
// `nsNavHistoryQuery::ParseQueryBooleanString` allows `1` and `true`.
continue;
}
entry.concreteItems = [];
let queryIds = params.getAll("folder");
for (let queryId of queryIds) {

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

@ -342,6 +342,14 @@ add_task(async function test_cswc_clientCycles() {
guid: "dddddddddddd",
url: `place:folder=${PlacesUtils.bookmarksMenuFolderId}`,
title: "Bookmarks Menu",
}, {
// A query that references the menu, but excludes itself, so it can't
// form a cycle.
guid: "iiiiiiiiiiii",
url: `place:folder=BOOKMARKS_MENU&folder=UNFILED_BOOKMARKS&` +
`folder=TOOLBAR&queryType=1&sort=12&maxResults=10&` +
`excludeQueries=1`,
title: "Recently Bookmarked",
}],
});