Bug 1383027 - Remove a test use of PlacesUtils.getBookmarksForURI. r=past draft
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 21 Jul 2017 13:50:06 +0200
changeset 613020 20c708d001111ee9c38b667110bccc2746d9df88
parent 613018 334266f963fddf0eb7b2d568e85fcd5983923d32
child 638582 7ca1c5932e7048ba305768f15d562c1165d9bf09
push id69693
push usermak77@bonardo.net
push dateFri, 21 Jul 2017 11:54:00 +0000
reviewerspast
bugs1383027
milestone56.0a1
Bug 1383027 - Remove a test use of PlacesUtils.getBookmarksForURI. r=past MozReview-Commit-ID: FLiqzgoTTHZ
toolkit/components/places/tests/bookmarks/test_keywords.js
--- a/toolkit/components/places/tests/bookmarks/test_keywords.js
+++ b/toolkit/components/places/tests/bookmarks/test_keywords.js
@@ -1,18 +1,21 @@
 const URI1 = NetUtil.newURI("http://test1.mozilla.org/");
 const URI2 = NetUtil.newURI("http://test2.mozilla.org/");
 const URI3 = NetUtil.newURI("http://test3.mozilla.org/");
 
 async function check_keyword(aURI, aKeyword) {
   if (aKeyword)
     aKeyword = aKeyword.toLowerCase();
 
-  for (let bm of PlacesUtils.getBookmarksForURI(aURI)) {
-    let keyword = PlacesUtils.bookmarks.getKeywordForBookmark(bm);
+  let bms = [];
+  await PlacesUtils.bookmarks.fetch({ url: aURI }, bm => bms.push(bm));
+  for (let bm of bms) {
+    let itemId = await PlacesUtils.promiseItemId(bm.guid);
+    let keyword = PlacesUtils.bookmarks.getKeywordForBookmark(itemId);
     if (keyword && !aKeyword) {
       throw (`${aURI.spec} should not have a keyword`);
     } else if (aKeyword && keyword == aKeyword) {
       Assert.equal(keyword, aKeyword);
     }
   }
 
   if (aKeyword) {