Bug 838839 - Remove deprecated synchronous favicons APIs.
authorMarco Bonardo <mbonardo@mozilla.com>
Wed, 20 Mar 2013 14:25:19 +0100
changeset 125600 c9c29cc97af070aea4264f04793dcc35b4491cbe
parent 125599 2e710a155c75897f02373349ade141c2bafebf90
child 125601 62bd02cebab436df15c8ba7cef6ce7722c7af0a0
push id25017
push usermak77@bonardo.net
push dateWed, 20 Mar 2013 13:25:47 +0000
treeherdermozilla-inbound@c9c29cc97af0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs838839
milestone22.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 838839 - Remove deprecated synchronous favicons APIs. r=Mano sr=gavin
toolkit/components/places/nsAnnotationService.h
toolkit/components/places/nsFaviconService.cpp
toolkit/components/places/nsFaviconService.h
toolkit/components/places/nsIFaviconService.idl
toolkit/components/places/nsNavBookmarks.h
toolkit/components/places/tests/favicons/test_favicons.js
toolkit/components/places/tests/favicons/xpcshell.ini
--- a/toolkit/components/places/nsAnnotationService.h
+++ b/toolkit/components/places/nsAnnotationService.h
@@ -57,20 +57,16 @@ public:
    */
   static nsAnnotationService* GetSingleton();
 
   /**
    * Initializes the service's object.  This should only be called once.
    */
   nsresult Init();
 
-  static nsAnnotationService* GetAnnotationServiceIfAvailable() {
-    return gAnnotationService;
-  }
-
   /**
    * Returns a cached pointer to the annotation service for consumers in the
    * places directory.
    */
   static nsAnnotationService* GetAnnotationService()
   {
     if (!gAnnotationService) {
       nsCOMPtr<nsIAnnotationService> serv =
--- a/toolkit/components/places/nsFaviconService.cpp
+++ b/toolkit/components/places/nsFaviconService.cpp
@@ -54,37 +54,33 @@ using namespace mozilla::places;
 
 /**
  * Used to notify a topic to system observers on async execute completion.
  * Will throw on error.
  */
 class ExpireFaviconsStatementCallbackNotifier : public AsyncStatementCallback
 {
 public:
-  ExpireFaviconsStatementCallbackNotifier(bool* aFaviconsExpirationRunning);
+  ExpireFaviconsStatementCallbackNotifier();
   NS_IMETHOD HandleCompletion(uint16_t aReason);
-
-private:
-  bool* mFaviconsExpirationRunning;
 };
 
 
 PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsFaviconService, gFaviconService)
 
 NS_IMPL_CLASSINFO(nsFaviconService, NULL, 0, NS_FAVICONSERVICE_CID)
 NS_IMPL_ISUPPORTS3_CI(
   nsFaviconService
 , nsIFaviconService
 , mozIAsyncFavicons
 , nsITimerCallback
 )
 
 nsFaviconService::nsFaviconService()
-  : mFaviconsExpirationRunning(false)
-  , mOptimizedIconDimension(OPTIMIZED_FAVICON_DIMENSION)
+  : mOptimizedIconDimension(OPTIMIZED_FAVICON_DIMENSION)
   , mFailedFaviconSerial(0)
 {
   NS_ASSERTION(!gFaviconService,
                "Attempting to create two instances of the service!");
   gFaviconService = this;
 }
 
 
@@ -114,17 +110,16 @@ nsFaviconService::Init()
   NS_ENSURE_STATE(mExpireUnassociatedIconsTimer);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFaviconService::ExpireAllFavicons()
 {
-  mFaviconsExpirationRunning = true;
   nsCOMPtr<mozIStorageAsyncStatement> unlinkIconsStmt = mDB->GetAsyncStatement(
     "UPDATE moz_places "
     "SET favicon_id = NULL "
     "WHERE favicon_id NOT NULL"
   );
   NS_ENSURE_STATE(unlinkIconsStmt);
   nsCOMPtr<mozIStorageAsyncStatement> removeIconsStmt = mDB->GetAsyncStatement(
     "DELETE FROM moz_favicons WHERE id NOT IN ("
@@ -134,17 +129,17 @@ nsFaviconService::ExpireAllFavicons()
   NS_ENSURE_STATE(removeIconsStmt);
 
   mozIStorageBaseStatement* stmts[] = {
     unlinkIconsStmt.get()
   , removeIconsStmt.get()
   };
   nsCOMPtr<mozIStoragePendingStatement> ps;
   nsRefPtr<ExpireFaviconsStatementCallbackNotifier> callback =
-    new ExpireFaviconsStatementCallbackNotifier(&mFaviconsExpirationRunning);
+    new ExpireFaviconsStatementCallbackNotifier();
   nsresult rv = mDB->MainConn()->ExecuteAsync(
     stmts, ArrayLength(stmts), callback, getter_AddRefs(ps)
   );
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
@@ -181,138 +176,16 @@ nsFaviconService::Notify(nsITimer* timer
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIFaviconService
 
 NS_IMETHODIMP
-nsFaviconService::SetFaviconUrlForPage(nsIURI* aPageURI, nsIURI* aFaviconURI)
-{
-  PLACES_WARN_DEPRECATED();
-  NS_ENSURE_ARG(aPageURI);
-  NS_ENSURE_ARG(aFaviconURI);
-
-  // If we are about to expire all favicons, don't bother setting a new one.
-  if (mFaviconsExpirationRunning) {
-    return NS_OK;
-  }
-
-  nsNavHistory* history = nsNavHistory::GetHistoryService();
-  NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
-
-  nsresult rv;
-  int64_t iconId = -1;
-  bool hasData = false;
-  {
-    nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-      "SELECT id, length(data), expiration FROM moz_favicons "
-      "WHERE url = :icon_url"
-    );
-    NS_ENSURE_STATE(stmt);
-    mozStorageStatementScoper scoper(stmt);
-
-    rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("icon_url"), aFaviconURI);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    bool hasResult = false;
-    if (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
-      // We already have an entry for this icon, just get its stats.
-      rv = stmt->GetInt64(0, &iconId);
-      NS_ENSURE_SUCCESS(rv, rv);
-      int32_t dataSize;
-      rv = stmt->GetInt32(1, &dataSize);
-      NS_ENSURE_SUCCESS(rv, rv);
-      if (dataSize > 0) {
-        hasData = true;
-      }
-    }
-  }
-
-  mozStorageTransaction transaction(mDB->MainConn(), false);
-
-  if (iconId == -1) {
-    // We did not find any entry for this icon, so create a new one.
-    nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-      "INSERT INTO moz_favicons (id, url, data, mime_type, expiration, guid) "
-      "VALUES (:icon_id, :icon_url, :data, :mime_type, :expiration, "
-              "COALESCE(:guid, GENERATE_GUID()))"
-    );
-    NS_ENSURE_STATE(stmt);
-    mozStorageStatementScoper scoper(stmt);
-
-    rv = stmt->BindNullByName(NS_LITERAL_CSTRING("guid"));
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = stmt->BindNullByName(NS_LITERAL_CSTRING("icon_id"));
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("icon_url"), aFaviconURI);
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = stmt->BindNullByName(NS_LITERAL_CSTRING("data"));
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = stmt->BindNullByName(NS_LITERAL_CSTRING("mime_type"));
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = stmt->BindNullByName(NS_LITERAL_CSTRING("expiration"));
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = stmt->Execute();
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    {
-      nsCOMPtr<mozIStorageStatement> getInfoStmt = mDB->GetStatement(
-        "SELECT id, length(data), expiration FROM moz_favicons "
-        "WHERE url = :icon_url"
-      );
-      NS_ENSURE_STATE(getInfoStmt);
-      mozStorageStatementScoper scoper(getInfoStmt);
-
-      rv = URIBinder::Bind(getInfoStmt, NS_LITERAL_CSTRING("icon_url"), aFaviconURI);
-      NS_ENSURE_SUCCESS(rv, rv);
-      bool hasResult;
-      rv = getInfoStmt->ExecuteStep(&hasResult);
-      NS_ENSURE_SUCCESS(rv, rv);
-      NS_ASSERTION(hasResult, "hasResult is false but the call succeeded?");
-      iconId = getInfoStmt->AsInt64(0);
-    }
-  }
-
-  // Now, link our icon entry with the page.
-  int64_t pageId;
-  nsAutoCString guid;
-  rv = history->GetIdForPage(aPageURI, &pageId, guid);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (!pageId) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-    "UPDATE moz_places SET favicon_id = :icon_id WHERE id = :page_id"
-  );
-  NS_ENSURE_STATE(stmt);
-  mozStorageStatementScoper scoper(stmt);
-
-  rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("page_id"), pageId);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("icon_id"), iconId);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = stmt->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = transaction.Commit();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // Send favicon change notifications only if the icon has any data.
-  if (hasData) {
-    SendFaviconNotifications(aPageURI, aFaviconURI, guid);
-  }
-
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
 nsFaviconService::GetDefaultFavicon(nsIURI** _retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
 
   // not found, use default
   if (!mDefaultIcon) {
     nsresult rv = NS_NewURI(getter_AddRefs(mDefaultIcon),
                             NS_LITERAL_CSTRING(FAVICON_DEFAULT_URL));
@@ -331,43 +204,26 @@ nsFaviconService::SendFaviconNotificatio
   if (history && NS_SUCCEEDED(aFaviconURI->GetSpec(faviconSpec))) {
     history->SendPageChangedNotification(aPageURI,
                                          nsINavHistoryObserver::ATTRIBUTE_FAVICON,
                                          NS_ConvertUTF8toUTF16(faviconSpec),
                                          aGUID);
   }
 }
 
-
-NS_IMETHODIMP
-nsFaviconService::SetAndLoadFaviconForPage(nsIURI* aPageURI,
-                                           nsIURI* aFaviconURI,
-                                           bool aForceReload,
-                                           uint32_t aFaviconLoadType,
-                                           nsIFaviconDataCallback* aCallback)
-{
-  PLACES_WARN_DEPRECATED();
-  return SetAndFetchFaviconForPage(aPageURI, aFaviconURI,
-                                   aForceReload, aFaviconLoadType,
-                                   aCallback);
-}
-
 NS_IMETHODIMP
 nsFaviconService::SetAndFetchFaviconForPage(nsIURI* aPageURI,
                                             nsIURI* aFaviconURI,
                                             bool aForceReload,
                                             uint32_t aFaviconLoadType,
                                             nsIFaviconDataCallback* aCallback)
 {
   NS_ENSURE_ARG(aPageURI);
   NS_ENSURE_ARG(aFaviconURI);
 
-  if (mFaviconsExpirationRunning)
-    return NS_OK;
-
   // If a favicon is in the failed cache, only load it during a forced reload.
   bool previouslyFailed;
   nsresult rv = IsFailedFavicon(aFaviconURI, &previouslyFailed);
   NS_ENSURE_SUCCESS(rv, rv);
   if (previouslyFailed) {
     if (aForceReload)
       RemoveFailedFavicon(aFaviconURI);
     else
@@ -396,19 +252,16 @@ nsFaviconService::ReplaceFaviconData(nsI
   NS_ENSURE_ARG(aFaviconURI);
   NS_ENSURE_ARG(aData);
   NS_ENSURE_TRUE(aDataLen > 0, NS_ERROR_INVALID_ARG);
   NS_ENSURE_TRUE(aMimeType.Length() > 0, NS_ERROR_INVALID_ARG);
   if (aExpiration == 0) {
     aExpiration = PR_Now() + MAX_FAVICON_EXPIRATION;
   }
 
-  if (mFaviconsExpirationRunning)
-    return NS_OK;
-
   UnassociatedIconHashKey* iconKey = mUnassociatedIcons.PutEntry(aFaviconURI);
   if (!iconKey) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   iconKey->created = PR_Now();
 
   // If the cache contains unassociated icons, an expiry timer should already exist, otherwise
@@ -449,143 +302,27 @@ nsFaviconService::ReplaceFaviconData(nsI
   // database immediately so that the associated pages are kept in sync.
   // Otherwise, do nothing and let the icon be picked up from the memory hash.
   rv = AsyncReplaceFaviconData::start(iconData);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
-// nsFaviconService::SetFaviconData
-//
-//    See the IDL for this function for lots of info. Note from there: we don't
-//    send out notifications.
-
-NS_IMETHODIMP
-nsFaviconService::SetFaviconData(nsIURI* aFaviconURI, const uint8_t* aData,
-                                 uint32_t aDataLen, const nsACString& aMimeType,
-                                 PRTime aExpiration)
-{
-  PLACES_WARN_DEPRECATED();
-  NS_ENSURE_ARG(aFaviconURI);
-
-  if (mFaviconsExpirationRunning)
-    return NS_OK;
-
-  nsresult rv;
-  uint32_t dataLen = aDataLen;
-  const uint8_t* data = aData;
-  const nsACString* mimeType = &aMimeType;
-  nsCString newData, newMimeType;
-
-  // If the page provided a large image for the favicon (eg, a highres image
-  // or a multiresolution .ico file), we don't want to store more data than
-  // needed.
-  if (aDataLen > MAX_ICON_FILESIZE(mOptimizedIconDimension)) {
-    rv = OptimizeFaviconImage(aData, aDataLen, aMimeType, newData, newMimeType);
-    if (NS_SUCCEEDED(rv) && newData.Length() < aDataLen) {
-      data = reinterpret_cast<uint8_t*>(const_cast<char*>(newData.get())),
-      dataLen = newData.Length();
-      mimeType = &newMimeType;
-    }
-    else if (aDataLen > MAX_FAVICON_SIZE) {
-      // We cannot optimize this favicon size and we are over the maximum size
-      // allowed, so we will not save data to the db to avoid bloating it.
-      return NS_ERROR_FAILURE;
-    }
-  }
-
-  nsCOMPtr<mozIStorageStatement> statement;
-  {
-    // this block forces the scoper to reset our statement: necessary for the
-    // next statement
-    nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-      "SELECT id, length(data), expiration FROM moz_favicons "
-      "WHERE url = :icon_url"
-    );
-    NS_ENSURE_STATE(stmt);
-    mozStorageStatementScoper scoper(stmt);
-
-    rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("icon_url"), aFaviconURI);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    bool hasResult;
-    rv = stmt->ExecuteStep(&hasResult);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (hasResult) {
-      // Get id of the old entry and update it.
-      int64_t id;
-      rv = stmt->GetInt64(0, &id);
-      NS_ENSURE_SUCCESS(rv, rv);
-      statement = mDB->GetStatement(
-        "UPDATE moz_favicons SET "
-               "guid       = COALESCE(:guid, guid), "
-               "data       = :data, "
-               "mime_type  = :mime_type, "
-               "expiration = :expiration "
-        "WHERE id = :icon_id"
-      );
-      NS_ENSURE_STATE(statement);
-
-      rv = statement->BindNullByName(NS_LITERAL_CSTRING("guid"));
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("icon_id"), id);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindBlobByName(NS_LITERAL_CSTRING("data"), data, dataLen);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindUTF8StringByName(NS_LITERAL_CSTRING("mime_type"), *mimeType);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("expiration"), aExpiration);
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-    else {
-      // Insert a new entry.
-      statement = mDB->GetStatement(
-       "INSERT INTO moz_favicons (id, url, data, mime_type, expiration, guid) "
-       "VALUES (:icon_id, :icon_url, :data, :mime_type, :expiration, "
-               "COALESCE(:guid, GENERATE_GUID()))");
-      NS_ENSURE_STATE(statement);
-
-      rv = statement->BindNullByName(NS_LITERAL_CSTRING("icon_id"));
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = URIBinder::Bind(statement, NS_LITERAL_CSTRING("icon_url"), aFaviconURI);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindBlobByName(NS_LITERAL_CSTRING("data"), data, dataLen);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindUTF8StringByName(NS_LITERAL_CSTRING("mime_type"), *mimeType);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("expiration"), aExpiration);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = statement->BindNullByName(NS_LITERAL_CSTRING("guid"));
-      NS_ENSURE_SUCCESS(rv, rv);
-    }
-  }
-  mozStorageStatementScoper statementScoper(statement);
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 nsFaviconService::ReplaceFaviconDataFromDataURL(nsIURI* aFaviconURI,
                                                const nsAString& aDataURL,
                                                PRTime aExpiration)
 {
   NS_ENSURE_ARG(aFaviconURI);
   NS_ENSURE_TRUE(aDataURL.Length() > 0, NS_ERROR_INVALID_ARG);
   if (aExpiration == 0) {
     aExpiration = PR_Now() + MAX_FAVICON_EXPIRATION;
   }
 
-  if (mFaviconsExpirationRunning)
-    return NS_OK;
-
   nsCOMPtr<nsIURI> dataURI;
   nsresult rv = NS_NewURI(getter_AddRefs(dataURI), aDataURL);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Use the data: protocol handler to convert the data.
   nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIProtocolHandler> protocolHandler;
@@ -631,227 +368,16 @@ nsFaviconService::ReplaceFaviconDataFrom
   rv = ReplaceFaviconData(aFaviconURI, buffer, available, mimeType, aExpiration);
   nsMemory::Free(buffer);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsFaviconService::SetFaviconDataFromDataURL(nsIURI* aFaviconURI,
-                                            const nsAString& aDataURL,
-                                            PRTime aExpiration)
-{
-  PLACES_WARN_DEPRECATED();
-  NS_ENSURE_ARG(aFaviconURI);
-  if (mFaviconsExpirationRunning)
-    return NS_OK;
-
-  nsCOMPtr<nsIURI> dataURI;
-  nsresult rv = NS_NewURI(getter_AddRefs(dataURI), aDataURL);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // use the data: protocol handler to convert the data
-  nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-  nsCOMPtr<nsIProtocolHandler> protocolHandler;
-  rv = ioService->GetProtocolHandler("data", getter_AddRefs(protocolHandler));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIChannel> channel;
-  rv = protocolHandler->NewChannel(dataURI, getter_AddRefs(channel));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // blocking stream is OK for data URIs
-  nsCOMPtr<nsIInputStream> stream;
-  rv = channel->Open(getter_AddRefs(stream));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  uint64_t available64;
-  rv = stream->Available(&available64);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (available64 == 0 || available64 > UINT32_MAX / sizeof(uint8_t))
-    return NS_ERROR_FAILURE;
-  uint32_t available = (uint32_t)available64;
-
-  // read all the decoded data
-  uint8_t* buffer = static_cast<uint8_t*>
-                               (nsMemory::Alloc(sizeof(uint8_t) * available));
-  if (!buffer)
-    return NS_ERROR_OUT_OF_MEMORY;
-  uint32_t numRead;
-  rv = stream->Read(reinterpret_cast<char*>(buffer), available, &numRead);
-  if (NS_FAILED(rv) || numRead != available) {
-    nsMemory::Free(buffer);
-    return rv;
-  }
-
-  nsAutoCString mimeType;
-  rv = channel->GetContentType(mimeType);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // SetFaviconData can now do the dirty work.
-  rv = SetFaviconData(aFaviconURI, buffer, available, mimeType, aExpiration);
-  nsMemory::Free(buffer);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsFaviconService::GetFaviconData(nsIURI* aFaviconURI, nsACString& aMimeType,
-                                 uint32_t* aDataLen, uint8_t** aData)
-{
-  PLACES_WARN_DEPRECATED();
-  NS_ENSURE_ARG(aFaviconURI);
-  NS_ENSURE_ARG_POINTER(aDataLen);
-  NS_ENSURE_ARG_POINTER(aData);
-
-  nsCOMPtr<nsIURI> defaultFaviconURI;
-  nsresult rv = GetDefaultFavicon(getter_AddRefs(defaultFaviconURI));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool isDefaultFavicon = false;
-  rv = defaultFaviconURI->Equals(aFaviconURI, &isDefaultFavicon);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // If we're getting the default favicon, we need to handle it separately since
-  // it's not in the database.
-  if (isDefaultFavicon) {
-    nsAutoCString defaultData;
-    rv = GetDefaultFaviconData(defaultData);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    uint8_t* bytes = reinterpret_cast<uint8_t*>(ToNewCString(defaultData));
-    NS_ENSURE_STATE(bytes);
-
-    *aData = bytes;
-    *aDataLen = defaultData.Length();
-    aMimeType.AssignLiteral(DEFAULT_MIME_TYPE);
-
-    return NS_OK;
-  }
-
-  nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-    "SELECT f.data, f.mime_type FROM moz_favicons f WHERE url = :icon_url"
-  );
-  NS_ENSURE_STATE(stmt);
-  mozStorageStatementScoper scoper(stmt);
-
-  rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("icon_url"), aFaviconURI);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasResult = false;
-  if (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
-    rv = stmt->GetUTF8String(1, aMimeType);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    return stmt->GetBlob(0, aDataLen, aData);
-  }
-  return NS_ERROR_NOT_AVAILABLE;
-}
-
-
-nsresult
-nsFaviconService::GetDefaultFaviconData(nsCString& byteStr)
-{
-  if (mDefaultFaviconData.IsEmpty()) {
-    nsCOMPtr<nsIURI> defaultFaviconURI;
-    nsresult rv = GetDefaultFavicon(getter_AddRefs(defaultFaviconURI));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIInputStream> istream;
-    rv = NS_OpenURI(getter_AddRefs(istream), defaultFaviconURI);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = NS_ConsumeStream(istream, UINT32_MAX, mDefaultFaviconData);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = istream->Close();
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    if (mDefaultFaviconData.IsEmpty())
-      return NS_ERROR_UNEXPECTED;
-  }
-
-  byteStr.Assign(mDefaultFaviconData);
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI,
-                                          nsAString& aDataURL)
-{
-  PLACES_WARN_DEPRECATED();
-  NS_ENSURE_ARG(aFaviconURI);
-
-  uint8_t* data;
-  uint32_t dataLen;
-  nsAutoCString mimeType;
-
-  nsresult rv = GetFaviconData(aFaviconURI, mimeType, &dataLen, &data);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!data) {
-    aDataURL.SetIsVoid(true);
-    return NS_OK;
-  }
-
-  char* encoded = PL_Base64Encode(reinterpret_cast<const char*>(data),
-                                  dataLen, nullptr);
-  nsMemory::Free(data);
-
-  if (!encoded)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  aDataURL.AssignLiteral("data:");
-  AppendUTF8toUTF16(mimeType, aDataURL);
-  aDataURL.AppendLiteral(";base64,");
-  AppendUTF8toUTF16(encoded, aDataURL);
-
-  nsMemory::Free(encoded);
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsFaviconService::GetFaviconForPage(nsIURI* aPageURI, nsIURI** _retval)
-{
-  PLACES_WARN_DEPRECATED();
-  NS_ENSURE_ARG(aPageURI);
-  NS_ENSURE_ARG_POINTER(_retval);
-
-  nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-    "SELECT f.id, f.url, length(f.data), f.expiration "
-    "FROM moz_places h "
-    "JOIN moz_favicons f ON h.favicon_id = f.id "
-    "WHERE h.url = :page_url "
-    "LIMIT 1"
-  );
-  NS_ENSURE_STATE(stmt);
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aPageURI);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasResult;
-  if (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
-    nsAutoCString url;
-    rv = stmt->GetUTF8String(1, url);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    return NS_NewURI(_retval, url);
-  }
-  return NS_ERROR_NOT_AVAILABLE;
-}
-
-
-NS_IMETHODIMP
 nsFaviconService::GetFaviconURLForPage(nsIURI *aPageURI,
                                        nsIFaviconDataCallback* aCallback)
 {
   NS_ENSURE_ARG(aPageURI);
   NS_ENSURE_ARG(aCallback);
 
   nsresult rv = AsyncGetFaviconURLForPage::start(aPageURI, aCallback);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -865,57 +391,16 @@ nsFaviconService::GetFaviconDataForPage(
   NS_ENSURE_ARG(aPageURI);
   NS_ENSURE_ARG(aCallback);
 
   nsresult rv = AsyncGetFaviconDataForPage::start(aPageURI, aCallback);
   NS_ENSURE_SUCCESS(rv, rv);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsFaviconService::GetFaviconImageForPage(nsIURI* aPageURI, nsIURI** _retval)
-{
-  PLACES_WARN_DEPRECATED();
-  NS_ENSURE_ARG(aPageURI);
-  NS_ENSURE_ARG_POINTER(_retval);
-
-  nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-    "SELECT f.id, f.url, length(f.data), f.expiration "
-    "FROM moz_places h "
-    "JOIN moz_favicons f ON h.favicon_id = f.id "
-    "WHERE h.url = :page_url "
-    "LIMIT 1"
-  );
-  NS_ENSURE_STATE(stmt);
-  mozStorageStatementScoper scoper(stmt);
-
-  nsresult rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), aPageURI);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasResult;
-  nsCOMPtr<nsIURI> faviconURI;
-  if (NS_SUCCEEDED(stmt->ExecuteStep(&hasResult)) && hasResult) {
-    int32_t dataLen;
-    rv = stmt->GetInt32(2, &dataLen);
-    NS_ENSURE_SUCCESS(rv, rv);
-    if (dataLen > 0) {
-      // this page has a favicon entry with data
-      nsAutoCString favIconUri;
-      rv = stmt->GetUTF8String(1, favIconUri);
-      NS_ENSURE_SUCCESS(rv, rv);
-
-      return GetFaviconLinkForIconString(favIconUri, _retval);
-    }
-  }
-
-  // not found, use default
-  return GetDefaultFavicon(_retval);
-}
-
-
 nsresult
 nsFaviconService::GetFaviconLinkForIcon(nsIURI* aFaviconURI,
                                         nsIURI** aOutputURI)
 {
   NS_ENSURE_ARG(aFaviconURI);
   NS_ENSURE_ARG_POINTER(aOutputURI);
 
   nsAutoCString spec;
@@ -1100,29 +585,24 @@ nsFaviconService::GetFaviconDataAsync(ns
 
   nsCOMPtr<mozIStoragePendingStatement> pendingStatement;
   return stmt->ExecuteAsync(aCallback, getter_AddRefs(pendingStatement));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// ExpireFaviconsStatementCallbackNotifier
 
-ExpireFaviconsStatementCallbackNotifier::ExpireFaviconsStatementCallbackNotifier(
-  bool* aFaviconsExpirationRunning)
-: mFaviconsExpirationRunning(aFaviconsExpirationRunning)
+ExpireFaviconsStatementCallbackNotifier::ExpireFaviconsStatementCallbackNotifier()
 {
-  NS_ASSERTION(mFaviconsExpirationRunning, "Pointer to bool mFaviconsExpirationRunning can't be null");
 }
 
 
 NS_IMETHODIMP
 ExpireFaviconsStatementCallbackNotifier::HandleCompletion(uint16_t aReason)
 {
-  *mFaviconsExpirationRunning = false;
-
   // We should dispatch only if expiration has been successful.
   if (aReason != mozIStorageStatementCallback::REASON_FINISHED)
     return NS_OK;
 
   nsCOMPtr<nsIObserverService> observerService =
     mozilla::services::GetObserverService();
   if (observerService) {
     (void)observerService->NotifyObservers(nullptr,
--- a/toolkit/components/places/nsFaviconService.h
+++ b/toolkit/components/places/nsFaviconService.h
@@ -63,20 +63,16 @@ public:
    */
   static nsFaviconService* GetSingleton();
 
   /**
    * Initializes the service's object.  This should only be called once.
    */
   nsresult Init();
 
-  static nsFaviconService* GetFaviconServiceIfAvailable() {
-    return gFaviconService;
-  }
-
   /**
    * Returns a cached pointer to the favicon service for consumers in the
    * places directory.
    */
   static nsFaviconService* GetFaviconService()
   {
     if (!gFaviconService) {
       nsCOMPtr<nsIFaviconService> serv =
@@ -139,38 +135,26 @@ private:
   /**
    * A cached URI for the default icon. We return this a lot, and don't want to
    * re-parse and normalize our unchanging string many times.  Important: do
    * not return this directly; use Clone() since callers may change the object
    * they get back. May be null, in which case it needs initialization.
    */
   nsCOMPtr<nsIURI> mDefaultIcon;
 
-  // Set to true during favicons expiration, addition of new favicons won't be
-  // allowed till expiration has finished since those should then be expired.
-  bool mFaviconsExpirationRunning;
-
   // The target dimension, in pixels, for favicons we optimize.
   // If we find images that are as large or larger than an uncompressed RGBA
   // image of this size (mOptimizedIconDimension*mOptimizedIconDimension*4),
   // we will try to optimize it.
   int32_t mOptimizedIconDimension;
 
   uint32_t mFailedFaviconSerial;
   nsDataHashtable<nsCStringHashKey, uint32_t> mFailedFavicons;
 
   // AsyncFetchAndSetIconForPage needs access to the icon cache
   friend class mozilla::places::AsyncFetchAndSetIconForPage;
   friend class mozilla::places::RemoveIconDataCacheEntry;
   nsTHashtable<UnassociatedIconHashKey> mUnassociatedIcons;
-
-  // Caches the content of the default favicon if it's not already cached and
-  // copies it into byteStr.
-  nsresult GetDefaultFaviconData(nsCString& byteStr);
-
-  // A string of bytes caching the default favicon's content.  Empty if not yet
-  // cached.  Rather than accessing this directly, use GetDefaultFaviconData.
-  nsCString mDefaultFaviconData;
 };
 
 #define FAVICON_ANNOTATION_NAME "favicon"
 
 #endif // nsFaviconService_h_
--- a/toolkit/components/places/nsIFaviconService.idl
+++ b/toolkit/components/places/nsIFaviconService.idl
@@ -1,250 +1,26 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 interface nsIURI;
-interface nsIFaviconDataCallback;
 
-[scriptable, uuid(8062a652-e0ea-4a50-b204-a0dde133de0e)]
+[scriptable, uuid(e81e0b0c-b9f1-4c2e-8f3c-b809933cf73c)]
 interface nsIFaviconService : nsISupports
 {
-  /**
-   * Declares that a given page uses a favicon with the given URI.
-   *
-   * Will create an entry linking the favicon URI to the page, regardless
-   * of whether we have data for that icon.  You can populate it later with
-   * SetFaviconData.  However, remember that favicons must only be associated
-   * with a visited web page, a bookmark, or a "place:" URI.  Trying to
-   * associate the icon to any other page will throw.
-   *
-   * This will send out history pageChanged notification if the new favicon has
-   * any data and it's different from the old associated favicon.  This means
-   * that you should try to set data before calling this method if you have it,
-   * otherwise it won't fire any notifications.
-   *
-   * @param aPageURI
-   *        URI of the page whose favicon is being set.
-   * @param aFaviconURI
-   *        URI of the favicon to associate with the page.
-   * @throws NS_ERROR_NOT_AVAILABLE if aPageURI doesn't exist in the database.
-   *
-   * @deprecated Use mozIAsyncFavicons::setAndFetchFaviconForPage
-   */
-  void setFaviconUrlForPage(in nsIURI aPageURI,
-                            in nsIURI aFaviconURI);
-
   // The favicon is being loaded from a private browsing window
   const unsigned long FAVICON_LOAD_PRIVATE = 1;
   // The favicon is being loaded from a non-private browsing window
   const unsigned long FAVICON_LOAD_NON_PRIVATE = 2;
 
   /**
-   * Same as SetFaviconUrlForPage except that this also attempts to fetch and
-   * save the icon data by loading the favicon URI through an async network
-   * request.
-   *
-   * If the icon data already exists, we won't normally try to re-load the
-   * icon.  If the icon is in the failed favicon cache we won't do anything.
-   * Use forceReload to force a reload of the data.  This will also eventually
-   * remove the favicon from the failed cache, if the reload succeeds.
-   *
-   * This function will only save favicons for "good" URIs, as defined by what
-   * gets added to history or is a bookmark.  For "bad" URIs, this function
-   * will succeed but do nothing.  This function will also ignore the error page
-   * favicon URI (see FAVICON_ERRORPAGE_URL below).
-   * Icons that fail to load will automatically be added to the failed favicon
-   * cache.
-   *
-   * This function will not save favicons for non-bookmarked URIs when
-   * history is disabled.  The rest of the functions
-   * here will always store favicons even when history is disabled.
-   *
-   * @param aPageURI
-   *        URI of the page whose favicon is being set.
-   * @param aFaviconURI
-   *        URI of the favicon to associate with the page.
-   * @param aForceReload
-   *        Unset is normal behavior, we will only try to reload the favicon
-   *        if we don't have it or if it has expired from the cache.  If set,
-   *        it will always try to reload the favicon.
-   * @param aFaviconLoadType
-   *        Set to FAVICON_LOAD_PRIVATE if the favicon is loaded from a private
-   *        browsing window.  Set to FAVICON_LOAD_NON_PRIVATE otherwise.
-   * @param aCallback
-   *        Once we're done setting and/or loading the favicon, we invoke this
-   *        callback.
-   *
-   * @deprecated Use mozIAsyncFavicons::setAndFetchFaviconForPage
-   */
-  [deprecated]
-  void setAndLoadFaviconForPage(in nsIURI aPageURI,
-                                in nsIURI aFaviconURI,
-                                in boolean aForceReload,
-                                in unsigned long aFaviconLoadType,
-                                [optional] in nsIFaviconDataCallback aCallback);
-
-  /**
-   * Stores the data for a given favicon URI.
-   *
-   * You can set the data even if you haven't called SetFaviconUrlForPage
-   * yet.  It will be stored but will not be associated with any page.
-   * However, any favicons not associated with a visited web page, bookmark,
-   * or "place:" URI will be expired when history expiration runs.  This might
-   * happen at any time, so you should not let the message loop run before
-   * you associate the icon or it may get deleted.
-   *
-   * It is best to set the favicon data, and then associate it with a page using
-   * setFaviconUrlForPage, otherwise it won't notify about the change.
-   *
-   * It's better to not use this function for chrome: icon URIs since you can
-   * reference the chrome image yourself. GetFaviconLinkForIcon/Page will ignore
-   * any associated data if the favicon URI is "chrome:" and just return the
-   * same chrome URI.
-   *
-   * This function does NOT send out notifications that the data has changed.
-   * Pages using this favicons that are visible in history or bookmarks views
-   * will keep the old icon until they have been refreshed by other means.
-   *
-   * This function tries to optimize the favicon size, if it is bigger
-   * than a defined limit we will try to convert it to a 16x16 png image.
-   * If the conversion fails and favicon is still bigger than our max accepted
-   * size it won't be saved.
-   *
-   * @param aFaviconURI
-   *        URI of the favicon whose data is being set.
-   * @param aData
-   *        Binary contents of the favicon to save
-   * @param aDataLength
-   *        Length of binary data
-   * @param aMimeType
-   *        MIME type of the data to store.  This is important so that we know
-   *        what to report when the favicon is used.  You should always set this
-   *        param unless you are clearing an icon.
-   * @param aExpiration
-   *        Time in microseconds since the epoch when this favicon expires.
-   *        Until this time, we won't try to load it again.
-   * @throws NS_ERROR_FAILURE
-   *         Thrown if the favicon is overbloated and won't be saved to the db.
-   *
-   * @deprecated Use mozIAsyncFavicons::replaceFaviconData
-   */
-  void setFaviconData(in nsIURI aFaviconURI,
-                      [const,array,size_is(aDataLen)] in octet aData,
-                      in unsigned long aDataLen,
-                      in AUTF8String aMimeType,
-                      in PRTime aExpiration);
-
-  /**
-   * Same as setFaviconData but the data is provided by a string
-   * containing a data URL.
-   *
-   * @see setFaviconData
-   *
-   * @param aFaviconURI
-   *        URI of the favicon whose data is being set.
-   * @param aDataURL
-   *        string containing a data URL that represents the contents of
-   *        the favicon to save
-   * @param aExpiration
-   *        Time in microseconds since the epoch when this favicon expires.
-   *        Until this time, we won't try to load it again.
-   * @throws NS_ERROR_FAILURE
-   *         Thrown if the favicon is overbloated and won't be saved to the db.
-   *
-   * @deprecated Use mozIAsyncFavicons::replaceFaviconDataFromDataURL
-   */
-  void setFaviconDataFromDataURL(in nsIURI aFaviconURI,
-                                 in AString aDataURL,
-                                 in PRTime aExpiration);
-
-  /**
-   * Retrieves the given favicon data.  Throws if we don't have data.
-   *
-   * If there is no data but we have an entry for this favicon, aDataLen will
-   * be 0 and aData will be NULL.
-   *
-   * @param aFaviconURI
-   *        URI of the favicon whose data is being read
-   * @param aData
-   *        Output parameter where the binary favicon data will be placed.
-   *        This will be null if we have this URI but have no data associated
-   *        with it.
-   * @param aDataLen
-   *        Output parameter where the size of the binary data will be placed.
-   * @param aMimeType
-   *        Output parameter where the MIME type will be placed.
-   * @throws NS_ERROR_NOT_AVAILABLE
-   *         Thrown when we have never heard of this favicon URI.
-   *
-   * @deprecated Use mozIAsyncFavicons::getFaviconDataForPage
-   */
-  void getFaviconData(in nsIURI aFaviconURI,
-                      out AUTF8String aMimeType,
-                      [optional] out unsigned long aDataLen,
-                      [array,retval,size_is(aDataLen)] out octet aData);
-
-  /**
-   * Same as getFaviconData, but returns data as a string containing a data url.
-   *
-   * @see getFaviconData
-   *
-   * @param aFaviconURI
-   *        URI of the favicon whose data is being read
-   * @return A data URL containing the data of the favicon. This will be
-   *         null if we have this URL but have no data associated with it.
-   * @throws NS_ERROR_NOT_AVAILABLE
-   *         Thrown when we have never heard of this favicon URL.
-   *
-   * @deprecated Use mozIAsyncFavicons::getFaviconDataForPage
-   */
-  AString getFaviconDataAsDataURL(in nsIURI aFaviconURI);
-
-  /**
-   * Retrieves the URI of the favicon for the given page.
-   *
-   * @param aPageURI
-   *        URI of the page whose favicon is desired
-   * @return The URI of the favicon associated with that page. Returning a
-   *         URI here does NOT mean that we have data for this favicon, only
-   *         that we know what the favicon should be.
-   * @throws NS_ERROR_NOT_AVAILABLE
-   *         When the page is not found or it has no favicon.
-   *
-   * @deprecated Use mozIAsyncFavicons::getFaviconURLForPage
-   */
-  nsIURI getFaviconForPage(in nsIURI aPageURI);
-
-  /**
-   * Same as getFaviconLinkForIcon but this adds an extra level of indirection,
-   * looking up the favicon based on the page URI and using the default if not
-   * found.
-   *
-   * @see getFaviconLinkForIcon
-   *
-   * @param aPageURI
-   *        URI of the page whose favicon is desired
-   * @return A URI that will give you the icon image.  This is NOT the URI of
-   *         the icon as set on the page, but a URI that will give you the
-   *         data out of the favicon service.  For a normal page with a
-   *         favicon we've stored, this will be an annotation URI which will
-   *         then cause the corresponding favicon data to be loaded async from
-   *         this service.  For pages where we don't have a favicon, this will
-   *         be a chrome URI of the default icon. For chrome URIs, the
-   *         output will be the same as the input.
-   *
-   * @deprecated Use mozIAsyncFavicons::getFaviconURLForPage and getFaviconLinkForIcon
-   */
-  nsIURI getFaviconImageForPage(in nsIURI aPageURI);
-
-  /**
    * For a given icon URI, this will return a URI that will result in the image.
    * In most cases, this is an annotation URI.  For chrome URIs, this will do
    * nothing but returning the input URI.
    *
    * No validity checking is done. If you pass an icon URI that we've never
    * seen, you'll get back a URI that references an invalid icon. The moz-anno
    * protocol handler's special case for "favicon" annotations will resolve
    * invalid icons to the default icon, although without caching.
@@ -351,12 +127,13 @@ interface nsIFaviconDataCallback : nsISu
 };
 
 %{C++
 
 /**
  * Notification sent when all favicons are expired.
  */
 #define NS_PLACES_FAVICONS_EXPIRED_TOPIC_ID "places-favicons-expired"
+
 #define FAVICON_DEFAULT_URL "chrome://mozapps/skin/places/defaultFavicon.png"
 #define FAVICON_ERRORPAGE_URL "chrome://global/skin/icons/warning-16.png"
 
 %}
--- a/toolkit/components/places/nsNavBookmarks.h
+++ b/toolkit/components/places/nsNavBookmarks.h
@@ -106,20 +106,16 @@ public:
    */
   static nsNavBookmarks* GetSingleton();
 
   /**
    * Initializes the service's object.  This should only be called once.
    */
   nsresult Init();
 
-  static nsNavBookmarks* GetBookmarksServiceIfAvailable() {
-    return gBookmarksService;
-  }
-
   static nsNavBookmarks* GetBookmarksService() {
     if (!gBookmarksService) {
       nsCOMPtr<nsINavBookmarksService> serv =
         do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID);
       NS_ENSURE_TRUE(serv, nullptr);
       NS_ASSERTION(gBookmarksService,
                    "Should have static instance pointer now");
     }
deleted file mode 100644
--- a/toolkit/components/places/tests/favicons/test_favicons.js
+++ /dev/null
@@ -1,317 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * This file tests the basic synchronous (deprecated) and asynchronous favicons
- * APIs, and their interactions when they are used together.
- */
-
-function run_test() {
-  run_next_test();
-}
-
-/*
- * The following few tests are asynchronous but share state. We bundle that
- * state into two arrays: `icons` and `pages`.
- * The tests are in four parts:
- *
- * 1. setup, where we add some history visits, and set an icon for one of them;
- * 2. getFaviconURLForPage, where we test synchronous retrieval;
- * 3. second_and_third, where we add icons for the remaining two pages, and test
- *    them synchronously;
- * 4. getFaviconDataForPage, which tests asynchronous retrieval.
- */
-let icons = [
-  {
-    name: "favicon-normal32.png",
-    mime: "image/png",
-    data: null,
-    uri:  NetUtil.newURI("file:///./favicon-normal32.png")
-  },
-  {
-    name: "favicon-normal16.png",
-    mime: "image/png",
-    data: null,
-    uri:  NetUtil.newURI("file:///./favicon-normal16.png")
-  }
-];
-
-let pages = [
-  NetUtil.newURI("http://foo.bar/"),
-  NetUtil.newURI("http://bar.foo/"),
-  NetUtil.newURI("http://foo.bar.moz/")
-];
-
-add_task(function test_set_and_get_favicon_setup() {
-  do_log_info("Setup code for set/get favicon.");
-  let [icon0, icon1] = icons;
-
-  // 32x32 png, 344 bytes.
-  icon0.data = readFileOfLength(icon0.name, 344);
-
-  // 16x16 png, 286 bytes.
-  icon1.data = readFileOfLength(icon1.name, 286);
-
-  // Add visits to the DB.
-  for each (let uri in pages) {
-    yield promiseAddVisits(uri);
-  }
-
-  // Set first page icon.
-  try {
-    PlacesUtils.favicons.setFaviconData(icon0.uri, icon0.data, icon0.data.length,
-                                        icon0.mime, Number.MAX_VALUE);
-  } catch (ex) {
-    do_throw("Failure setting first page icon: " + ex);
-  }
-  PlacesUtils.favicons.setFaviconUrlForPage(pages[0], icon0.uri);
-  do_check_guid_for_uri(pages[0]);
-
-  let favicon = PlacesUtils.favicons.getFaviconForPage(pages[0]);
-  do_check_true(icon0.uri.equals(favicon));
-});
-
-add_test(function test_set_and_get_favicon_getFaviconURLForPage() {
-  let [icon0] = icons;
-  PlacesUtils.favicons.getFaviconURLForPage(pages[0],
-    function (aURI, aDataLen, aData, aMimeType) {
-      do_check_true(icon0.uri.equals(aURI));
-      do_check_eq(aDataLen, 0);
-      do_check_eq(aData.length, 0);
-      do_check_eq(aMimeType, "");
-      run_next_test();
-    });
-});
-
-add_test(function test_set_and_get_favicon_second_and_third() {
-  let [icon0, icon1] = icons;
-  try {
-    PlacesUtils.favicons.setFaviconData(icon1.uri, icon1.data, icon1.data.length,
-                                        icon1.mime, Number.MAX_VALUE);
-  } catch (ex) {
-    do_throw("Failure setting second page icon: " + ex);
-  }
-  PlacesUtils.favicons.setFaviconUrlForPage(pages[1], icon1.uri);
-  do_check_guid_for_uri(pages[1]);
-  do_check_true(icon1.uri.equals(PlacesUtils.favicons.getFaviconForPage(pages[1])));
-
-  // Set third page icon as the same as first page one.
-  try {
-    PlacesUtils.favicons.setFaviconData(icon0.uri, icon0.data, icon0.data.length,
-                                        icon0.mime, Number.MAX_VALUE);
-  } catch (ex) {
-    do_throw("Failure setting third page icon: " + ex);
-  }
-  PlacesUtils.favicons.setFaviconUrlForPage(pages[2], icon0.uri);
-  do_check_guid_for_uri(pages[2]);
-  let page3favicon = PlacesUtils.favicons.getFaviconForPage(pages[2]);
-  do_check_true(icon0.uri.equals(page3favicon));
-
-  // Check first page icon.
-  let out1MimeType = {};
-  let out1Data = PlacesUtils.favicons.getFaviconData(icon0.uri, out1MimeType);
-  do_check_eq(icon0.mime, out1MimeType.value);
-  do_check_true(compareArrays(icon0.data, out1Data));
-
-  // Check second page icon.
-  let out2MimeType = {};
-  let out2Data = PlacesUtils.favicons.getFaviconData(icon1.uri, out2MimeType);
-  do_check_eq(icon1.mime, out2MimeType.value);
-  do_check_true(compareArrays(icon1.data, out2Data));
-
-  // Check third page icon.
-  let out3MimeType = {};
-  let out3Data = PlacesUtils.favicons.getFaviconData(page3favicon, out3MimeType);
-  do_check_eq(icon0.mime, out3MimeType.value);
-  do_check_true(compareArrays(icon0.data, out3Data));
-  run_next_test();
-});
-
-add_test(function test_set_and_get_favicon_getFaviconDataForPage() {
-  let [icon0] = icons;
-  PlacesUtils.favicons.getFaviconDataForPage(pages[0],
-    function(aURI, aDataLen, aData, aMimeType) {
-      do_check_true(aURI.equals(icon0.uri));
-      do_check_eq(icon0.mime, icon0.mime);
-      do_check_true(compareArrays(icon0.data, aData));
-      do_check_eq(aDataLen, aData.length);
-      run_next_test();
-    });
-});
-
-add_test(function test_favicon_links() {
-  let pageURI = NetUtil.newURI("http://foo.bar/");
-  let faviconURI = NetUtil.newURI("file:///./favicon-normal32.png");
-  do_check_eq(PlacesUtils.favicons.getFaviconImageForPage(pageURI).spec,
-              PlacesUtils.favicons.getFaviconLinkForIcon(faviconURI).spec);
-  run_next_test();
-});
-
-add_test(function test_failed_favicon_cache() {
-  // 32x32 png, 344 bytes.
-  let iconName = "favicon-normal32.png";
-  let faviconURI = NetUtil.newURI("file:///./" + iconName);
-
-  PlacesUtils.favicons.addFailedFavicon(faviconURI);
-  do_check_true(PlacesUtils.favicons.isFailedFavicon(faviconURI));
-  PlacesUtils.favicons.removeFailedFavicon(faviconURI);
-  do_check_false(PlacesUtils.favicons.isFailedFavicon(faviconURI));
-  run_next_test();
-});
-
-add_test(function test_getFaviconData_on_the_default_favicon() {
-  let icon = PlacesUtils.favicons.defaultFavicon;
-  let outMimeType = {};
-  let outData = PlacesUtils.favicons.getFaviconData(icon, outMimeType);
-  do_check_eq(outMimeType.value, "image/png");
-
-  // Read in the icon and compare it to what the API returned above.
-  let istream = NetUtil.newChannel(PlacesUtils.favicons.defaultFavicon).open();
-  let expectedData = readInputStreamData(istream);
-  do_check_true(compareArrays(outData, expectedData));
-  run_next_test();
-});
-
-/*
- * Retrieve the GUID for a favicon URI. For now we'll do this through SQL.
- * Provide a mozIStorageStatementCallback, such as a SingleGUIDCallback.
- */
-function guidForFaviconURI(iconURIString, cb) {
-  let query = "SELECT guid FROM moz_favicons WHERE url = :url";
-  let stmt = cb.statement = DBConn().createAsyncStatement(query);
-  stmt.params.url = iconURIString;
-  stmt.executeAsync(cb);
-  stmt.finalize();
-}
-
-/*
- * A mozIStorageStatementCallback for single GUID results.
- * Pass in a callback function, which will be invoked on completion.
- * Ensures that only a single GUID is returned.
- */
-function SingleGUIDCallback(cb) {
-  this.called = 0;
-  this.cb     = cb;
-}
-SingleGUIDCallback.prototype = {
-  _guid: null,
-  handleCompletion: function handleCompletion(reason) {
-    do_log_info("Completed single GUID callback.");
-    do_check_eq(this.called, 1);
-    this.cb(this._guid);
-  },
-  handleError: function handleError(err) {
-    do_throw(err);
-  },
-  handleResult: function handleResult(resultSet) {
-    this.called++;
-    this._guid = resultSet.getNextRow().getResultByName("guid");
-    do_log_info("Retrieved GUID is " + this._guid);
-    do_check_true(!!this._guid);
-    do_check_valid_places_guid(this._guid);
-    do_check_eq(null, resultSet.getNextRow());  // No more rows.
-  }
-};
-
-function insertToolbarBookmark(uri, title) {
-  PlacesUtils.bookmarks.insertBookmark(
-    PlacesUtils.toolbarFolderId,
-    uri,
-    PlacesUtils.bookmarks.DEFAULT_INDEX,
-    title
-  );
-}
-
-add_test(function test_insert_synchronous_mints_guid() {
-  do_log_info("Test that synchronously inserting a favicon results in a " +
-              "record with a new GUID.");
-
-  let testURI     = "http://test.com/sync/";
-  let testIconURI = "http://test.com/favicon.ico";
-  let pageURI     = NetUtil.newURI(testURI);
-
-  // No icon to start with.
-  checkFaviconMissingForPage(pageURI, function () {
-    // Add a page with a bookmark.
-    insertToolbarBookmark(pageURI, "Test page");
-
-    // Set a favicon for the page.
-    PlacesUtils.favicons.setFaviconUrlForPage(
-      pageURI, NetUtil.newURI(testIconURI)
-    );
-
-    // Check that the URI has been set correctly.
-    do_check_eq(PlacesUtils.favicons.getFaviconForPage(pageURI).spec,
-                testIconURI);
-
-    guidForFaviconURI(testIconURI, new SingleGUIDCallback(run_next_test));
-  });
-});
-
-add_test(function test_insert_asynchronous_mints_guid() {
-  do_log_info("Test that asynchronously inserting a favicon results in a " +
-              "record with a new GUID.");
-
-  let testURI = "http://test.com/async/";
-  let iconURI = NetUtil.newURI(do_get_file("favicon-normal32.png"));
-  let pageURI = NetUtil.newURI(testURI);
-
-  // No icon to start with.
-  checkFaviconMissingForPage(pageURI, function () {
-    // Add a page with a bookmark.
-    insertToolbarBookmark(pageURI, "Other test page");
-
-    // Set a favicon for the page.
-    do_log_info("Asynchronously setting page favicon.");
-    PlacesUtils.favicons.setAndFetchFaviconForPage(
-      pageURI, iconURI, false,
-      PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
-      function AMG_faviconDataCallback(uri, len, data, mimeType) {
-        do_check_true(iconURI.equals(uri));
-
-        // Make sure there's a valid GUID.
-        guidForFaviconURI(iconURI.spec, new SingleGUIDCallback(run_next_test));
-      });
-  });
-});
-
-add_test(function test_insert_asynchronous_update_preserves_guid() {
-  do_log_info("Test that asynchronously inserting an existing favicon leaves " +
-              "the GUID unchanged.");
-
-  let testURI = "http://test.com/async/";
-  let iconURI = NetUtil.newURI(do_get_file("favicon-normal32.png"));
-  let pageURI = NetUtil.newURI(testURI);
-
-  guidForFaviconURI(iconURI.spec, new SingleGUIDCallback(function (guid) {
-    // Set a favicon for the page... again.
-    do_log_info("Asynchronously re-setting page favicon.");
-    PlacesUtils.favicons.setAndFetchFaviconForPage(
-      pageURI, iconURI, true,
-      PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
-      function UPG_faviconDataCallback(uri, len, data, mimeType) {
-        do_check_true(iconURI.equals(uri));
-
-        // Make sure there's a valid GUID.
-        guidForFaviconURI(iconURI.spec,
-          new SingleGUIDCallback(function (again) {
-            do_check_eq(guid, again);
-            run_next_test();
-          }));
-      });
-  }));
-});
-
-add_test(function test_setFaviconURLForPage_nonexistingPage_throws() {
-  try {
-    PlacesUtils.favicons.setFaviconUrlForPage(
-      NetUtil.newURI("http://nonexisting.moz.org"), icons[0].uri);
-    do_throw("Setting an icon for a nonexisting page should throw")
-  } catch (ex if ex.result == Cr.NS_ERROR_NOT_AVAILABLE) {}
-  run_next_test();
-});
-
-/*
- * TODO: need a test for async write that modifies a GUID for a favicon.
- * This will come later, when there's an API that actually does that!
- */
--- a/toolkit/components/places/tests/favicons/xpcshell.ini
+++ b/toolkit/components/places/tests/favicons/xpcshell.ini
@@ -1,16 +1,13 @@
 [DEFAULT]
 head = head_favicons.js
 tail =
 
 [test_expireAllFavicons.js]
-[test_favicons.js]
-# Bug 676989: test fails consistently on Android
-fail-if = os == "android"
 [test_favicons_conversions.js]
 # Bug 676989: test fails consistently on Android
 fail-if = os == "android"
 [test_getFaviconDataForPage.js]
 [test_getFaviconURLForPage.js]
 [test_moz-anno_favicon_mime_type.js]
 [test_query_result_favicon_changed_on_child.js]
 [test_replaceFaviconData.js]