Bug 1140395 - Deprecate old keywords API. r=ttaubert
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 05 May 2015 15:40:09 +0200
changeset 273745 8ab920db907ccff27134f90f0aee36bd24692f06
parent 273744 5d06e3e4609a0cc3c84eadfc26f5a9e060ab919d
child 273746 273580797d9b12836a7709732677097fe8d6cb24
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttaubert
bugs1140395
milestone40.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 1140395 - Deprecate old keywords API. r=ttaubert
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/nsINavBookmarksService.idl
toolkit/components/places/nsNavBookmarks.cpp
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -875,16 +875,18 @@ this.PlacesUtils = {
            aItemId == PlacesUtils.tagsFolderId ||
            aItemId == PlacesUtils.placesRootId;
   },
 
   /**
    * Set the POST data associated with a bookmark, if any.
    * Used by POST keywords.
    *   @param aBookmarkId
+   *
+   * @deprecated Use PlacesUtils.keywords.insert() API instead.
    */
   setPostDataForBookmark(aBookmarkId, aPostData) {
     if (!aPostData)
       throw new Error("Must provide valid POST data");
     // For now we don't have a unified API to create a keyword with postData,
     // thus here we can just try to complete a keyword that should already exist
     // without any post data.
     let stmt = PlacesUtils.history.DBConnection.createStatement(
@@ -918,16 +920,18 @@ this.PlacesUtils = {
       }
     }).catch(Cu.reportError);
   },
 
   /**
    * Get the POST data associated with a bookmark, if any.
    * @param aBookmarkId
    * @returns string of POST data if set for aBookmarkId. null otherwise.
+   *
+   * @deprecated Use PlacesUtils.keywords.fetch() API instead.
    */
   getPostDataForBookmark(aBookmarkId) {
     let stmt = PlacesUtils.history.DBConnection.createStatement(
       `SELECT k.post_data
        FROM moz_keywords k
        JOIN moz_places h ON h.id = k.place_id
        JOIN moz_bookmarks b ON b.fk = h.id
        WHERE b.id = :item_id`);
--- a/toolkit/components/places/nsINavBookmarksService.idl
+++ b/toolkit/components/places/nsINavBookmarksService.idl
@@ -528,28 +528,34 @@ interface nsINavBookmarksService : nsISu
   void getBookmarkIdsForURI(in nsIURI aURI, [optional] out unsigned long count,
                             [array, retval, size_is(count)] out long long bookmarks);
 
   /**
    * Associates the given keyword with the given bookmark.
    *
    * Use an empty keyword to clear the keyword associated with the URI.
    * In both of these cases, succeeds but does nothing if the URL/keyword is not found.
+   *
+   * @deprecated Use PlacesUtils.keywords.insert() API instead.
    */
   void setKeywordForBookmark(in long long aItemId, in AString aKeyword);
 
   /**
    * Retrieves the keyword for the given bookmark. Will be void string
    * (null in JS) if no such keyword is found.
+   *
+   * @deprecated Use PlacesUtils.keywords.fetch() API instead.
    */
   AString getKeywordForBookmark(in long long aItemId);
 
   /**
    * Returns the URI associated with the given keyword. Empty if no such
    * keyword is found.
+   *
+   * @deprecated Use PlacesUtils.keywords.fetch() API instead.
    */
   nsIURI getURIForKeyword(in AString keyword);
 
   /**
    * Adds a bookmark observer. If ownsWeak is false, the bookmark service will
    * keep an owning reference to the observer.  If ownsWeak is true, then
    * aObserver must implement nsISupportsWeakReference, and the bookmark
    * service will keep a weak reference to the observer.
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -2440,16 +2440,18 @@ nsNavBookmarks::GetKeywordForBookmark(in
 NS_IMETHODIMP
 nsNavBookmarks::GetURIForKeyword(const nsAString& aUserCasedKeyword,
                                  nsIURI** aURI)
 {
   NS_ENSURE_ARG_POINTER(aURI);
   NS_ENSURE_TRUE(!aUserCasedKeyword.IsEmpty(), NS_ERROR_INVALID_ARG);
   *aURI = nullptr;
 
+  PLACES_WARN_DEPRECATED();
+
   // Shortcuts are always lowercased internally.
   nsAutoString keyword(aUserCasedKeyword);
   ToLowerCase(keyword);
 
   nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(NS_LITERAL_CSTRING(
     "SELECT h.url "
     "FROM moz_places h "
     "JOIN moz_keywords k ON k.place_id = h.id "