Bug 1239708: Improve awesomebar autofill. Part 2: Non-core follow-ons. r=mak
authorDrew Willcoxon <adw@mozilla.com>
Mon, 14 May 2018 11:25:33 -0700
changeset 418240 37ed5dc61be40ff0eacf74fe5ef3c80c326001e7
parent 418239 918f531e11ce16c1d1f365cef9412e9ca4adaf9a
child 418241 8b944decbb138ec1342f90f8ae1c92304b4f3832
push id63965
push userdwillcoxon@mozilla.com
push dateMon, 14 May 2018 22:02:56 +0000
treeherderautoland@6f0272415280 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1239708
milestone62.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 1239708: Improve awesomebar autofill. Part 2: Non-core follow-ons. r=mak MozReview-Commit-ID: IFm1arAhjF5
toolkit/components/places/Bookmarks.jsm
toolkit/components/places/History.cpp
toolkit/components/places/History.jsm
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/SyncedBookmarksMirror.jsm
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsPlacesExpiration.js
toolkit/components/places/tests/favicons/test_root_icons.js
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -2437,17 +2437,17 @@ async function maybeInsertPlace(db, url)
   await db.executeCached(
     `INSERT OR IGNORE INTO moz_places (url, url_hash, rev_host, hidden, frecency, guid)
      VALUES (:url, hash(:url), :rev_host, 0, :frecency,
              IFNULL((SELECT guid FROM moz_places WHERE url_hash = hash(:url) AND url = :url),
                     GENERATE_GUID()))
     `, { url: url.href,
          rev_host: PlacesUtils.getReversedHost(url),
          frecency: url.protocol == "place:" ? 0 : -1 });
-  await db.executeCached("DELETE FROM moz_updatehostsinsert_temp");
+  await db.executeCached("DELETE FROM moz_updateoriginsinsert_temp");
 }
 
 /**
  * Tries to insert a new place if it doesn't exist yet.
  * @param db
  *        The database to use
  * @param urls
  *        An array with all the url objects to insert.
@@ -2459,17 +2459,17 @@ async function maybeInsertManyPlaces(db,
      (:url, hash(:url), :rev_host, 0, :frecency,
      IFNULL((SELECT guid FROM moz_places WHERE url_hash = hash(:url) AND url = :url), :maybeguid))`,
      urls.map(url => ({
        url: url.href,
        rev_host: PlacesUtils.getReversedHost(url),
        frecency: url.protocol == "place:" ? 0 : -1,
        maybeguid: PlacesUtils.history.makeGuid(),
      })));
-  await db.executeCached("DELETE FROM moz_updatehostsinsert_temp");
+  await db.executeCached("DELETE FROM moz_updateoriginsinsert_temp");
 }
 
 // Indicates whether we should write a tombstone for an item that has been
 // uploaded to the server. We ignore "NEW" and "UNKNOWN" items: "NEW" items
 // haven't been uploaded yet, and "UNKNOWN" items need a full reconciliation
 // with the server.
 function needsTombstone(item) {
   return item._syncStatus == Bookmarks.SYNC_STATUS.NORMAL;
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -1265,17 +1265,17 @@ public:
 
       // If we get here, we must have been successful adding/updating this
       // visit/place, so update the count:
       mSuccessfulUpdatedCount++;
     }
 
     {
       // Trigger an update for all the hosts of the places we inserted
-      nsAutoCString query("DELETE FROM moz_updatehostsinsert_temp");
+      nsAutoCString query("DELETE FROM moz_updateoriginsinsert_temp");
       nsCOMPtr<mozIStorageStatement> stmt = mHistory->GetStatement(query);
       NS_ENSURE_STATE(stmt);
       mozStorageStatementScoper scoper(stmt);
       nsresult rv = stmt->Execute();
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     nsresult rv = transaction.Commit();
@@ -2060,17 +2060,17 @@ private:
       mozStorageStatementScoper scoper(stmt);
       nsresult rv = stmt->Execute();
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     {
       // Hosts accumulated during the places delete are updated through a trigger
       // (see nsPlacesTriggers.h).
-      nsAutoCString query("DELETE FROM moz_updatehostsdelete_temp");
+      nsAutoCString query("DELETE FROM moz_updateoriginsdelete_temp");
       nsCOMPtr<mozIStorageStatement> stmt = mHistory->GetStatement(query);
       NS_ENSURE_STATE(stmt);
       mozStorageStatementScoper scoper(stmt);
       nsresult rv = stmt->Execute();
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     return NS_OK;
--- a/toolkit/components/places/History.jsm
+++ b/toolkit/components/places/History.jsm
@@ -768,17 +768,17 @@ var invalidateFrecencies = async functio
 };
 
 // Inner implementation of History.clear().
 var clear = async function(db) {
   await db.executeTransaction(async function() {
     // Remove all non-bookmarked places entries first, this will speed up the
     // triggers work.
     await db.execute(`DELETE FROM moz_places WHERE foreign_count = 0`);
-    await db.execute(`DELETE FROM moz_updatehostsdelete_temp`);
+    await db.execute(`DELETE FROM moz_updateoriginsdelete_temp`);
 
     // Expire orphan icons.
     await db.executeCached(`DELETE FROM moz_pages_w_icons
                             WHERE page_url_hash NOT IN (SELECT url_hash FROM moz_places)`);
     await db.executeCached(`DELETE FROM moz_icons WHERE id IN (
                               SELECT id FROM moz_icons WHERE root = 0
                               EXCEPT
                               SELECT icon_id FROM moz_icons_to_pages
@@ -857,17 +857,17 @@ var cleanupPages = async function(db, pa
   let idsList = sqlList(pagesToRemove.map(p => p.id));
   // Note, we are already in a transaction, since callers create it.
   // Check relations regardless, to avoid creating orphans in case of
   // async race conditions.
   await db.execute(`DELETE FROM moz_places WHERE id IN ( ${ idsList } )
                     AND foreign_count = 0 AND last_visit_date ISNULL`);
   // Hosts accumulated during the places delete are updated through a trigger
   // (see nsPlacesTriggers.h).
-  await db.executeCached(`DELETE FROM moz_updatehostsdelete_temp`);
+  await db.executeCached(`DELETE FROM moz_updateoriginsdelete_temp`);
 
   // Expire orphans.
   let hashesToRemove = pagesToRemove.map(p => p.hash);
   await db.executeCached(`DELETE FROM moz_pages_w_icons
                           WHERE page_url_hash IN (${sqlList(hashesToRemove)})`);
   await db.executeCached(`DELETE FROM moz_icons WHERE id IN (
                             SELECT id FROM moz_icons WHERE root = 0
                             EXCEPT
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -2236,17 +2236,17 @@ PlacesUtils.keywords = {
           await db.executeTransaction(async () => {
             await db.executeCached(
               `INSERT OR IGNORE INTO moz_places (url, url_hash, rev_host, hidden, frecency, guid)
                VALUES (:url, hash(:url), :rev_host, 0, :frecency,
                        IFNULL((SELECT guid FROM moz_places WHERE url_hash = hash(:url) AND url = :url),
                               GENERATE_GUID()))
               `, { url: url.href, rev_host: PlacesUtils.getReversedHost(url),
                    frecency: url.protocol == "place:" ? 0 : -1 });
-            await db.executeCached("DELETE FROM moz_updatehostsinsert_temp");
+            await db.executeCached("DELETE FROM moz_updateoriginsinsert_temp");
 
             // A new keyword could be assigned to an url that already has one,
             // then we must replace the old keyword with the new one.
             let oldKeywords = [];
             for (let entry of cache.values()) {
               if (entry.url.href == url.href && (entry.postData || "") == postData)
                 oldKeywords.push(entry.keyword);
             }
--- a/toolkit/components/places/SyncedBookmarksMirror.jsm
+++ b/toolkit/components/places/SyncedBookmarksMirror.jsm
@@ -1324,17 +1324,17 @@ class SyncedBookmarksMirror {
                      WHERE h.url_hash = u.hash AND
                            h.url = u.url), u.guid)
       FROM items v
       JOIN urls u ON u.id = v.urlId
       JOIN mergeStates r ON r.mergedGuid = v.guid
       WHERE r.valueState = :valueState`,
       { queryKind: SyncedBookmarksMirror.KIND.QUERY,
         valueState: BookmarkMergeState.TYPE.REMOTE });
-    await this.db.execute(`DELETE FROM moz_updatehostsinsert_temp`);
+    await this.db.execute(`DELETE FROM moz_updateoriginsinsert_temp`);
 
     MirrorLog.trace("Setting up deletions table");
     for (let chunk of PlacesSyncUtils.chunkArray(deletions,
       SQLITE_MAX_VARIABLE_NUMBER)) {
 
       // This fires the `noteItemRemoved` trigger, which records observer infos
       // for deletions. It's important we do this before updating the structure,
       // so that the trigger captures the old parent and position.
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -461,19 +461,19 @@ nsNavHistory::GetOrCreateIdForPage(nsIUR
 
     rv = stmt->Execute();
     NS_ENSURE_SUCCESS(rv, rv);
 
     *_pageId = sLastInsertedPlaceId;
   }
 
   {
-    // Trigger the updates to moz_hosts
+    // Trigger the updates to the moz_origins tables
     nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-      "DELETE FROM moz_updatehostsinsert_temp"
+      "DELETE FROM moz_updateoriginsinsert_temp"
     );
     NS_ENSURE_STATE(stmt);
     mozStorageStatementScoper scoper(stmt);
   }
 
   return NS_OK;
 }
 
--- a/toolkit/components/places/nsPlacesExpiration.js
+++ b/toolkit/components/places/nsPlacesExpiration.js
@@ -226,17 +226,17 @@ const EXPIRATION_QUERIES = {
           ) AND foreign_count = 0 AND last_visit_date ISNULL`,
     actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.SHUTDOWN_DIRTY |
              ACTION.IDLE_DIRTY | ACTION.IDLE_DAILY | ACTION.DEBUG
   },
 
   // Hosts accumulated during the places delete are updated through a trigger
   // (see nsPlacesTriggers.h).
   QUERY_UPDATE_HOSTS: {
-    sql: `DELETE FROM moz_updatehostsdelete_temp`,
+    sql: `DELETE FROM moz_updateoriginsdelete_temp`,
     actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.SHUTDOWN_DIRTY |
              ACTION.IDLE_DIRTY | ACTION.IDLE_DAILY | ACTION.DEBUG
   },
 
   // Expire orphan pages from the icons database.
   QUERY_EXPIRE_FAVICONS_PAGES: {
     sql: `DELETE FROM moz_pages_w_icons
           WHERE page_url_hash NOT IN (
--- a/toolkit/components/places/tests/favicons/test_root_icons.js
+++ b/toolkit/components/places/tests/favicons/test_root_icons.js
@@ -85,17 +85,16 @@ add_task(async function test_removePages
     beginDate: new Date(0),
     endDt: new Date()
   });
   await PlacesTestUtils.promiseAsyncUpdates();
   rows = await db.execute("SELECT * FROM moz_icons");
   // Debug logging for possible intermittent failure (bug 1358368).
   if (rows.length != 0) {
     dump_table("moz_icons");
-    dump_table("moz_hosts");
   }
   Assert.equal(rows.length, 0, "There should be no icon entry");
 });
 
 add_task(async function test_different_host() {
   let pageURI = NetUtil.newURI("http://places.test/page/");
   await PlacesTestUtils.addVisits(pageURI);
   let faviconURI = NetUtil.newURI("http://mozilla.test/favicon.ico");