Bug 885247 - Remove History::GetPageTitle synchronous API. r=standard8 draft
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 23 Jan 2018 10:44:38 +0100
changeset 723440 9aa070a1b381abe77004876619fa3a19589295a6
parent 723064 3d23e6d98a09a3395bf2b0d9cb03dd4be358c715
child 746859 88ad1e31e50dac2f202625bd8a013374aa7916e5
push id96429
push usermak77@bonardo.net
push dateTue, 23 Jan 2018 09:46:30 +0000
reviewersstandard8
bugs885247
milestone60.0a1
Bug 885247 - Remove History::GetPageTitle synchronous API. r=standard8 MozReview-Commit-ID: FleAOXBHyeK
toolkit/components/places/nsINavHistoryService.idl
toolkit/components/places/nsNavHistory.cpp
--- a/toolkit/components/places/nsINavHistoryService.idl
+++ b/toolkit/components/places/nsINavHistoryService.idl
@@ -1311,22 +1311,16 @@ interface nsINavHistoryService : nsISupp
    * True if there is any history. This can be used in UI to determine whether
    * the "clear history" button should be enabled or not. This is much better
    * than using BrowserHistory.count since that can be very slow if there is
    * a lot of history (it must enumerate each item). This is pretty fast.
    */
   readonly attribute boolean hasHistoryEntries;
 
   /**
-   * Gets the original title of the page.
-   * @deprecated use PlacesUtils.history.fetch instead.
-   */
-  AString getPageTitle(in nsIURI aURI);
-
-  /**
    * This is just like markPageAsTyped (in nsIBrowserHistory, also implemented
    * by the history service), but for bookmarks. It declares that the given URI
    * is being opened as a result of following a bookmark. If this URI is loaded
    * soon after this message has been received, that transition will be marked
    * as following a bookmark.
    */
   void markPageAsFollowedBookmark(in nsIURI aURI);
 
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -2750,53 +2750,16 @@ nsNavHistory::MarkPageAsFollowedLink(nsI
 
   if (mRecentLink.Count() > RECENT_EVENT_QUEUE_MAX_LENGTH)
     ExpireNonrecentEvents(&mRecentLink);
 
   return NS_OK;
 }
 
 
-NS_IMETHODIMP
-nsNavHistory::GetPageTitle(nsIURI* aURI, nsAString& aTitle)
-{
-  PLACES_WARN_DEPRECATED();
-
-  NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
-  NS_ENSURE_ARG(aURI);
-
-  aTitle.Truncate(0);
-
-  nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-    "SELECT id, url, title, rev_host, visit_count, guid "
-    "FROM moz_places "
-    "WHERE url_hash = hash(:page_url) AND url = :page_url "
-  );
-  NS_ENSURE_STATE(stmt);
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aURI);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasResults = false;
-  rv = stmt->ExecuteStep(&hasResults);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!hasResults) {
-    aTitle.SetIsVoid(true);
-    return NS_OK; // Not found, return a void string.
-  }
-
-  rv = stmt->GetString(2, aTitle);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-
 ////////////////////////////////////////////////////////////////////////////////
 //// mozIStorageVacuumParticipant
 
 NS_IMETHODIMP
 nsNavHistory::GetDatabaseConnection(mozIStorageConnection** _DBConnection)
 {
   return GetDBConnection(_DBConnection);
 }