diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp index 3b8c98d10ad8..2c57a56c5294 100644 --- a/toolkit/components/places/nsNavBookmarks.cpp +++ b/toolkit/components/places/nsNavBookmarks.cpp @@ -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); diff --git a/toolkit/components/places/tests/bookmarks/test_bookmarks.js b/toolkit/components/places/tests/bookmarks/test_bookmarks.js index cd57ed2c51e7..68de813a028e 100644 --- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js +++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js @@ -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); diff --git a/toolkit/components/places/tests/bookmarks/test_keywords.js b/toolkit/components/places/tests/bookmarks/test_keywords.js index b783553bbb96..47f777606820 100644 --- a/toolkit/components/places/tests/bookmarks/test_keywords.js +++ b/toolkit/components/places/tests/bookmarks/test_keywords.js @@ -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. diff --git a/toolkit/components/places/tests/browser/browser_bug248970.js b/toolkit/components/places/tests/browser/browser_bug248970.js index a41ee1bb40fe..b42fa2fddad7 100644 --- a/toolkit/components/places/tests/browser/browser_bug248970.js +++ b/toolkit/components/places/tests/browser/browser_bug248970.js @@ -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");