Bug 854925 - Remove SetCharsetForURI and GetCharsetForURI from nsINavHistoryService. r=mak
authorAnup Kumar <allamsetty.anup@gmail.com>
Fri, 25 Jul 2014 13:37:00 +0200
changeset 196250 b70f46a09115e84657f389eda7db7d62c25021bb
parent 196249 8faa7f19c36d5e0f3628340aa1f0428c905f9ec4
child 196251 664fbd3821c72cf4ea92fa6f0014c823d5cbeddf
child 196316 70b3fc807a70c47833d1707762c63c8fe27edbf1
push id46830
push usercbook@mozilla.com
push dateMon, 28 Jul 2014 06:58:07 +0000
treeherdermozilla-inbound@b70f46a09115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs854925
milestone34.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 854925 - Remove SetCharsetForURI and GetCharsetForURI from nsINavHistoryService. r=mak
toolkit/components/places/nsINavHistoryService.idl
toolkit/components/places/nsNavHistory.cpp
--- a/toolkit/components/places/nsINavHistoryService.idl
+++ b/toolkit/components/places/nsINavHistoryService.idl
@@ -1183,17 +1183,17 @@ interface nsINavHistoryQueryOptions : ns
   attribute boolean asyncEnabled;
 
   /**
    * Creates a new options item with the same parameters of this one.
    */
   nsINavHistoryQueryOptions clone();
 };
 
-[scriptable, uuid(baebc597-9daf-4103-a325-e41ef9e7608a)]
+[scriptable, uuid(4b6963bf-763a-4f39-9fec-25670d354dd9)]
 interface nsINavHistoryService : nsISupports
 {
   /**
    * System Notifications:
    *
    * places-init-complete - Sent once the History service is completely
    *                        initialized successfully.
    * places-database-locked - Sent if initialization of the History service
@@ -1311,35 +1311,16 @@ interface nsINavHistoryService : nsISupp
    * the user (for example by clicking on it).
    *
    * @param aURI
    *        URI of the page to be marked.
    */
   void markPageAsFollowedLink(in nsIURI aURI);
 
   /**
-   * Gets the stored character-set for an URI.
-   *
-   * @param aURI
-   *        URI to retrieve character-set for
-   * @return character-set, empty string if not found
-   */
-  AString getCharsetForURI(in nsIURI aURI);
-
-  /**
-   * Sets the character-set for an URI.
-   *
-   * @param aURI
-   *        URI to set the character-set for
-   * @param aCharset
-   *        character-set to be set
-   */
-  void setCharsetForURI(in nsIURI aURI, in AString aCharset);
-
-  /**
    * Returns true if this URI would be added to the history. You don't have to
    * worry about calling this, adding a visit will always check before
    * actually adding the page. This function is public because some components
    * may want to check if this page would go in the history (i.e. for
    * annotations).
    */
   boolean canAddURI(in nsIURI aURI);
 
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -2849,81 +2849,16 @@ nsNavHistory::MarkPageAsFollowedLink(nsI
   if (mRecentLink.Count() > RECENT_EVENT_QUEUE_MAX_LENGTH)
     ExpireNonrecentEvents(&mRecentLink);
 
   mRecentLink.Put(uriString, GetNow());
   return NS_OK;
 }
 
 
-// nsNavHistory::SetCharsetForURI
-//
-// Sets the character-set for a URI.
-// If aCharset is empty remove character-set annotation for aURI.
-
-NS_IMETHODIMP
-nsNavHistory::SetCharsetForURI(nsIURI* aURI,
-                               const nsAString& aCharset)
-{
-  PLACES_WARN_DEPRECATED();
-
-  NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
-  NS_ENSURE_ARG(aURI);
-
-  nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
-  NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
-
-  if (aCharset.IsEmpty()) {
-    // remove the current page character-set annotation
-    nsresult rv = annosvc->RemovePageAnnotation(aURI, CHARSET_ANNO);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-  else {
-    // Set page character-set annotation, silently overwrite if already exists
-    nsresult rv = annosvc->SetPageAnnotationString(aURI, CHARSET_ANNO,
-                                                   aCharset, 0,
-                                                   nsAnnotationService::EXPIRE_NEVER);
-    if (rv == NS_ERROR_INVALID_ARG) {
-      // We don't have this page.  Silently fail.
-      return NS_OK;
-    }
-    else if (NS_FAILED(rv))
-      return rv;
-  }
-
-  return NS_OK;
-}
-
-
-// nsNavHistory::GetCharsetForURI
-//
-// Get the last saved character-set for a URI.
-
-NS_IMETHODIMP
-nsNavHistory::GetCharsetForURI(nsIURI* aURI, 
-                               nsAString& aCharset)
-{
-  PLACES_WARN_DEPRECATED();
-
-  NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
-  NS_ENSURE_ARG(aURI);
-
-  nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
-  NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
-
-  nsAutoString charset;
-  nsresult rv = annosvc->GetPageAnnotationString(aURI, CHARSET_ANNO, aCharset);
-  if (NS_FAILED(rv)) {
-    // be sure to return an empty string if character-set is not found
-    aCharset.Truncate();
-  }
-  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);