Bug 1095421 - Convert xpcshell-tests in toolkit/components/places/tests/unifiedcomplete to Bookmarks.jsm API r=mak
authorTim Taubert <ttaubert@mozilla.com>
Fri, 13 Mar 2015 16:30:38 +0100
changeset 233819 41cc117287ca75d76a0943dcc3a3f90462d9e5bb
parent 233818 448e02bb26208e20920b14a43802b788543e736a
child 233820 73e19da9241bccdd2fa1ae2ff7ec39f7c3cbcebd
push id11812
push userttaubert@mozilla.com
push dateTue, 17 Mar 2015 10:23:16 +0000
treeherderfx-team@f23c478ac677 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1095421
milestone39.0a1
Bug 1095421 - Convert xpcshell-tests in toolkit/components/places/tests/unifiedcomplete to Bookmarks.jsm API r=mak
toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
toolkit/components/places/tests/unifiedcomplete/test_416211.js
toolkit/components/places/tests/unifiedcomplete/test_416214.js
toolkit/components/places/tests/unifiedcomplete/test_417798.js
toolkit/components/places/tests/unifiedcomplete/test_418257.js
toolkit/components/places/tests/unifiedcomplete/test_autoFill_default_behavior.js
toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
toolkit/components/places/tests/unifiedcomplete/test_download_embed_bookmarks.js
toolkit/components/places/tests/unifiedcomplete/test_empty_search.js
toolkit/components/places/tests/unifiedcomplete/test_keyword_search.js
toolkit/components/places/tests/unifiedcomplete/test_keyword_search_actions.js
toolkit/components/places/tests/unifiedcomplete/test_keywords.js
toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js
toolkit/components/places/tests/unifiedcomplete/test_searchEngine_host.js
toolkit/components/places/tests/unifiedcomplete/test_searchEngine_restyle.js
toolkit/components/places/tests/unifiedcomplete/test_special_search.js
toolkit/components/places/tests/unifiedcomplete/test_word_boundary_search.js
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -208,33 +208,36 @@ function* check_autocomplete(test) {
     // This ensures the controller is able to do its magic case-preserving
     // stuff and correct replacement of the user's casing with result's one.
     controller.handleEnter(false);
     Assert.equal(input.textValue, test.completed,
                  "Completed value is correct");
   }
 }
 
-function addBookmark(aBookmarkObj) {
+let addBookmark = Task.async(function* (aBookmarkObj) {
   Assert.ok(!!aBookmarkObj.uri, "Bookmark object contains an uri");
   let parentId = aBookmarkObj.parentId ? aBookmarkObj.parentId
                                        : PlacesUtils.unfiledBookmarksFolderId;
-  let itemId = PlacesUtils.bookmarks
-                          .insertBookmark(parentId,
-                                          aBookmarkObj.uri,
-                                          PlacesUtils.bookmarks.DEFAULT_INDEX,
-                                          aBookmarkObj.title || "A bookmark");
+
+  let bm = yield PlacesUtils.bookmarks.insert({
+    parentGuid: (yield PlacesUtils.promiseItemGuid(parentId)),
+    title: aBookmarkObj.title || "A bookmark",
+    url: aBookmarkObj.uri
+  });
+  let itemId = yield PlacesUtils.promiseItemId(bm.guid);
+
   if (aBookmarkObj.keyword) {
     PlacesUtils.bookmarks.setKeywordForBookmark(itemId, aBookmarkObj.keyword);
   }
 
   if (aBookmarkObj.tags) {
     PlacesUtils.tagging.tagURI(aBookmarkObj.uri, aBookmarkObj.tags);
   }
-}
+});
 
 function addOpenPages(aUri, aCount=1) {
   let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
              .getService(Ci.mozIPlacesAutoComplete);
   for (let i = 0; i < aCount; i++) {
     ac.registerOpenPage(aUri);
   }
 }
--- a/toolkit/components/places/tests/unifiedcomplete/test_416211.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_416211.js
@@ -6,17 +6,17 @@
  * Test bug 416211 to make sure results that match the tag show the bookmark
  * title instead of the page title.
  */
 
 add_task(function* test_tag_match_has_bookmark_title() {
   do_print("Make sure the tag match gives the bookmark title");
   let uri = NetUtil.newURI("http://theuri/");
   yield PlacesTestUtils.addVisits({ uri: uri, title: "Page title" });
-  addBookmark({ uri: uri,
-                title: "Bookmark title",
-                tags: [ "superTag" ]});
+  yield addBookmark({ uri: uri,
+                      title: "Bookmark title",
+                      tags: [ "superTag" ]});
   yield check_autocomplete({
     search: "superTag",
     matches: [ { uri: uri, title: "Bookmark title", tags: [ "superTag" ], style: [ "bookmark-tag" ] } ]
   });
   yield cleanup();
 });
--- a/toolkit/components/places/tests/unifiedcomplete/test_416214.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_416214.js
@@ -17,23 +17,23 @@
 add_task(function* test_tag_match_url() {
   do_print("Make sure tag matches return the right url as well as '+' remain escaped");
   let uri1 = NetUtil.newURI("http://escaped/ユニコード");
   let uri2 = NetUtil.newURI("http://asciiescaped/blocking-firefox3%2B");
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "title" },
     { uri: uri2, title: "title" }
   ]);
-  addBookmark({ uri: uri1,
-                title: "title",
-                tags: [ "superTag" ],
-                style: [ "bookmark-tag" ] });
-  addBookmark({ uri: uri2,
-                title: "title",
-                tags: [ "superTag" ],
-                style: [ "bookmark-tag" ] });
+  yield addBookmark({ uri: uri1,
+                      title: "title",
+                      tags: [ "superTag" ],
+                      style: [ "bookmark-tag" ] });
+  yield addBookmark({ uri: uri2,
+                      title: "title",
+                      tags: [ "superTag" ],
+                      style: [ "bookmark-tag" ] });
   yield check_autocomplete({
     search: "superTag",
     matches: [ { uri: uri1, title: "title", tags: [ "superTag" ], style: [ "bookmark-tag" ] },
      		   { uri: uri2, title: "title", tags: [ "superTag" ], style: [ "bookmark-tag" ] } ]
   });
   yield cleanup();
 });
--- a/toolkit/components/places/tests/unifiedcomplete/test_417798.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_417798.js
@@ -8,18 +8,18 @@
  */
 
 add_task(function* test_javascript_match() {
   Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false);
 
   let uri1 = NetUtil.newURI("http://abc/def");
   let uri2 = NetUtil.newURI("javascript:5");
   yield PlacesTestUtils.addVisits([ { uri: uri1, title: "Title with javascript:" } ]);
-  addBookmark({ uri: uri2,
-                title: "Title with javascript:" });
+  yield addBookmark({ uri: uri2,
+                      title: "Title with javascript:" });
 
   do_print("Match non-javascript: with plain search");
   yield check_autocomplete({
     search: "a",
     matches: [ { uri: uri1, title: "Title with javascript:" } ]
   });
 
   do_print("Match non-javascript: with almost javascript:");
--- a/toolkit/components/places/tests/unifiedcomplete/test_418257.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_418257.js
@@ -14,28 +14,28 @@ add_task(function* test_javascript_match
   let uri3 = NetUtil.newURI("http://page3");
   let uri4 = NetUtil.newURI("http://page4");
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "tagged" },
     { uri: uri2, title: "tagged" },
     { uri: uri3, title: "tagged" },
     { uri: uri4, title: "tagged" }
   ]);
-  addBookmark({ uri: uri1,
-                title: "tagged",
-                tags: [ "tag1" ] });
-  addBookmark({ uri: uri2,
-                title: "tagged",
-                tags: [ "tag1", "tag2" ] });
-  addBookmark({ uri: uri3,
-                title: "tagged",
-                tags: [ "tag1", "tag3" ] });
-  addBookmark({ uri: uri4,
-                title: "tagged",
-                tags: [ "tag1", "tag2", "tag3" ] });
+  yield addBookmark({ uri: uri1,
+                      title: "tagged",
+                      tags: [ "tag1" ] });
+  yield addBookmark({ uri: uri2,
+                      title: "tagged",
+                      tags: [ "tag1", "tag2" ] });
+  yield addBookmark({ uri: uri3,
+                      title: "tagged",
+                      tags: [ "tag1", "tag3" ] });
+  yield addBookmark({ uri: uri4,
+                      title: "tagged",
+                      tags: [ "tag1", "tag2", "tag3" ] });
 
   do_print("Make sure tags come back in the title when matching tags");
   yield check_autocomplete({
     search: "page1 tag",
     matches: [ { uri: uri1, title: "tagged", tags: [ "tag1" ], style: [ "bookmark-tag" ] } ]
   });
 
   do_print("Check tags in title for page2");
--- a/toolkit/components/places/tests/unifiedcomplete/test_autoFill_default_behavior.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_autoFill_default_behavior.js
@@ -13,19 +13,19 @@ add_task(function* test_default_behavior
   let uri4 = NetUtil.newURI("http://tpbk/");
   let uri5 = NetUtil.newURI("http://tagged/");
 
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "typed", transition: TRANSITION_TYPED },
     { uri: uri2, title: "visited" },
     { uri: uri4, title: "tpbk", transition: TRANSITION_TYPED },
   ]);
-  addBookmark( { uri: uri3, title: "bookmarked" } );
-  addBookmark( { uri: uri4, title: "tpbk" } );
-  addBookmark( { uri: uri5, title: "title", tags: ["foo"] } );
+  yield addBookmark( { uri: uri3, title: "bookmarked" } );
+  yield addBookmark( { uri: uri4, title: "tpbk" } );
+  yield addBookmark( { uri: uri5, title: "title", tags: ["foo"] } );
 
   // RESTRICT TO HISTORY.
   Services.prefs.setBoolPref("browser.urlbar.suggest.history", true);
   Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", false);
   Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
 
   do_print("Restrict history, common visit, should not autoFill");
   yield check_autocomplete({
@@ -195,18 +195,18 @@ add_task(function* test_default_behavior
   let uri3 = NetUtil.newURI("http://bookmarked/bo/");
   let uri4 = NetUtil.newURI("http://tpbk/tp/");
 
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "typed", transition: TRANSITION_TYPED },
     { uri: uri2, title: "visited" },
     { uri: uri4, title: "tpbk", transition: TRANSITION_TYPED },
   ]);
-  addBookmark( { uri: uri3, title: "bookmarked" } );
-  addBookmark( { uri: uri4, title: "tpbk" } );
+  yield addBookmark( { uri: uri3, title: "bookmarked" } );
+  yield addBookmark( { uri: uri4, title: "tpbk" } );
 
   // RESTRICT TO HISTORY.
   Services.prefs.setBoolPref("browser.urlbar.suggest.history", true);
   Services.prefs.setBoolPref("browser.urlbar.suggest.history.onlyTyped", false);
   Services.prefs.setBoolPref("browser.urlbar.suggest.bookmark", false);
   Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
   Services.prefs.setBoolPref("browser.urlbar.autoFill.searchEngines", false);
 
--- a/toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
@@ -69,17 +69,17 @@ add_task(function* test_respect_www() {
     completed: "www.me.mozilla.org/"
   });
   yield cleanup();
 });
 
 add_task(function* test_bookmark_first() {
   do_print("With a bookmark and history, the query result should be the bookmark");
   Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
-  addBookmark({ uri: NetUtil.newURI("http://bookmark1.mozilla.org/") });
+  yield addBookmark({ uri: NetUtil.newURI("http://bookmark1.mozilla.org/") });
   yield PlacesTestUtils.addVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
   yield check_autocomplete({
     search: "bookmark",
     autofilled: "bookmark1.mozilla.org/",
     completed: "bookmark1.mozilla.org/"
   });
   yield cleanup();
 });
--- a/toolkit/components/places/tests/unifiedcomplete/test_download_embed_bookmarks.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_download_embed_bookmarks.js
@@ -19,22 +19,22 @@ add_task(function* test_download_embed_b
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "download-bookmark", transition: TRANSITION_DOWNLOAD },
     { uri: uri2, title: "embed-bookmark", transition: TRANSITION_EMBED },
     { uri: uri3, title: "framed-bookmark", transition: TRANSITION_FRAMED_LINK},
     { uri: uri4, title: "download2", transition: TRANSITION_DOWNLOAD },
     { uri: uri5, title: "embed2", transition: TRANSITION_EMBED },
     { uri: uri6, title: "framed2", transition: TRANSITION_FRAMED_LINK }
   ]);
-  addBookmark({ uri: uri1,
-                title: "download-bookmark" });
-  addBookmark({ uri: uri2,
-                title: "embed-bookmark" });
-  addBookmark({ uri: uri3,
-                title: "framed-bookmark" });
+  yield addBookmark({ uri: uri1,
+                      title: "download-bookmark" });
+  yield addBookmark({ uri: uri2,
+                      title: "embed-bookmark" });
+  yield addBookmark({ uri: uri3,
+                      title: "framed-bookmark" });
 
   do_print("Searching for bookmarked download uri matches");
   yield check_autocomplete({
     search: "download-bookmark",
     matches: [ { uri: uri1, title: "download-bookmark", style: [ "bookmark" ] } ]
   });
 
   do_print("Searching for bookmarked embed uri matches");
--- a/toolkit/components/places/tests/unifiedcomplete/test_empty_search.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_empty_search.js
@@ -20,24 +20,24 @@ add_task(function* test_javascript_match
     { uri: uri1, title: "title" },
     { uri: uri2, title: "title" },
     { uri: uri3, title: "title", transition: TRANSITION_TYPED},
     { uri: uri4, title: "title", transition: TRANSITION_TYPED },
     { uri: uri6, title: "title", transition: TRANSITION_TYPED },
     { uri: uri7, title: "title" }
   ]);
 
-  addBookmark({ uri: uri2,
-                title: "title" });
-  addBookmark({ uri: uri4,
-                title: "title" });
-  addBookmark({ uri: uri5,
-                title: "title" });
-  addBookmark({ uri: uri6,
-                title: "title" });
+  yield addBookmark({ uri: uri2,
+                      title: "title" });
+  yield addBookmark({ uri: uri4,
+                      title: "title" });
+  yield addBookmark({ uri: uri5,
+                      title: "title" });
+  yield addBookmark({ uri: uri6,
+                      title: "title" });
 
   addOpenPages(uri7, 1);
 
   // Now remove page 6 from history, so it is an unvisited bookmark.
   PlacesUtils.history.removePage(uri6);
 
   do_print("Match everything");
   yield check_autocomplete({
--- a/toolkit/components/places/tests/unifiedcomplete/test_keyword_search.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_keyword_search.js
@@ -14,17 +14,17 @@
 
 add_task(function* test_keyword_searc() {
   let uri1 = NetUtil.newURI("http://abc/?search=%s");
   let uri2 = NetUtil.newURI("http://abc/?search=ThisPageIsInHistory");
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "Generic page title" },
     { uri: uri2, title: "Generic page title" }
   ]);
-  addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"});
+  yield addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"});
 
   do_print("Plain keyword query");
   yield check_autocomplete({
     search: "key term",
     matches: [ { uri: NetUtil.newURI("http://abc/?search=term"), title: "Keyword title", style: ["keyword"] } ]
   });
 
   do_print("Multi-word keyword query");
@@ -61,17 +61,17 @@ add_task(function* test_keyword_searc() 
   yield check_autocomplete({
     search: "key ",
     matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title", style: ["keyword"] } ]
   });
 
   // This adds a second keyword so anything after this will match 2 keywords
   let uri3 = NetUtil.newURI("http://xyz/?foo=%s");
   yield PlacesTestUtils.addVisits([ { uri: uri3, title: "Generic page title" } ]);
-  addBookmark({ uri: uri3, title: "Keyword title", keyword: "key", style: ["keyword"] });
+  yield addBookmark({ uri: uri3, title: "Keyword title", keyword: "key", style: ["keyword"] });
 
   do_print("Two keywords matched");
   yield check_autocomplete({
     search: "key twoKey",
     matches: [ { uri: NetUtil.newURI("http://abc/?search=twoKey"), title: "Keyword title", style: ["keyword"] },
                { uri: NetUtil.newURI("http://xyz/?foo=twoKey"), title: "Keyword title", style: ["keyword"] } ]
   });
 
--- a/toolkit/components/places/tests/unifiedcomplete/test_keyword_search_actions.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_keyword_search_actions.js
@@ -14,17 +14,17 @@
 
 add_task(function* test_keyword_search() {
   let uri1 = NetUtil.newURI("http://abc/?search=%s");
   let uri2 = NetUtil.newURI("http://abc/?search=ThisPageIsInHistory");
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "Generic page title" },
     { uri: uri2, title: "Generic page title" }
   ]);
-  addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"});
+  yield addBookmark({ uri: uri1, title: "Keyword title", keyword: "key"});
 
   do_print("Plain keyword query");
   yield check_autocomplete({
     search: "key term",
     searchParam: "enable-actions",
     matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=term", input: "key term"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
   });
 
@@ -68,17 +68,17 @@ add_task(function* test_keyword_search()
     search: "key ",
     searchParam: "enable-actions",
     matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key "}), title: "Keyword title", style: [ "action", "keyword" ] } ]
   });
 
   // This adds a second keyword so anything after this will match 2 keywords
   let uri3 = NetUtil.newURI("http://xyz/?foo=%s");
   yield PlacesTestUtils.addVisits([ { uri: uri3, title: "Generic page title" } ]);
-  addBookmark({ uri: uri3, title: "Keyword title", keyword: "key"});
+  yield addBookmark({ uri: uri3, title: "Keyword title", keyword: "key"});
 
   do_print("Two keywords matched");
   yield check_autocomplete({
     search: "key twoKey",
     searchParam: "enable-actions",
     matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=twoKey", input: "key twoKey"}), title: "Keyword title", style: [ "action", "keyword" ] },
                { uri: makeActionURI("keyword", {url: "http://xyz/?foo=twoKey", input: "key twoKey"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
   });
--- a/toolkit/components/places/tests/unifiedcomplete/test_keywords.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_keywords.js
@@ -3,76 +3,76 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 add_task(function* test_non_keyword() {
   do_print("Searching for non-keyworded entry should autoFill it");
   yield PlacesTestUtils.addVisits({
     uri: NetUtil.newURI("http://mozilla.org/test/"),
     transition: TRANSITION_TYPED
   });
-  addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/") });
+  yield addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/") });
   yield check_autocomplete({
     search: "moz",
     autofilled: "mozilla.org/",
     completed: "mozilla.org/"
   });
   yield cleanup();
 });
 
 add_task(function* test_keyword() {
   do_print("Searching for keyworded entry should not autoFill it");
   yield PlacesTestUtils.addVisits({
     uri: NetUtil.newURI("http://mozilla.org/test/"),
     transition: TRANSITION_TYPED
   });
-  addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
+  yield addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
   yield check_autocomplete({
     search: "moz",
     autofilled: "moz",
     completed: "moz",
   });
   yield cleanup();
 });
 
 add_task(function* test_more_than_keyword() {
   do_print("Searching for more than keyworded entry should autoFill it");
   yield PlacesTestUtils.addVisits({
     uri: NetUtil.newURI("http://mozilla.org/test/"),
     transition: TRANSITION_TYPED
   });
-  addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
+  yield addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
   yield check_autocomplete({
     search: "mozi",
     autofilled: "mozilla.org/",
     completed: "mozilla.org/"
   });
   yield cleanup();
 });
 
 add_task(function* test_less_than_keyword() {
   do_print("Searching for less than keyworded entry should autoFill it");
   yield PlacesTestUtils.addVisits({
     uri: NetUtil.newURI("http://mozilla.org/test/"),
     transition: TRANSITION_TYPED
   });
-  addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
+  yield addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
   yield check_autocomplete({
     search: "mo",
     autofilled: "mozilla.org/",
     completed: "mozilla.org/",
   });
   yield cleanup();
 });
 
 add_task(function* test_keyword_casing() {
   do_print("Searching for keyworded entry is case-insensitive");
   yield PlacesTestUtils.addVisits({
     uri: NetUtil.newURI("http://mozilla.org/test/"),
     transition: TRANSITION_TYPED
   });
-  addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
+  yield addBookmark({ uri: NetUtil.newURI("http://mozilla.org/test/"), keyword: "moz" });
   yield check_autocomplete({
     search: "MoZ",
     autofilled: "MoZ",
     completed: "MoZ"
   });
   yield cleanup();
 });
--- a/toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_multi_word_search.js
@@ -18,18 +18,18 @@ add_task(function* test_match_beginning(
   let uri3 = NetUtil.newURI("http://g.h.i/j-k_l/h/t/p");
   let uri4 = NetUtil.newURI("http://j.k.l/m-n_o/h/t/p");
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "f(o)o b<a>r" },
     { uri: uri2, title: "b(a)r b<a>z" },
     { uri: uri3, title: "f(o)o b<a>r" },
     { uri: uri4, title: "f(o)o b<a>r" }
   ]);
-  addBookmark({ uri: uri3, title: "f(o)o b<a>r" });
-  addBookmark({ uri: uri4, title: "b(a)r b<a>z" });
+  yield addBookmark({ uri: uri3, title: "f(o)o b<a>r" });
+  yield addBookmark({ uri: uri4, title: "b(a)r b<a>z" });
 
   do_print("Match 2 terms all in url");
   yield check_autocomplete({
     search: "c d",
     matches: [ { uri: uri1, title: "f(o)o b<a>r" } ]
   });
 
   do_print("Match 1 term in url and 1 term in title");
--- a/toolkit/components/places/tests/unifiedcomplete/test_searchEngine_host.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_searchEngine_host.js
@@ -46,17 +46,17 @@ add_task(function* test_searchEngine_aut
 
   // Add an uri that matches the search string with high frecency.
   let uri = NetUtil.newURI("http://www.example.com/my/");
   let visits = [];
   for (let i = 0; i < 100; ++i) {
     visits.push({ uri , title: "Terms - SearchEngine Search" });
   }
   yield PlacesTestUtils.addVisits(visits);
-  addBookmark({ uri: uri, title: "Example bookmark" });
+  yield addBookmark({ uri: uri, title: "Example bookmark" });
   yield PlacesTestUtils.promiseAsyncUpdates();
   ok(frecencyForUrl(uri) > 10000, "Added URI should have expected high frecency");
 
   do_print("Check search domain is autoFilled even if there's an higher frecency match");
   yield check_autocomplete({
     search: "my",
     autofilled: "my.search.com",
     completed: "http://my.search.com"
--- a/toolkit/components/places/tests/unifiedcomplete/test_searchEngine_restyle.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_searchEngine_restyle.js
@@ -7,17 +7,17 @@ add_task(function* test_searchEngine() {
                                        "GET", "http://s.example.com/search");
   let engine = Services.search.getEngineByName("SearchEngine");
   engine.addParam("q", "{searchTerms}", null);
   do_register_cleanup(() => Services.search.removeEngine(engine));
 
   let uri1 = NetUtil.newURI("http://s.example.com/search?q=Terms&client=1");
   let uri2 = NetUtil.newURI("http://s.example.com/search?q=Terms&client=2");
   yield PlacesTestUtils.addVisits({ uri: uri1, title: "Terms - SearchEngine Search" });
-  addBookmark({ uri: uri2, title: "Terms - SearchEngine Search" });
+  yield addBookmark({ uri: uri2, title: "Terms - SearchEngine Search" });
 
   do_print("Past search terms should be styled, unless bookmarked");
   Services.prefs.setBoolPref("browser.urlbar.restyleSearches", true);
   yield check_autocomplete({
     search: "term",
     matches: [ { uri: uri1, title: "Terms", searchEngine: "SearchEngine", style: ["favicon", "search"] },
                { uri: uri2, title: "Terms - SearchEngine Search", style: ["bookmark"] } ]
   });
--- a/toolkit/components/places/tests/unifiedcomplete/test_special_search.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_special_search.js
@@ -32,24 +32,24 @@ add_task(function* test_special_searches
   yield PlacesTestUtils.addVisits([
     { uri: uri1, title: "title", transition: TRANSITION_TYPED },
     { uri: uri2, title: "foo.bar" },
     { uri: uri3, title: "title" },
     { uri: uri4, title: "foo.bar", transition: TRANSITION_TYPED },
     { uri: uri6, title: "foo.bar" },
     { uri: uri11, title: "title", transition: TRANSITION_TYPED }
   ]);
-  addBookmark( { uri: uri5, title: "title" } );
-  addBookmark( { uri: uri6, title: "foo.bar" } );
-  addBookmark( { uri: uri7, title: "title" } );
-  addBookmark( { uri: uri8, title: "foo.bar" } );
-  addBookmark( { uri: uri9, title: "title", tags: [ "foo.bar" ] } );
-  addBookmark( { uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] } );
-  addBookmark( { uri: uri11, title: "title", tags: [ "foo.bar" ] } );
-  addBookmark( { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } );
+  yield addBookmark( { uri: uri5, title: "title" } );
+  yield addBookmark( { uri: uri6, title: "foo.bar" } );
+  yield addBookmark( { uri: uri7, title: "title" } );
+  yield addBookmark( { uri: uri8, title: "foo.bar" } );
+  yield addBookmark( { uri: uri9, title: "title", tags: [ "foo.bar" ] } );
+  yield addBookmark( { uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] } );
+  yield addBookmark( { uri: uri11, title: "title", tags: [ "foo.bar" ] } );
+  yield addBookmark( { uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } );
 
   // Test restricting searches
   do_print("History restrict");
   yield check_autocomplete({
     search: "^",
     matches: [ { uri: uri1, title: "title" },
                { uri: uri2, title: "foo.bar" },
                { uri: uri3, title: "title" },
--- a/toolkit/components/places/tests/unifiedcomplete/test_word_boundary_search.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_word_boundary_search.js
@@ -38,18 +38,18 @@ add_task(function* test_escape() {
     { uri: uri4, title: "dontmatchme3" },
     { uri: uri5, title: "title1" },
     { uri: uri6, title: "title1" },
     { uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" },
     { uri: uri8, title: katakana.join("") },
     { uri: uri9, title: ideograph.join("") },
     { uri: uri10, title: "title1" }
   ]);
-  addBookmark( { uri: uri5, title: "title1", tags: [ "matchme2" ] } );
-  addBookmark( { uri: uri6, title: "title1", tags: [ "dontmatchme3" ] } );
+  yield addBookmark( { uri: uri5, title: "title1", tags: [ "matchme2" ] } );
+  yield addBookmark( { uri: uri6, title: "title1", tags: [ "dontmatchme3" ] } );
 
   // match only on word boundaries
   Services.prefs.setIntPref("browser.urlbar.matchBehavior", 2);
 
   do_print("Match 'match' at the beginning or after / or on a CamelCase");
   yield check_autocomplete({
     search: "match",
     matches: [ { uri: uri1, title: "title1" },