Bug 1370881 - Replace calls to asyncHistory.isURIVisited and promiseIsURIVisited with PlacesUtils.history.hasVisits r=standard8
authorhemant <hemantsingh1612@gmail.com>
Wed, 24 Jan 2018 20:58:57 +0530
changeset 400739 8bfa9cafcc0dc85df6197014dad2c5a3643760e1
parent 400738 167ef8dc0c60a49c9c7de5cdba48c276dec5d355
child 400740 9496ca14a7d847bbd5a1418036a04980f5714ddb
push id33315
push userrgurzau@mozilla.com
push dateThu, 25 Jan 2018 17:00:51 +0000
treeherdermozilla-central@53c5a199232a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs1370881
milestone60.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 1370881 - Replace calls to asyncHistory.isURIVisited and promiseIsURIVisited with PlacesUtils.history.hasVisits r=standard8 MozReview-Commit-ID: BHWkJpdYA0g
browser/base/content/test/general/browser_sanitize-timespans.js
browser/base/content/test/general/head.js
browser/components/places/tests/browser/browser_library_commands.js
browser/components/places/tests/browser/head.js
services/sync/tests/unit/test_corrupt_keys.js
toolkit/components/jsdownloads/test/unit/common_test_Download.js
toolkit/components/jsdownloads/test/unit/head.js
toolkit/components/places/nsLivemarkService.js
toolkit/components/places/tests/browser/browser_bug680727.js
toolkit/components/places/tests/browser/browser_history_post.js
toolkit/components/places/tests/browser/head.js
toolkit/components/places/tests/head_common.js
toolkit/components/places/tests/history/test_async_history_api.js
toolkit/components/places/tests/history/test_removeVisits.js
toolkit/components/places/tests/unit/test_425563.js
toolkit/components/places/tests/unit/test_isvisited.js
toolkit/components/places/tests/unit/test_preventive_maintenance.js
toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
--- a/browser/base/content/test/general/browser_sanitize-timespans.js
+++ b/browser/base/content/test/general/browser_sanitize-timespans.js
@@ -100,35 +100,35 @@ async function onHistoryReady() {
   // Clear 10 minutes ago
   s.range = [now_uSec - 10 * 60 * 1000000, now_uSec];
   await s.sanitize();
   s.range = null;
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://10minutes.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://10minutes.com")),
      "Pretend visit to 10minutes.com should now be deleted");
-  ok((await promiseIsURIVisited(makeURI("http://1hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://1hour.com")),
      "Pretend visit to 1hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://1hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://1hour10minutes.com")),
      "Pretend visit to 1hour10minutes.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://2hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://2hour.com")),
      "Pretend visit to 2hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://2hour10minutes.com")),
      "Pretend visit to 2hour10minutes.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour.com")),
      "Pretend visit to 4hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour10minutes.com")),
      "Pretend visit to 4hour10minutes.com should should still exist");
   if (minutesSinceMidnight > 10) {
-    ok((await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok((await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should still exist");
   }
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
     "Pretend visit to before-today.com should still exist");
 
   let checkZero = function(num, message) { is(num, 0, message); };
   let checkOne = function(num, message) { is(num, 1, message); };
 
   await countEntries("10minutes", "10minutes form entry should be deleted", checkZero);
   await countEntries("1hour", "1hour form entry should still exist", checkOne);
   await countEntries("1hour10minutes", "1hour10minutes form entry should still exist", checkOne);
@@ -157,33 +157,33 @@ async function onHistoryReady() {
 
   // Clear 1 hour
   Sanitizer.prefs.setIntPref("timeSpan", 1);
   await s.sanitize();
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://1hour.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://1hour.com")),
      "Pretend visit to 1hour.com should now be deleted");
-  ok((await promiseIsURIVisited(makeURI("http://1hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://1hour10minutes.com")),
      "Pretend visit to 1hour10minutes.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://2hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://2hour.com")),
      "Pretend visit to 2hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://2hour10minutes.com")),
      "Pretend visit to 2hour10minutes.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour.com")),
      "Pretend visit to 4hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour10minutes.com")),
      "Pretend visit to 4hour10minutes.com should should still exist");
   if (hoursSinceMidnight > 1) {
-    ok((await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok((await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should still exist");
   }
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
     "Pretend visit to before-today.com should still exist");
 
   await countEntries("1hour", "1hour form entry should be deleted", checkZero);
   await countEntries("1hour10minutes", "1hour10minutes form entry should still exist", checkOne);
   await countEntries("2hour", "2hour form entry should still exist", checkOne);
   await countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
   await countEntries("4hour", "4hour form entry should still exist", checkOne);
   await countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
@@ -208,31 +208,31 @@ async function onHistoryReady() {
   // Clear 1 hour 10 minutes
   s.range = [now_uSec - 70 * 60 * 1000000, now_uSec];
   await s.sanitize();
   s.range = null;
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://1hour10minutes.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://1hour10minutes.com")),
      "Pretend visit to 1hour10minutes.com should now be deleted");
-  ok((await promiseIsURIVisited(makeURI("http://2hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://2hour.com")),
      "Pretend visit to 2hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://2hour10minutes.com")),
      "Pretend visit to 2hour10minutes.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour.com")),
      "Pretend visit to 4hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour10minutes.com")),
      "Pretend visit to 4hour10minutes.com should should still exist");
   if (minutesSinceMidnight > 70) {
-    ok((await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok((await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should still exist");
   }
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
     "Pretend visit to before-today.com should still exist");
 
   await countEntries("1hour10minutes", "1hour10minutes form entry should be deleted", checkZero);
   await countEntries("2hour", "2hour form entry should still exist", checkOne);
   await countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
   await countEntries("4hour", "4hour form entry should still exist", checkOne);
   await countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
   if (minutesSinceMidnight > 70)
@@ -253,29 +253,29 @@ async function onHistoryReady() {
 
   // Clear 2 hours
   Sanitizer.prefs.setIntPref("timeSpan", 2);
   await s.sanitize();
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://2hour.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://2hour.com")),
      "Pretend visit to 2hour.com should now be deleted");
-  ok((await promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://2hour10minutes.com")),
      "Pretend visit to 2hour10minutes.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour.com")),
      "Pretend visit to 4hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour10minutes.com")),
      "Pretend visit to 4hour10minutes.com should should still exist");
   if (hoursSinceMidnight > 2) {
-    ok((await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok((await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should still exist");
   }
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
     "Pretend visit to before-today.com should still exist");
 
   await countEntries("2hour", "2hour form entry should be deleted", checkZero);
   await countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
   await countEntries("4hour", "4hour form entry should still exist", checkOne);
   await countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
   if (hoursSinceMidnight > 2)
     await countEntries("today", "today form entry should still exist", checkOne);
@@ -295,27 +295,27 @@ async function onHistoryReady() {
   // Clear 2 hours 10 minutes
   s.range = [now_uSec - 130 * 60 * 1000000, now_uSec];
   await s.sanitize();
   s.range = null;
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://2hour10minutes.com")),
      "Pretend visit to 2hour10minutes.com should now be deleted");
-  ok((await promiseIsURIVisited(makeURI("http://4hour.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour.com")),
      "Pretend visit to 4hour.com should should still exist");
-  ok((await promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour10minutes.com")),
      "Pretend visit to 4hour10minutes.com should should still exist");
   if (minutesSinceMidnight > 130) {
-    ok((await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok((await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should still exist");
   }
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
     "Pretend visit to before-today.com should still exist");
 
   await countEntries("2hour10minutes", "2hour10minutes form entry should be deleted", checkZero);
   await countEntries("4hour", "4hour form entry should still exist", checkOne);
   await countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
   if (minutesSinceMidnight > 130)
     await countEntries("today", "today form entry should still exist", checkOne);
   await countEntries("b4today", "b4today form entry should still exist", checkOne);
@@ -332,25 +332,25 @@ async function onHistoryReady() {
 
   // Clear 4 hours
   Sanitizer.prefs.setIntPref("timeSpan", 3);
   await s.sanitize();
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://4hour.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://4hour.com")),
      "Pretend visit to 4hour.com should now be deleted");
-  ok((await promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://4hour10minutes.com")),
      "Pretend visit to 4hour10minutes.com should should still exist");
   if (hoursSinceMidnight > 4) {
-    ok((await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok((await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should still exist");
   }
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
     "Pretend visit to before-today.com should still exist");
 
   await countEntries("4hour", "4hour form entry should be deleted", checkZero);
   await countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
   if (hoursSinceMidnight > 4)
     await countEntries("today", "today form entry should still exist", checkOne);
   await countEntries("b4today", "b4today form entry should still exist", checkOne);
 
@@ -366,23 +366,23 @@ async function onHistoryReady() {
   // Clear 4 hours 10 minutes
   s.range = [now_uSec - 250 * 60 * 1000000, now_uSec];
   await s.sanitize();
   s.range = null;
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://4hour10minutes.com")),
      "Pretend visit to 4hour10minutes.com should now be deleted");
   if (minutesSinceMidnight > 250) {
-    ok((await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok((await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should still exist");
   }
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
     "Pretend visit to before-today.com should still exist");
 
   await countEntries("4hour10minutes", "4hour10minutes form entry should be deleted", checkZero);
   if (minutesSinceMidnight > 250)
     await countEntries("today", "today form entry should still exist", checkOne);
   await countEntries("b4today", "b4today form entry should still exist", checkOne);
 
   ok(!(await downloadExists(publicList, "fakefile-4-hour-10-minutes")), "4 hour 10 minute download should now be deleted");
@@ -408,39 +408,39 @@ async function onHistoryReady() {
 
   // Be careful.  If we add our objectss just before midnight, and sanitize
   // runs immediately after, they won't be expired.  This is expected, but
   // we should not test in that case.  We cannot just test for opposite
   // condition because we could cross midnight just one moment after we
   // cache our time, then we would have an even worse random failure.
   var today = isToday(new Date(now_mSec));
   if (today) {
-    ok(!(await promiseIsURIVisited(makeURI("http://today.com"))),
+    ok(!(await PlacesUtils.history.hasVisits("http://today.com")),
        "Pretend visit to today.com should now be deleted");
 
     await countEntries("today", "today form entry should be deleted", checkZero);
     ok(!(await downloadExists(publicList, "fakefile-today")), "'Today' download should now be deleted");
   }
 
-  ok((await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok((await PlacesUtils.history.hasVisits("http://before-today.com")),
      "Pretend visit to before-today.com should still exist");
   await countEntries("b4today", "b4today form entry should still exist", checkOne);
   ok((await downloadExists(publicList, "fakefile-old")), "Year old download should still be present");
 
   downloadPromise = promiseDownloadRemoved(publicList);
   formHistoryPromise = promiseFormHistoryRemoved();
 
   // Choose everything
   Sanitizer.prefs.setIntPref("timeSpan", 0);
   await s.sanitize();
 
   await formHistoryPromise;
   await downloadPromise;
 
-  ok(!(await promiseIsURIVisited(makeURI("http://before-today.com"))),
+  ok(!(await PlacesUtils.history.hasVisits("http://before-today.com")),
      "Pretend visit to before-today.com should now be deleted");
 
   await countEntries("b4today", "b4today form entry should be deleted", checkZero);
 
   ok(!(await downloadExists(publicList, "fakefile-old")), "Year old download should now be deleted");
 }
 
 function setupHistory() {
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -268,34 +268,16 @@ function waitForAsyncUpdates(aCallback, 
     handleError() {},
     handleCompletion(aReason) {
       aCallback.apply(scope, args);
     }
   });
   commit.finalize();
 }
 
-/**
- * Asynchronously check a url is visited.
-
- * @param aURI The URI.
- * @param aExpectedValue The expected value.
- * @return {Promise}
- * @resolves When the check has been added successfully.
- * @rejects JavaScript exception.
- */
-function promiseIsURIVisited(aURI, aExpectedValue) {
-  return new Promise(resolve => {
-    PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
-      resolve(aIsVisited);
-    });
-
-  });
-}
-
 function whenNewTabLoaded(aWindow, aCallback) {
   aWindow.BrowserOpenTab();
 
   let browser = aWindow.gBrowser.selectedBrowser;
   let doc = browser.contentDocumentAsCPOW;
   if (doc && doc.readyState === "complete") {
     aCallback();
     return;
@@ -332,17 +314,16 @@ function promiseHistoryClearedState(aURI
     }
     aURIs.forEach(function(aURI) {
       PlacesUtils.asyncHistory.isURIVisited(aURI, function(uri, isVisited) {
         is(isVisited, !aShouldBeCleared,
            "history visit " + uri.spec + " should " + niceStr + " exist");
         callbackDone();
       });
     });
-
   });
 }
 
 var FullZoomHelper = {
 
   selectTabAndWaitForLocationChange: function selectTabAndWaitForLocationChange(tab) {
     if (!tab)
       throw new Error("tab must be given.");
--- a/browser/components/places/tests/browser/browser_library_commands.js
+++ b/browser/components/places/tests/browser/browser_library_commands.js
@@ -64,17 +64,17 @@ add_task(async function test_date_contai
   PO._places.controller.doCommand("cmd_delete");
   await promiseURIRemoved;
 
   // Test live update of "History" query.
   is(historyNode.childCount, 0, "History node has no more children");
 
   historyNode.containerOpen = false;
 
-  ok(!(await promiseIsURIVisited(TEST_URI)), "Visit has been removed");
+  ok(!(await PlacesUtils.history.hasVisits(TEST_URI)), "Visit has been removed");
 
   library.close();
 });
 
 add_task(async function test_query_on_toolbar() {
   let library = await promiseLibrary();
   info("Ensure queries can be cut or deleted");
 
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -145,25 +145,19 @@ function synthesizeClickOnSelectedTreeCe
 /**
  * Asynchronously check a url is visited.
  *
  * @param aURI The URI.
  * @return {Promise}
  * @resolves When the check has been added successfully.
  * @rejects JavaScript exception.
  */
-function promiseIsURIVisited(aURI) {
-  return new Promise(resolve => {
-
-    PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
-      resolve(aIsVisited);
-    });
-
-  });
-}
+ function promiseIsURIVisited(aURI) {
+   return PlacesUtils.history.hasVisits(aURI);
+ }
 
 /**
  * Makes the specified toolbar visible or invisible and returns a Promise object
  * that is resolved when the toolbar has completed any animations associated
  * with hiding or showing the toolbar.
  *
  * Note that this code assumes that changes to a toolbar's visibility trigger
  * a transition on the max-height property of the toolbar element.
--- a/services/sync/tests/unit/test_corrupt_keys.js
+++ b/services/sync/tests/unit/test_corrupt_keys.js
@@ -126,21 +126,21 @@ add_task(async function test_locally_cha
     // Now syncing should succeed, after one HMAC error.
     let ping = await wait_for_ping(() => Service.sync(), true);
     equal(ping.engines.find(e => e.name == "history").incoming.applied, 5);
 
     Assert.equal(hmacErrorCount, 1);
     _("Keys now: " + Service.collectionKeys.keyForCollection("history").keyPair);
 
     // And look! We downloaded history!
-    Assert.ok(await promiseIsURIVisited("http://foo/bar?record-no--0"));
-    Assert.ok(await promiseIsURIVisited("http://foo/bar?record-no--1"));
-    Assert.ok(await promiseIsURIVisited("http://foo/bar?record-no--2"));
-    Assert.ok(await promiseIsURIVisited("http://foo/bar?record-no--3"));
-    Assert.ok(await promiseIsURIVisited("http://foo/bar?record-no--4"));
+    Assert.ok(await PlacesUtils.history.hasVisits("http://foo/bar?record-no--0"));
+    Assert.ok(await PlacesUtils.history.hasVisits("http://foo/bar?record-no--1"));
+    Assert.ok(await PlacesUtils.history.hasVisits("http://foo/bar?record-no--2"));
+    Assert.ok(await PlacesUtils.history.hasVisits("http://foo/bar?record-no--3"));
+    Assert.ok(await PlacesUtils.history.hasVisits("http://foo/bar?record-no--4"));
     Assert.equal(hmacErrorCount, 1);
 
     _("Busting some new server values.");
     // Now what happens if we corrupt the HMAC on the server?
     for (let i = 5; i < 10; i++) {
       let id = "record-no--" + i;
       let modified = 1 + (Date.now() / 1000);
 
@@ -171,40 +171,25 @@ add_task(async function test_locally_cha
     _("Syncing...");
     ping = await sync_and_validate_telem(true);
 
     Assert.equal(ping.engines.find(e => e.name == "history").incoming.failed, 5);
     _("Keys now: " + Service.collectionKeys.keyForCollection("history").keyPair);
     _("Server keys have been updated, and we skipped over 5 more HMAC errors without adjusting history.");
     Assert.ok(johndoe.modified("crypto") > old_key_time);
     Assert.equal(hmacErrorCount, 6);
-    Assert.equal(false, await promiseIsURIVisited("http://foo/bar?record-no--5"));
-    Assert.equal(false, await promiseIsURIVisited("http://foo/bar?record-no--6"));
-    Assert.equal(false, await promiseIsURIVisited("http://foo/bar?record-no--7"));
-    Assert.equal(false, await promiseIsURIVisited("http://foo/bar?record-no--8"));
-    Assert.equal(false, await promiseIsURIVisited("http://foo/bar?record-no--9"));
+    Assert.equal(false, await PlacesUtils.history.hasVisits("http://foo/bar?record-no--5"));
+    Assert.equal(false, await PlacesUtils.history.hasVisits("http://foo/bar?record-no--6"));
+    Assert.equal(false, await PlacesUtils.history.hasVisits("http://foo/bar?record-no--7"));
+    Assert.equal(false, await PlacesUtils.history.hasVisits("http://foo/bar?record-no--8"));
+    Assert.equal(false, await PlacesUtils.history.hasVisits("http://foo/bar?record-no--9"));
   } finally {
     Svc.Prefs.resetBranch("");
     await promiseStopServer(server);
   }
 });
 
 function run_test() {
   Log.repository.rootLogger.addAppender(new Log.DumpAppender());
   validate_all_future_pings();
 
   run_next_test();
 }
-
-/**
- * Asynchronously check a url is visited.
- * @param url the url
- * @return {Promise}
- * @resolves When the check has been added successfully.
- * @rejects JavaScript exception.
- */
-function promiseIsURIVisited(url) {
-  return new Promise(resolve => {
-    PlacesUtils.asyncHistory.isURIVisited(CommonUtils.makeURI(url), function(aURI, aIsVisited) {
-      resolve(aIsVisited);
-    });
-  });
-}
--- a/toolkit/components/jsdownloads/test/unit/common_test_Download.js
+++ b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
@@ -2405,17 +2405,17 @@ add_task(async function test_history() {
 
   // Restart and complete the download after clearing history.
   await PlacesUtils.history.clear();
   download.cancel();
   continueResponses();
   await download.start();
 
   // The restart should not have added a new history visit.
-  Assert.equal(false, await promiseIsURIVisited(httpUrl("interruptible.txt")));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(httpUrl("interruptible.txt")));
 });
 
 /**
  * Checks that downloads started by nsIHelperAppService are added to the
  * browsing history when they start.
  */
 add_task(async function test_history_tryToKeepPartialData() {
   // We will wait for the visit to be notified during the download.
--- a/toolkit/components/jsdownloads/test/unit/head.js
+++ b/toolkit/components/jsdownloads/test/unit/head.js
@@ -176,37 +176,16 @@ function promiseWaitForVisit(aUrl) {
       onPageChanged() {},
       onDeleteVisits() {},
     });
 
   });
 }
 
 /**
- * Check browsing history to see whether the given URI has been visited.
- *
- * @param aUrl
- *        String containing the URI that will be visited.
- *
- * @return {Promise}
- * @resolves Boolean indicating whether the URI has been visited.
- * @rejects JavaScript exception.
- */
-function promiseIsURIVisited(aUrl) {
-  return new Promise(resolve => {
-
-    PlacesUtils.asyncHistory.isURIVisited(NetUtil.newURI(aUrl),
-      function(aURI, aIsVisited) {
-        resolve(aIsVisited);
-      });
-
-  });
-}
-
-/**
  * Creates a new Download object, setting a temporary file as the target.
  *
  * @param aSourceUrl
  *        String containing the URI for the download source, or null to use
  *        httpUrl("source.txt").
  *
  * @return {Promise}
  * @resolves The newly created Download object.
--- a/toolkit/components/places/nsLivemarkService.js
+++ b/toolkit/components/places/nsLivemarkService.js
@@ -8,20 +8,20 @@ const { classes: Cc, interfaces: Ci, res
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
                                   "resource://gre/modules/PlacesUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
                                   "resource://gre/modules/NetUtil.jsm");
 
-XPCOMUtils.defineLazyGetter(this, "asyncHistory", function() {
+XPCOMUtils.defineLazyGetter(this, "history", function() {
   // Lazily add an history observer when it's actually needed.
   PlacesUtils.history.addObserver(PlacesUtils.livemarks, true);
-  return PlacesUtils.asyncHistory;
+  return PlacesUtils.history;
 });
 
 // Constants
 
 // Delay between reloads of consecute livemarks.
 const RELOAD_DELAY_MS = 500;
 // Expire livemarks after this time.
 const EXPIRE_TIME_MS = 3600000; // 1 hour.
@@ -596,18 +596,18 @@ Livemark.prototype = {
 
     // Discard the previous cached nodes, new ones should be generated.
     for (let container of this._resultObservers.keys()) {
       this._nodes.delete(container);
     }
 
     // Update visited status for each entry.
     for (let child of this._children) {
-      asyncHistory.isURIVisited(child.uri, (aURI, aIsVisited) => {
-        this.updateURIVisitedStatus(aURI, aIsVisited);
+      history.hasVisits(child.uri, isVisited => {
+        this.updateURIVisitedStatus(child.uri, isVisited);
       });
     }
 
     return this._children;
   },
 
   _isURIVisited(aURI) {
     return this.children.some(child => child.uri.equals(aURI) && child.visited);
--- a/toolkit/components/places/tests/browser/browser_bug680727.js
+++ b/toolkit/components/places/tests/browser/browser_bug680727.js
@@ -2,19 +2,16 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /* Ensure that clicking the button in the Offline mode neterror page updates
    global history. See bug 680727. */
 /* TEST_PATH=toolkit/components/places/tests/browser/browser_bug680727.js make -C $(OBJDIR) mochitest-browser-chrome */
 
 
 const kUniqueURI = Services.io.newURI("http://mochi.test:8888/#bug_680727");
-var gAsyncHistory =
-  Cc["@mozilla.org/browser/history;1"].getService(Ci.mozIAsyncHistory);
-
 var proxyPrefValue;
 var ourTab;
 
 function test() {
   waitForExplicitFinish();
 
   // Tests always connect to localhost, and per bug 87717, localhost is now
   // reachable in offline mode.  To avoid this, disable any proxy.
@@ -44,18 +41,20 @@ function errorListener() {
   ContentTask.spawn(ourTab.linkedBrowser, kUniqueURI.spec, function(uri) {
     Assert.equal(content.document.documentURI.substring(0, 27),
       "about:neterror?e=netOffline", "Document URI is the error page.");
 
     // But location bar should show the original request.
     Assert.equal(content.location.href, uri, "Docshell URI is the original URI.");
   }).then(() => {
     // Global history does not record URI of a failed request.
-    return PlacesTestUtils.promiseAsyncUpdates().then(() => {
-      gAsyncHistory.isURIVisited(kUniqueURI, errorAsyncListener);
+    PlacesTestUtils.promiseAsyncUpdates().then(() => {
+      PlacesUtils.history.hasVisits(kUniqueURI).then(isVisited => {
+        errorAsyncListener(kUniqueURI, isVisited);
+      });
     });
   });
 }
 
 function errorAsyncListener(aURI, aIsVisited) {
   ok(kUniqueURI.equals(aURI) && !aIsVisited,
      "The neterror page is not listed in global history.");
 
@@ -84,17 +83,19 @@ function reloadListener() {
 
   ContentTask.spawn(ourTab.linkedBrowser, kUniqueURI.spec, function(uri) {
     // This is not an error page.
     Assert.equal(content.document.documentURI, uri,
       "Document URI is not the offline-error page, but the original URI.");
   }).then(() => {
     // Check if global history remembers the successfully-requested URI.
     PlacesTestUtils.promiseAsyncUpdates().then(() => {
-      gAsyncHistory.isURIVisited(kUniqueURI, reloadAsyncListener);
+      PlacesUtils.history.hasVisits(kUniqueURI).then(isVisited => {
+          reloadAsyncListener(kUniqueURI, isVisited);
+      });
     });
   });
 }
 
 function reloadAsyncListener(aURI, aIsVisited) {
   ok(kUniqueURI.equals(aURI) && aIsVisited, "We have visited the URI.");
   PlacesTestUtils.clearHistory().then(finish);
 }
--- a/toolkit/components/places/tests/browser/browser_history_post.js
+++ b/toolkit/components/places/tests/browser/browser_history_post.js
@@ -10,13 +10,13 @@ add_task(async function() {
       let p = new Promise((resolve, reject) => {
         iframe.addEventListener("load", function() {
           resolve();
         }, {once: true});
       });
       submit.click();
       await p;
     });
-    let visited = await promiseIsURIVisited(SJS_URI);
+    let visited = await PlacesUtils.history.hasVisits(SJS_URI);
     ok(!visited, "The POST page should not be added to history");
     ok(!(await PlacesTestUtils.isPageInDB(SJS_URI.spec)), "The page should not be in the database");
   });
 });
--- a/toolkit/components/places/tests/browser/head.js
+++ b/toolkit/components/places/tests/browser/head.js
@@ -290,33 +290,16 @@ function DBConn(aForceNewConnection) {
   return gDBConn.connectionReady ? gDBConn : null;
 }
 
 function whenNewWindowLoaded(aOptions, aCallback) {
   BrowserTestUtils.waitForNewWindow().then(aCallback);
   OpenBrowserWindow(aOptions);
 }
 
-/**
- * Asynchronously check a url is visited.
- *
- * @param aURI The URI.
- * @param aExpectedValue The expected value.
- * @return {Promise}
- * @resolves When the check has been added successfully.
- * @rejects JavaScript exception.
- */
-function promiseIsURIVisited(aURI, aExpectedValue) {
-  return new Promise(resolve => {
-    PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
-      resolve(aIsVisited);
-    });
-  });
-}
-
 function waitForCondition(condition, nextTest, errorMsg) {
   let tries = 0;
   let interval = setInterval(function() {
     if (tries >= 30) {
       ok(false, errorMsg);
       moveOn();
     }
     let conditionPassed;
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -787,34 +787,16 @@ NavHistoryResultObserver.prototype = {
   nodeTitleChanged() {},
   nodeURIChanged() {},
   sortingChanged() {},
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsINavHistoryResultObserver,
   ])
 };
 
-/**
- * Asynchronously check a url is visited.
- *
- * @param aURI The URI.
- * @return {Promise}
- * @resolves When the check has been added successfully.
- * @rejects JavaScript exception.
- */
-function promiseIsURIVisited(aURI) {
-  return new Promise(resolve => {
-
-    PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
-      resolve(aIsVisited);
-    });
-
-  });
-}
-
 function checkBookmarkObject(info) {
   do_check_valid_places_guid(info.guid);
   do_check_valid_places_guid(info.parentGuid);
   Assert.ok(typeof info.index == "number", "index should be a number");
   Assert.ok(info.dateAdded.constructor.name == "Date", "dateAdded should be a Date");
   Assert.ok(info.lastModified.constructor.name == "Date", "lastModified should be a Date");
   Assert.ok(info.lastModified >= info.dateAdded, "lastModified should never be smaller than dateAdded");
   Assert.ok(typeof info.type == "number", "type should be a number");
--- a/toolkit/components/places/tests/history/test_async_history_api.js
+++ b/toolkit/components/places/tests/history/test_async_history_api.js
@@ -372,80 +372,80 @@ add_task(async function test_non_addable
 
   let placesResult = await promiseUpdatePlaces(places);
   if (placesResult.results.length > 0) {
     do_throw("Unexpected success.");
   }
   for (let place of placesResult.errors) {
     info("Checking '" + place.info.uri.spec + "'");
     Assert.equal(place.resultCode, Cr.NS_ERROR_INVALID_ARG);
-    Assert.equal(false, await promiseIsURIVisited(place.info.uri));
+    Assert.equal(false, await PlacesUtils.history.hasVisits(place.info.uri));
   }
   await PlacesTestUtils.promiseAsyncUpdates();
 });
 
 add_task(async function test_duplicate_guid_errors() {
   // This test ensures that trying to add a visit, with a guid already found in
   // another visit, fails.
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_first"),
     visits: [
       new VisitInfo(),
     ],
   };
 
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
-  Assert.ok(await promiseIsURIVisited(placeInfo.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(placeInfo.uri));
 
   let badPlace = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_second"),
     visits: [
       new VisitInfo(),
     ],
     guid: placeInfo.guid,
   };
 
-  Assert.equal(false, await promiseIsURIVisited(badPlace.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(badPlace.uri));
   placesResult = await promiseUpdatePlaces(badPlace);
   if (placesResult.results.length > 0) {
     do_throw("Unexpected success.");
   }
   let badPlaceInfo = placesResult.errors[0];
   Assert.equal(badPlaceInfo.resultCode, Cr.NS_ERROR_STORAGE_CONSTRAINT);
-  Assert.equal(false, await promiseIsURIVisited(badPlaceInfo.info.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(badPlaceInfo.info.uri));
 
   await PlacesTestUtils.promiseAsyncUpdates();
 });
 
 add_task(async function test_invalid_referrerURI_ignored() {
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN +
                         "test_invalid_referrerURI_ignored"),
     visits: [
       new VisitInfo(),
     ],
   };
   place.visits[0].referrerURI = NetUtil.newURI(place.uri.spec + "_unvisistedURI");
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
-  Assert.equal(false, await promiseIsURIVisited(place.visits[0].referrerURI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.visits[0].referrerURI));
 
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
-  Assert.ok(await promiseIsURIVisited(placeInfo.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(placeInfo.uri));
 
   // Check to make sure we do not visit the invalid referrer.
-  Assert.equal(false, await promiseIsURIVisited(place.visits[0].referrerURI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.visits[0].referrerURI));
 
   // Check to make sure from_visit is zero in database.
   let stmt = DBConn().createStatement(
     `SELECT from_visit
      FROM moz_historyvisits
      WHERE id = :visit_id`
   );
   stmt.params.visit_id = placeInfo.visits[0].visitId;
@@ -460,24 +460,24 @@ add_task(async function test_nonnsIURI_r
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN +
                         "test_nonnsIURI_referrerURI_ignored"),
     visits: [
       new VisitInfo(),
     ],
   };
   place.visits[0].referrerURI = place.uri.spec + "_nonnsIURI";
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
-  Assert.ok(await promiseIsURIVisited(placeInfo.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(placeInfo.uri));
 
   // Check to make sure from_visit is zero in database.
   let stmt = DBConn().createStatement(
     `SELECT from_visit
      FROM moz_historyvisits
      WHERE id = :visit_id`
   );
   stmt.params.visit_id = placeInfo.visits[0].visitId;
@@ -497,43 +497,43 @@ add_task(async function test_old_referre
     uri: NetUtil.newURI(TEST_DOMAIN + "test_old_referrer_ignored_referrer"),
     visits: [
       new VisitInfo(TRANSITION_LINK, oldTime),
     ],
   };
 
   // First we must add our referrer to the history so that it is not ignored
   // as being invalid.
-  Assert.equal(false, await promiseIsURIVisited(referrerPlace.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(referrerPlace.uri));
   let placesResult = await promiseUpdatePlaces(referrerPlace);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
 
   // Now that the referrer is added, we can add a page with a valid
   // referrer to determine if the recency of the referrer is taken into
   // account.
-  Assert.ok(await promiseIsURIVisited(referrerPlace.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(referrerPlace.uri));
 
   let visitInfo = new VisitInfo();
   visitInfo.referrerURI = referrerPlace.uri;
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_old_referrer_ignored_page"),
     visits: [
       visitInfo,
     ],
   };
 
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
   placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
-  Assert.ok(await promiseIsURIVisited(place.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(place.uri));
 
   // Though the visit will not contain the referrer, we must examine the
   // database to be sure.
   Assert.equal(placeInfo.visits[0].referrerURI, null);
   let stmt = DBConn().createStatement(
     `SELECT COUNT(1) AS count
      FROM moz_historyvisits
      JOIN moz_places h ON h.id = place_id
@@ -551,44 +551,44 @@ add_task(async function test_old_referre
 add_task(async function test_place_id_ignored() {
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_place_id_ignored_first"),
     visits: [
       new VisitInfo(),
     ],
   };
 
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
-  Assert.ok(await promiseIsURIVisited(place.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(place.uri));
 
   let placeId = placeInfo.placeId;
   Assert.notEqual(placeId, 0);
 
   let badPlace = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_place_id_ignored_second"),
     visits: [
       new VisitInfo(),
     ],
     placeId,
   };
 
-  Assert.equal(false, await promiseIsURIVisited(badPlace.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(badPlace.uri));
   placesResult = await promiseUpdatePlaces(badPlace);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   placeInfo = placesResult.results[0];
 
   Assert.notEqual(placeInfo.placeId, placeId);
-  Assert.ok(await promiseIsURIVisited(badPlace.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(badPlace.uri));
 
   await PlacesTestUtils.promiseAsyncUpdates();
 });
 
 add_task(async function test_handleCompletion_called_when_complete() {
   // We test a normal visit, and embeded visit, and a uri that would fail
   // the canAddURI test to make sure that the notification happens after *all*
   // of them have had a callback.
@@ -601,18 +601,18 @@ add_task(async function test_handleCompl
       ],
     },
     { uri: NetUtil.newURI("data:,Hello%2C%20World!"),
       visits: [
         new VisitInfo(),
       ],
     },
   ];
-  Assert.equal(false, await promiseIsURIVisited(places[0].uri));
-  Assert.equal(false, await promiseIsURIVisited(places[1].uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(places[0].uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(places[1].uri));
 
   const EXPECTED_COUNT_SUCCESS = 2;
   const EXPECTED_COUNT_FAILURE = 1;
 
   let {results, errors} = await promiseUpdatePlaces(places);
 
   Assert.equal(results.length, EXPECTED_COUNT_SUCCESS);
   Assert.equal(errors.length, EXPECTED_COUNT_FAILURE);
@@ -626,25 +626,25 @@ add_task(async function test_add_visit()
     uri: NetUtil.newURI(TEST_DOMAIN + "test_add_visit"),
     title: "test_add_visit title",
     visits: [],
   };
   for (let t in PlacesUtils.history.TRANSITIONS) {
     let transitionType = PlacesUtils.history.TRANSITIONS[t];
     place.visits.push(new VisitInfo(transitionType, VISIT_TIME));
   }
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   let callbackCount = 0;
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   for (let placeInfo of placesResult.results) {
-    Assert.ok(await promiseIsURIVisited(place.uri));
+    Assert.ok(await PlacesUtils.history.hasVisits(place.uri));
 
     // Check mozIPlaceInfo properties.
     Assert.ok(place.uri.equals(placeInfo.uri));
     Assert.equal(placeInfo.frecency, -1); // We don't pass frecency here!
     Assert.equal(placeInfo.title, place.title);
 
     // Check mozIVisitInfo properties.
     let visits = placeInfo.visits;
@@ -688,28 +688,28 @@ add_task(async function test_properties_
     let place = {
       uri: NetUtil.newURI(TEST_DOMAIN + "test_properties_saved/" +
                           transitionType),
       title: "test_properties_saved test",
       visits: [
         new VisitInfo(transitionType),
       ],
     };
-    Assert.equal(false, await promiseIsURIVisited(place.uri));
+    Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
     places.push(place);
   }
 
   let callbackCount = 0;
   let placesResult = await promiseUpdatePlaces(places);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   for (let placeInfo of placesResult.results) {
     let uri = placeInfo.uri;
-    Assert.ok(await promiseIsURIVisited(uri));
+    Assert.ok(await PlacesUtils.history.hasVisits(uri));
     let visit = placeInfo.visits[0];
     print("TEST-INFO | test_properties_saved | updatePlaces callback for " +
           "transition type " + visit.transitionType);
 
     // Note that TRANSITION_EMBED should not be in the database.
     const EXPECTED_COUNT = visit.transitionType == TRANSITION_EMBED ? 0 : 1;
 
     // mozIVisitInfo::date
@@ -766,25 +766,25 @@ add_task(async function test_guid_saved(
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_guid_saved"),
     guid: "__TESTGUID__",
     visits: [
       new VisitInfo(),
     ],
   };
   do_check_valid_places_guid(place.guid);
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
   let uri = placeInfo.uri;
-  Assert.ok(await promiseIsURIVisited(uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(uri));
   Assert.equal(placeInfo.guid, place.guid);
   do_check_guid_for_uri(uri, place.guid);
   await PlacesTestUtils.promiseAsyncUpdates();
 });
 
 add_task(async function test_referrer_saved() {
   let places = [
     { uri: NetUtil.newURI(TEST_DOMAIN + "test_referrer_saved/referrer"),
@@ -794,27 +794,27 @@ add_task(async function test_referrer_sa
     },
     { uri: NetUtil.newURI(TEST_DOMAIN + "test_referrer_saved/test"),
       visits: [
         new VisitInfo(),
       ],
     },
   ];
   places[1].visits[0].referrerURI = places[0].uri;
-  Assert.equal(false, await promiseIsURIVisited(places[0].uri));
-  Assert.equal(false, await promiseIsURIVisited(places[1].uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(places[0].uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(places[1].uri));
 
   let resultCount = 0;
   let placesResult = await promiseUpdatePlaces(places);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   for (let placeInfo of placesResult.results) {
     let uri = placeInfo.uri;
-    Assert.ok(await promiseIsURIVisited(uri));
+    Assert.ok(await PlacesUtils.history.hasVisits(uri));
     let visit = placeInfo.visits[0];
 
     // We need to insert all of our visits before we can test conditions.
     if (++resultCount == places.length) {
       Assert.ok(places[0].uri.equals(visit.referrerURI));
 
       let stmt = DBConn().createStatement(
         `SELECT COUNT(1) AS count
@@ -842,17 +842,17 @@ add_task(async function test_referrer_sa
 add_task(async function test_guid_change_saved() {
   // First, add a visit for it.
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_guid_change_saved"),
     visits: [
       new VisitInfo(),
     ],
   };
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   // Then, change the guid with visits.
   place.guid = "_GUIDCHANGE_";
   place.visits = [new VisitInfo()];
@@ -869,17 +869,17 @@ add_task(async function test_title_chang
   // First, add a visit for it.
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_title_change_saved"),
     title: "original title",
     visits: [
       new VisitInfo(),
     ],
   };
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
 
   // Now, make sure the empty string clears the title.
   place.title = "";
@@ -916,17 +916,17 @@ add_task(async function test_no_title_do
   // First, add a visit for it.
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_no_title_does_not_clear_title"),
     title: TITLE,
     visits: [
       new VisitInfo(),
     ],
   };
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   // Now, make sure that not specifying a title does not clear it.
   delete place.title;
   place.visits = [new VisitInfo()];
@@ -943,17 +943,17 @@ add_task(async function test_title_chang
   // There are three cases to test.  The first case is to make sure we do not
   // get notified if we do not specify a title.
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_title_change_notifies"),
     visits: [
       new VisitInfo(),
     ],
   };
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   let silentObserver =
     new TitleChangedObserver(place.uri, "DO NOT WANT", function() {
       do_throw("unexpected callback!");
     });
 
   PlacesUtils.history.addObserver(silentObserver);
   let placesResult = await promiseUpdatePlaces(place);
@@ -1010,17 +1010,17 @@ add_task(async function test_visit_notif
   // nsINavHistoryObserver and the other is the uri-visit-saved observer topic.
   let place = {
     guid: "abcdefghijkl",
     uri: NetUtil.newURI(TEST_DOMAIN + "test_visit_notifies"),
     visits: [
       new VisitInfo(),
     ],
   };
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
 
   function promiseVisitObserver(aPlace) {
     return new Promise((resolve, reject) => {
       let callbackCount = 0;
       let finisher = function() {
         if (++callbackCount == 2) {
           resolve();
         }
@@ -1155,33 +1155,33 @@ add_task(async function test_ignore_erro
   // another visit, fails - but doesn't report if we told it not to.
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_first"),
     visits: [
       new VisitInfo(),
     ],
   };
 
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
-  Assert.ok(await promiseIsURIVisited(placeInfo.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(placeInfo.uri));
 
   let badPlace = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_second"),
     visits: [
       new VisitInfo(),
     ],
     guid: placeInfo.guid,
   };
 
-  Assert.equal(false, await promiseIsURIVisited(badPlace.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(badPlace.uri));
   placesResult = await promiseUpdatePlaces(badPlace, {ignoreErrors: true});
   if (placesResult.results.length > 0) {
     do_throw("Unexpected success.");
   }
   Assert.equal(placesResult.errors.length, 0,
                "Should have seen 0 errors because we disabled reporting.");
   Assert.equal(placesResult.results.length, 0,
                "Should have seen 0 results because there were none.");
@@ -1215,23 +1215,23 @@ add_task(async function test_ignore_resu
   // another visit, fails - but doesn't report if we told it not to.
   let place = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_first"),
     visits: [
       new VisitInfo(),
     ],
   };
 
-  Assert.equal(false, await promiseIsURIVisited(place.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(place.uri));
   let placesResult = await promiseUpdatePlaces(place);
   if (placesResult.errors.length > 0) {
     do_throw("Unexpected error.");
   }
   let placeInfo = placesResult.results[0];
-  Assert.ok(await promiseIsURIVisited(placeInfo.uri));
+  Assert.ok(await PlacesUtils.history.hasVisits(placeInfo.uri));
 
   let badPlace = {
     uri: NetUtil.newURI(TEST_DOMAIN + "test_duplicate_guid_fails_second"),
     visits: [
       new VisitInfo(),
     ],
     guid: placeInfo.guid,
   };
@@ -1240,17 +1240,17 @@ add_task(async function test_ignore_resu
       uri: NetUtil.newURI(TEST_DOMAIN + "test_other_successful_item"),
       visits: [
         new VisitInfo(),
       ],
     },
     badPlace,
   ];
 
-  Assert.equal(false, await promiseIsURIVisited(badPlace.uri));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(badPlace.uri));
   placesResult = await promiseUpdatePlaces(allPlaces, {ignoreErrors: true, ignoreResults: true});
   Assert.equal(placesResult.errors.length, 0,
                "Should have seen 0 errors because we disabled reporting.");
   Assert.equal(placesResult.results.length, 0,
                "Should have seen 0 results because we disabled reporting.");
   Assert.equal(placesResult.resultCount, 1,
                "Should know that we updated 1 item from the completion callback.");
   await PlacesTestUtils.promiseAsyncUpdates();
--- a/toolkit/components/places/tests/history/test_removeVisits.js
+++ b/toolkit/components/places/tests/history/test_removeVisits.js
@@ -39,18 +39,18 @@ add_task(async function remove_visits_ou
   root.containerOpen = true;
   Assert.equal(root.childCount, 10);
   for (let i = 0; i < root.childCount; i++) {
     let visitTime = root.getChild(i).time;
     Assert.equal(visitTime, DB_NOW - 100000 - (i * 1000));
   }
   root.containerOpen = false;
 
-  info("asyncHistory.isURIVisited should return true.");
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  info("PlacesUtils.history.hasVisits should return true.");
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
 
   await PlacesTestUtils.promiseAsyncUpdates();
   info("Frecency should be positive.");
   Assert.ok(frecencyForUrl(TEST_URI) > 0);
 
   await cleanup();
 });
 
@@ -91,17 +91,17 @@ add_task(async function remove_visits_ou
   Assert.equal(root.childCount, 10);
   for (let i = 0; i < root.childCount; i++) {
     let visitTime = root.getChild(i).time;
     Assert.equal(visitTime, DB_NOW - 100000 - (i * 1000));
   }
   root.containerOpen = false;
 
   info("asyncHistory.isURIVisited should return true.");
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
   await PlacesTestUtils.promiseAsyncUpdates();
 
   info("Frecency should be positive.");
   Assert.ok(frecencyForUrl(TEST_URI) > 0);
 
   await cleanup();
 });
 
@@ -136,17 +136,17 @@ add_task(async function remove_visits_un
   Assert.equal(root.childCount, 5);
   for (let i = 0; i < root.childCount; i++) {
     let visitTime = root.getChild(i).time;
     Assert.equal(visitTime, DB_NOW - (i * 1000) - 5000);
   }
   root.containerOpen = false;
 
   info("asyncHistory.isURIVisited should return true.");
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
   await PlacesTestUtils.promiseAsyncUpdates();
 
   info("Frecency should be positive.");
   Assert.ok(frecencyForUrl(TEST_URI) > 0);
 
   await cleanup();
 });
 
@@ -187,17 +187,17 @@ add_task(async function remove_visits_bo
   Assert.equal(root.childCount, 5);
   for (let i = 0; i < root.childCount; i++) {
     let visitTime = root.getChild(i).time;
     Assert.equal(visitTime, DB_NOW - (i * 1000) - 5000);
   }
   root.containerOpen = false;
 
   info("asyncHistory.isURIVisited should return true.");
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
   await PlacesTestUtils.promiseAsyncUpdates();
 
   info("Frecency should be positive.");
   Assert.ok(frecencyForUrl(TEST_URI) > 0);
 
   await cleanup();
 });
 
@@ -228,17 +228,17 @@ add_task(async function remove_all_visit
   opts.resultType = opts.RESULTS_AS_VISIT;
   opts.sortingMode = opts.SORT_BY_DATE_DESCENDING;
   let root = PlacesUtils.history.executeQuery(query, opts).root;
   root.containerOpen = true;
   Assert.equal(root.childCount, 0);
   root.containerOpen = false;
 
   info("asyncHistory.isURIVisited should return false.");
-  Assert.equal(false, await promiseIsURIVisited(TEST_URI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
 
   await cleanup();
 });
 
 add_task(async function remove_all_visits_bookmarked_uri() {
   info("*** TEST: Remove all visits from a bookmarked URI");
 
   info("Add some visits for the URI.");
@@ -272,17 +272,17 @@ add_task(async function remove_all_visit
   opts.resultType = opts.RESULTS_AS_VISIT;
   opts.sortingMode = opts.SORT_BY_DATE_DESCENDING;
   let root = PlacesUtils.history.executeQuery(query, opts).root;
   root.containerOpen = true;
   Assert.equal(root.childCount, 0);
   root.containerOpen = false;
 
   info("asyncHistory.isURIVisited should return false.");
-  Assert.equal(false, await promiseIsURIVisited(TEST_URI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
 
   info("URI should be bookmarked");
   Assert.ok(await PlacesUtils.bookmarks.fetch({url: TEST_URI}));
   await PlacesTestUtils.promiseAsyncUpdates();
 
   info("Frecency should be smaller.");
   Assert.ok(frecencyForUrl(TEST_URI) < initialFrecency);
 
--- a/toolkit/components/places/tests/unit/test_425563.js
+++ b/toolkit/components/places/tests/unit/test_425563.js
@@ -35,20 +35,20 @@ add_task(async function test_execute() {
     { uri: uri("http://www.test-download.com/"),
       transition: TRANSITION_DOWNLOAD },
     { uri: uri("http://www.test-reload.com/"),
       transition: TRANSITION_RELOAD },
   ]);
 
   // check that all links are marked as visited
   for (let visited_uri of count_visited_URIs) {
-    Assert.ok(await promiseIsURIVisited(uri(visited_uri)));
+    Assert.ok(await PlacesUtils.history.hasVisits(uri(visited_uri)));
   }
   for (let visited_uri of notcount_visited_URIs) {
-    Assert.ok(await promiseIsURIVisited(uri(visited_uri)));
+    Assert.ok(await PlacesUtils.history.hasVisits(uri(visited_uri)));
   }
 
   // check that visit_count does not take in count embed and downloads
   // maxVisits query are directly binded to visit_count
   let options = PlacesUtils.history.getNewQueryOptions();
   options.sortingMode = options.SORT_BY_VISITCOUNT_DESCENDING;
   options.resultType = options.RESULTS_AS_VISIT;
   options.includeHidden = true;
--- a/toolkit/components/places/tests/unit/test_isvisited.js
+++ b/toolkit/components/places/tests/unit/test_isvisited.js
@@ -6,33 +6,33 @@
 
 add_task(async function test_execute() {
   var referrer = uri("about:blank");
 
   // add a http:// uri
   var uri1 = uri("http://mozilla.com");
   await PlacesTestUtils.addVisits({uri: uri1, referrer});
   do_check_guid_for_uri(uri1);
-  Assert.ok(await promiseIsURIVisited(uri1));
+  Assert.ok(await PlacesUtils.history.hasVisits(uri1));
 
   // add a https:// uri
   var uri2 = uri("https://etrade.com");
   await PlacesTestUtils.addVisits({uri: uri2, referrer});
   do_check_guid_for_uri(uri2);
-  Assert.ok(await promiseIsURIVisited(uri2));
+  Assert.ok(await PlacesUtils.history.hasVisits(uri2));
 
   // add a ftp:// uri
   var uri3 = uri("ftp://ftp.mozilla.org");
   await PlacesTestUtils.addVisits({uri: uri3, referrer});
   do_check_guid_for_uri(uri3);
-  Assert.ok(await promiseIsURIVisited(uri3));
+  Assert.ok(await PlacesUtils.history.hasVisits(uri3));
 
   // check if a nonexistent uri is visited
   var uri4 = uri("http://foobarcheese.com");
-  Assert.equal(false, await promiseIsURIVisited(uri4));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(uri4));
 
   // check that certain schemes never show up as visited
   // even if we attempt to add them to history
   // see CanAddURI() in nsNavHistory.cpp
   const URLS = [
     "about:config",
     "imap://cyrus.andrew.cmu.edu/archive.imap",
     "news://new.mozilla.org/mozilla.dev.apps.firefox",
@@ -56,12 +56,12 @@ add_task(async function test_execute() {
       info("Could not construct URI for '" + currentURL + "'; ignoring");
     }
     if (cantAddUri) {
       PlacesTestUtils.addVisits({uri: cantAddUri, referrer}).then(() => {
         do_throw("Should not have added history for invalid URI.");
       }, error => {
         Assert.ok(error.message.includes("No items were added to history"));
       });
-      Assert.equal(false, await promiseIsURIVisited(cantAddUri));
+      Assert.equal(false, await PlacesUtils.history.hasVisits(cantAddUri));
     }
   }
 });
--- a/toolkit/components/places/tests/unit/test_preventive_maintenance.js
+++ b/toolkit/components/places/tests/unit/test_preventive_maintenance.js
@@ -1662,19 +1662,19 @@ tests.push({
                                  Services.scriptSecurityManager.getSystemPrincipal());
     await PlacesUtils.keywords.insert({ url: this._uri1.spec, keyword: "testkeyword" });
     as.setPageAnnotation(this._uri2, "anno", "anno", 0, as.EXPIRE_NEVER);
     as.setItemAnnotation(this._bookmarkId, "anno", "anno", 0, as.EXPIRE_NEVER);
   },
 
   async check() {
     // Check that all items are correct
-    let isVisited = await promiseIsURIVisited(this._uri1);
+    let isVisited = await PlacesUtils.history.hasVisits(this._uri1);
     Assert.ok(isVisited);
-    isVisited = await promiseIsURIVisited(this._uri2);
+    isVisited = await PlacesUtils.history.hasVisits(this._uri2);
     Assert.ok(isVisited);
 
     Assert.equal((await bs.fetch(this._bookmark.guid)).url, this._uri1.spec);
     let folder = await bs.fetch(this._folder.guid);
     Assert.equal(folder.index, 0);
     Assert.equal(folder.type, bs.TYPE_FOLDER);
     Assert.equal((await bs.fetch(this._separator.guid)).type, bs.TYPE_SEPARATOR);
 
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -31,35 +31,16 @@ const LOGIN_PASSWORD_FIELD = "password_f
 const PERMISSION_TYPE = "test-perm";
 const PERMISSION_VALUE = Ci.nsIPermissionManager.ALLOW_ACTION;
 
 const PREFERENCE_NAME = "test-pref";
 
 // Utility Functions
 
 /**
- * Asynchronously check a url is visited.
- *
- * @param aURI
- *        The URI.
- *
- * @return {Promise}
- * @resolves When the check has been added successfully.
- * @rejects JavaScript exception.
- */
-function promiseIsURIVisited(aURI) {
-  return new Promise(resolve => {
-    PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
-      resolve(aIsVisited);
-    });
-
-  });
-}
-
-/**
  * Add a cookie to the cookie service.
  *
  * @param aDomain
  */
 function add_cookie(aDomain) {
   check_cookie_exists(aDomain, false);
   Services.cookies.add(aDomain, COOKIE_PATH, COOKIE_NAME, "", false, false, false,
                        COOKIE_EXPIRY, {});
@@ -201,39 +182,39 @@ function preference_exists(aURI) {
   });
 }
 
 // Test Functions
 
 // History
 async function test_history_cleared_with_direct_match() {
   const TEST_URI = Services.io.newURI("http://mozilla.org/foo");
-  Assert.equal(false, await promiseIsURIVisited(TEST_URI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
   await PlacesTestUtils.addVisits(TEST_URI);
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
   await ForgetAboutSite.removeDataFromDomain("mozilla.org");
-  Assert.equal(false, await promiseIsURIVisited(TEST_URI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
 }
 
 async function test_history_cleared_with_subdomain() {
   const TEST_URI = Services.io.newURI("http://www.mozilla.org/foo");
-  Assert.equal(false, await promiseIsURIVisited(TEST_URI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
   await PlacesTestUtils.addVisits(TEST_URI);
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
   await ForgetAboutSite.removeDataFromDomain("mozilla.org");
-  Assert.equal(false, await promiseIsURIVisited(TEST_URI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
 }
 
 async function test_history_not_cleared_with_uri_contains_domain() {
   const TEST_URI = Services.io.newURI("http://ilovemozilla.org/foo");
-  Assert.equal(false, await promiseIsURIVisited(TEST_URI));
+  Assert.equal(false, await PlacesUtils.history.hasVisits(TEST_URI));
   await PlacesTestUtils.addVisits(TEST_URI);
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
   await ForgetAboutSite.removeDataFromDomain("mozilla.org");
-  Assert.ok(await promiseIsURIVisited(TEST_URI));
+  Assert.ok(await PlacesUtils.history.hasVisits(TEST_URI));
 
   // Clear history since we left something there from this test.
   await PlacesTestUtils.clearHistory();
 }
 
 // Cookie Service
 async function test_cookie_cleared_with_direct_match() {
   const TEST_DOMAIN = "mozilla.org";