зеркало из https://github.com/mozilla/pjs.git
Bug 388695 - getBookmarkIdsForURI should sort by relevance. r=dietrich.
This commit is contained in:
Родитель
bae119cce7
Коммит
d661138c5c
|
@ -135,9 +135,9 @@ nsNavBookmarks::Init()
|
|||
|
||||
// mDBFindURIBookmarks
|
||||
rv = dbConn->CreateStatement(NS_LITERAL_CSTRING(
|
||||
"SELECT a.* "
|
||||
"SELECT a.id, MAX(COALESCE(a.lastModified, 0), a.dateAdded) "
|
||||
"FROM moz_bookmarks a, moz_places h "
|
||||
"WHERE h.url = ?1 AND a.fk = h.id and a.type = ?2"),
|
||||
"WHERE h.url = ?1 AND a.fk = h.id and a.type = ?2 ORDER BY 2 DESC"),
|
||||
getter_AddRefs(mDBFindURIBookmarks));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -398,10 +398,19 @@ function run_test() {
|
|||
do_check_eq("http://keywordtest.com/", u.spec);
|
||||
|
||||
// test getBookmarkIdsForURI
|
||||
// getBookmarkIdsForURI sorts by the most recently added/modified (descending)
|
||||
var newId8 = bmsvc.insertBookmark(testRoot, uri("http://foo8.com/"),
|
||||
bmsvc.DEFAULT_INDEX, "");
|
||||
var newId9 = bmsvc.insertBookmark(testRoot, uri("http://foo8.com/"),
|
||||
bmsvc.DEFAULT_INDEX, "");
|
||||
var b = bmsvc.getBookmarkIdsForURI(uri("http://foo8.com/"), {});
|
||||
do_check_eq(b[0], newId9);
|
||||
do_check_eq(b[1], newId8);
|
||||
// trigger last modified change
|
||||
bmsvc.setItemTitle(newId8, "");
|
||||
b = bmsvc.getBookmarkIdsForURI(uri("http://foo8.com/"), {});
|
||||
do_check_eq(b[0], newId8);
|
||||
do_check_eq(b[1], newId9);
|
||||
|
||||
// test removeFolderChildren
|
||||
// 1) add/remove each child type (bookmark, separator, folder)
|
||||
|
@ -549,7 +558,7 @@ function run_test() {
|
|||
bmsvc.DEFAULT_INDEX, "");
|
||||
do_check_eq(observer._itemAddedId, newId13);
|
||||
do_check_eq(observer._itemAddedParent, testRoot);
|
||||
do_check_eq(observer._itemAddedIndex, 13);
|
||||
do_check_eq(observer._itemAddedIndex, 14);
|
||||
|
||||
// set bookmark title
|
||||
bmsvc.setItemTitle(newId13, "ZZZXXXYYY");
|
||||
|
|
|
@ -100,8 +100,8 @@ function run_test() {
|
|||
// test getTagsForURI
|
||||
var uri1tags = tagssvc.getTagsForURI(uri1, {});
|
||||
do_check_eq(uri1tags.length, 2);
|
||||
do_check_eq(uri1tags[0], "tag 1");
|
||||
do_check_eq(uri1tags[1], "tag 2");
|
||||
do_check_eq(uri1tags[0], "tag 2");
|
||||
do_check_eq(uri1tags[1], "tag 1");
|
||||
var uri2tags = tagssvc.getTagsForURI(uri2, {});
|
||||
do_check_eq(uri2tags.length, 1);
|
||||
do_check_eq(uri2tags[0], "tag 1");
|
||||
|
|
Загрузка…
Ссылка в новой задаче