Bug 1306276 - Deprecate History RemovePage and RemovePages. r= draft
authorMarco Bonardo <mbonardo@mozilla.com> <mbonardo@mozilla.com>
Wed, 22 Mar 2017 12:44:54 +0100
changeset 502815 bab54476c7a97f47d685eab0b1ac6b8911c74808
parent 502661 201231223cd4354a450c3e5d80959f35b8e4cf0c
child 550277 1cbf3abc7af362fd27b28b2b701e7b4a0109b5bb
push id50415
push userbmo:mak77@bonardo.net
push dateWed, 22 Mar 2017 11:56:41 +0000
bugs1306276
milestone55.0a1
Bug 1306276 - Deprecate History RemovePage and RemovePages. r= MozReview-Commit-ID: 3NSaXKy1hP3
browser/components/places/content/controller.js
toolkit/components/places/nsIBrowserHistory.idl
toolkit/components/places/nsNavHistory.cpp
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -883,17 +883,17 @@ PlacesController.prototype = {
             transactions.push(txn);
           }
         }
       } else if (PlacesUtils.nodeIsURI(node) &&
                PlacesUtils.nodeIsQuery(node.parent) &&
                PlacesUtils.asQuery(node.parent).queryOptions.queryType ==
                  Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
         // This is a uri node inside an history query.
-        PlacesUtils.history.removePage(node.uri).catch(Components.utils.reportError);
+        PlacesUtils.history.remove(node.uri).catch(Components.utils.reportError);
         // History deletes are not undoable, so we don't have a transaction.
       } else if (node.itemId == -1 &&
                PlacesUtils.nodeIsQuery(node) &&
                PlacesUtils.asQuery(node).queryOptions.queryType ==
                  Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
         // This is a dynamically generated history query, like queries
         // grouped by site, time or both.  Dynamically generated queries don't
         // have an itemId even if they are descendants of a bookmark.
--- a/toolkit/components/places/nsIBrowserHistory.idl
+++ b/toolkit/components/places/nsIBrowserHistory.idl
@@ -14,28 +14,30 @@
 interface nsIBrowserHistory : nsISupports
 {
     /**
      * Removes a page from global history.
      *
      * @note It is preferrable to use this one rather then RemovePages when
      *       removing less than 10 pages, since it won't start a full batch
      *       operation.
+     * @deprecated Use PlacesUtils.history.remove() API instead.
      */
     void removePage(in nsIURI aURI);
 
     /**
      * Removes a list of pages from global history.
      *
      * @param aURIs
      *        Array of URIs to be removed.
      * @param aLength
      *        Length of the array.
      *
      * @note the removal happens in a batch.
+     * @deprecated Use PlacesUtils.history.remove() API instead.
      */
     void removePages([array, size_is(aLength)] in nsIURI aURIs,
                      in unsigned long aLength);
 
     /**
      * Removes all global history information about pages for a given host.
      *
      * @param aHost
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -2527,16 +2527,17 @@ nsNavHistory::CleanupPlacesOnVisitsDelet
 //
 //    Removes a bunch of uris from history.
 //    Has better performance than RemovePage when deleting a lot of history.
 //    We don't do duplicates removal, URIs array should be cleaned-up before.
 
 NS_IMETHODIMP
 nsNavHistory::RemovePages(nsIURI **aURIs, uint32_t aLength)
 {
+  PLACES_WARN_DEPRECATED();
   NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
   NS_ENSURE_ARG(aURIs);
 
   nsresult rv;
   // build a list of place ids to delete
   nsCString deletePlaceIdsQueryString;
   for (uint32_t i = 0; i < aLength; i++) {
     int64_t placeId;
@@ -2567,16 +2568,17 @@ nsNavHistory::RemovePages(nsIURI **aURIs
 // nsNavHistory::RemovePage
 //
 //    Removes all visits and the main history entry for the given URI.
 //    Silently fails if we have no knowledge of the page.
 
 NS_IMETHODIMP
 nsNavHistory::RemovePage(nsIURI *aURI)
 {
+  PLACES_WARN_DEPRECATED();
   NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
   NS_ENSURE_ARG(aURI);
 
   // Build a list of place ids to delete.
   int64_t placeId;
   nsAutoCString guid;
   nsresult rv = GetIdForPage(aURI, &placeId, guid);
   NS_ENSURE_SUCCESS(rv, rv);