Bug 1395082 - Intermittent toolkit/components/places/tests/browser/browser_visited_notfound.js. r=standard8
authorMarco Bonardo <mbonardo@mozilla.com>
Wed, 30 Aug 2017 17:32:20 +0200
changeset 377935 e4b8ea7baeb6
parent 377934 c9079d347aaa
child 377936 8768af9e5e42
push id50116
push usermak77@bonardo.net
push date2017-08-31 09:31 +0000
treeherderautoland@e4b8ea7baeb6 [default view] [failures only]
reviewersstandard8
bugs1395082
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1395082 - Intermittent toolkit/components/places/tests/browser/browser_visited_notfound.js. r=standard8 MozReview-Commit-ID: GzAZXNIbBCN
toolkit/components/places/tests/PlacesTestUtils.jsm
--- a/toolkit/components/places/tests/PlacesTestUtils.jsm
+++ b/toolkit/components/places/tests/PlacesTestUtils.jsm
@@ -202,24 +202,25 @@ this.PlacesTestUtils = Object.freeze({
    * Asynchronously returns the required DB field for a specified page.
    * @param aURI
    *        nsIURI or address to look for.
    *
    * @return {Promise}
    * @resolves Returns the field value.
    * @rejects JavaScript exception.
    */
-  async fieldInDB(aURI, field) {
+  fieldInDB(aURI, field) {
     let url = aURI instanceof Ci.nsIURI ? new URL(aURI.spec) : new URL(aURI);
-    let db = await PlacesUtils.promiseDBConnection();
-    let rows = await db.executeCached(
-      `SELECT ${field} FROM moz_places
-       WHERE url_hash = hash(:url) AND url = :url`,
-      { url: url.href });
-    return rows[0].getResultByIndex(0);
+    return PlacesUtils.withConnectionWrapper("PlacesTestUtils.jsm: fieldInDb", async db => {
+      let rows = await db.executeCached(
+        `SELECT ${field} FROM moz_places
+        WHERE url_hash = hash(:url) AND url = :url`,
+        { url: url.href });
+      return rows[0].getResultByIndex(0);
+    });
   },
 
   /**
    * Marks all syncable bookmarks as synced by setting their sync statuses to
    * "NORMAL", resetting their change counters, and removing all tombstones.
    * Used by tests to avoid calling `PlacesSyncUtils.bookmarks.pullChanges`
    * and `PlacesSyncUtils.bookmarks.pushChanges`.
    *