Bug 1064365 - Deprecated GetKeywordForURI. r=mak

This commit is contained in:
Akshendra Pratap 2014-10-31 06:35:00 +01:00
parent d34e2f8277
commit 567a7beec4
4 changed files with 12 additions and 8 deletions

View File

@ -2519,6 +2519,8 @@ nsNavBookmarks::SetKeywordForBookmark(int64_t aBookmarkId,
NS_IMETHODIMP
nsNavBookmarks::GetKeywordForURI(nsIURI* aURI, nsAString& aKeyword)
{
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aURI);
aKeyword.Truncate(0);

View File

@ -348,10 +348,6 @@ add_task(function test_bookmarks() {
let k = bs.getKeywordForBookmark(kwTestItemId);
do_check_eq("bar", k);
// test getKeywordForURI
k = bs.getKeywordForURI(uri("http://keywordtest.com/"));
do_check_eq("bar", k);
// test getURIForKeyword
let u = bs.getURIForKeyword("bar");
do_check_eq("http://keywordtest.com/", u.spec);

View File

@ -11,8 +11,16 @@ function check_bookmark_keyword(aItemId, aKeyword)
function check_uri_keyword(aURI, aKeyword)
{
let keyword = aKeyword ? aKeyword.toLowerCase() : null;
do_check_eq(PlacesUtils.bookmarks.getKeywordForURI(aURI),
keyword);
for (let bm of PlacesUtils.getBookmarksForURI(aURI)) {
let kid = PlacesUtils.bookmarks.getKeywordForBookmark(bm);
if (kid && !keyword) {
Assert.ok(false, `${aURI.spec} should not have a keyword`);
} else if (keyword && kid == keyword) {
Assert.equal(kid, keyword, "Found the keyword");
break;
}
}
if (aKeyword) {
// This API can't tell which uri the user wants, so it returns a random one.

View File

@ -88,8 +88,6 @@ add_task(function () {
ok(PlacesUtils.bookmarks.isBookmarked(bookmarkUri),
"Bookmark should be bookmarked, data should be retrievable");
is(bookmarkKeyword, PlacesUtils.bookmarks.getKeywordForURI(bookmarkUri),
"Check bookmark uri keyword");
is(getPlacesItemsCount(), count,
"Check the new bookmark items count");
is(isBookmarkAltered(), false, "Check if bookmark has been visited");