Bug 895839 - Remove support for binary annotations. r=mak. sr=gavin.
authorAsaf Romano <mano@mozilla.com>
Sat, 03 Aug 2013 14:06:47 +0300
changeset 153582 714a27789e9e751791328ac8a458243438e72d40
parent 153581 5197eef777dd5da68dd3f5424e3fdfd837ad3ae7
child 153583 58c2fb8fb2c242aaee3f760f8d8e42888f2e9076
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak, gavin
bugs895839
milestone25.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 895839 - Remove support for binary annotations. r=mak. sr=gavin.
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/nsAnnoProtocolHandler.cpp
toolkit/components/places/nsAnnoProtocolHandler.h
toolkit/components/places/nsAnnotationService.cpp
toolkit/components/places/nsAnnotationService.h
toolkit/components/places/nsIAnnotationService.idl
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/places/tests/queries/head_queries.js
toolkit/components/places/tests/unit/test_annotations.js
toolkit/components/places/tests/unit/test_utils_setAnnotationsFor.js
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -767,38 +767,29 @@ this.PlacesUtils = {
   },
 
   /**
    * Fetch all annotations for a URI, including all properties of each
    * annotation which would be required to recreate it.
    * @param aURI
    *        The URI for which annotations are to be retrieved.
    * @return Array of objects, each containing the following properties:
-   *         name, flags, expires, mimeType, type, value
+   *         name, flags, expires, value
    */
   getAnnotationsForURI: function PU_getAnnotationsForURI(aURI) {
     var annosvc = this.annotations;
     var annos = [], val = null;
     var annoNames = annosvc.getPageAnnotationNames(aURI);
     for (var i = 0; i < annoNames.length; i++) {
-      var flags = {}, exp = {}, mimeType = {}, storageType = {};
-      annosvc.getPageAnnotationInfo(aURI, annoNames[i], flags, exp, mimeType, storageType);
-      if (storageType.value == annosvc.TYPE_BINARY) {
-        var data = {}, length = {}, mimeType = {};
-        annosvc.getPageAnnotationBinary(aURI, annoNames[i], data, length, mimeType);
-        val = data.value;
-      }
-      else
-        val = annosvc.getPageAnnotation(aURI, annoNames[i]);
-
+      var flags = {}, exp = {}, storageType = {};
+      annosvc.getPageAnnotationInfo(aURI, annoNames[i], flags, exp, storageType);
+      val = annosvc.getPageAnnotation(aURI, annoNames[i]);
       annos.push({name: annoNames[i],
                   flags: flags.value,
                   expires: exp.value,
-                  mimeType: mimeType.value,
-                  type: storageType.value,
                   value: val});
     }
     return annos;
   },
 
   /**
    * Fetch all annotations for an item, including all properties of each
    * annotation which would be required to recreate it.
@@ -808,93 +799,71 @@ this.PlacesUtils = {
    * @return Array of objects, each containing the following properties:
    *         name, flags, expires, mimeType, type, value
    */
   getAnnotationsForItem: function PU_getAnnotationsForItem(aItemId) {
     var annosvc = this.annotations;
     var annos = [], val = null;
     var annoNames = annosvc.getItemAnnotationNames(aItemId);
     for (var i = 0; i < annoNames.length; i++) {
-      var flags = {}, exp = {}, mimeType = {}, storageType = {};
-      annosvc.getItemAnnotationInfo(aItemId, annoNames[i], flags, exp, mimeType, storageType);
-      if (storageType.value == annosvc.TYPE_BINARY) {
-        var data = {}, length = {}, mimeType = {};
-        annosvc.geItemAnnotationBinary(aItemId, annoNames[i], data, length, mimeType);
-        val = data.value;
-      }
-      else
-        val = annosvc.getItemAnnotation(aItemId, annoNames[i]);
-
+      var flags = {}, exp = {}, storageType = {};
+      annosvc.getItemAnnotationInfo(aItemId, annoNames[i], flags, exp, storageType);
+      val = annosvc.getItemAnnotation(aItemId, annoNames[i]);
       annos.push({name: annoNames[i],
                   flags: flags.value,
                   expires: exp.value,
-                  mimeType: mimeType.value,
-                  type: storageType.value,
                   value: val});
     }
     return annos;
   },
 
   /**
    * Annotate a URI with a batch of annotations.
    * @param aURI
    *        The URI for which annotations are to be set.
    * @param aAnnotations
    *        Array of objects, each containing the following properties:
-   *        name, flags, expires, type, mimeType (only used for binary
-   *        annotations) value.
+   *        name, flags, expires.
    *        If the value for an annotation is not set it will be removed.
    */
   setAnnotationsForURI: function PU_setAnnotationsForURI(aURI, aAnnos) {
     var annosvc = this.annotations;
     aAnnos.forEach(function(anno) {
-      if (!anno.value) {
+      if (anno.value === undefined || anno.value === null) {
         annosvc.removePageAnnotation(aURI, anno.name);
-        return;
       }
-      var flags = ("flags" in anno) ? anno.flags : 0;
-      var expires = ("expires" in anno) ?
-        anno.expires : Ci.nsIAnnotationService.EXPIRE_NEVER;
-      if (anno.type == annosvc.TYPE_BINARY) {
-        annosvc.setPageAnnotationBinary(aURI, anno.name, anno.value,
-                                        anno.value.length, anno.mimeType,
-                                        flags, expires);
+      else {
+        let flags = ("flags" in anno) ? anno.flags : 0;
+        let expires = ("expires" in anno) ?
+          anno.expires : Ci.nsIAnnotationService.EXPIRE_NEVER;
+        annosvc.setPageAnnotation(aURI, anno.name, anno.value, flags, expires);
       }
-      else
-        annosvc.setPageAnnotation(aURI, anno.name, anno.value, flags, expires);
     });
   },
 
   /**
    * Annotate an item with a batch of annotations.
    * @param aItemId
    *        The identifier of the item for which annotations are to be set
    * @param aAnnotations
    *        Array of objects, each containing the following properties:
-   *        name, flags, expires, type, mimeType (only used for binary
-   *        annotations) value.
+   *        name, flags, expires.
    *        If the value for an annotation is not set it will be removed.
    */
   setAnnotationsForItem: function PU_setAnnotationsForItem(aItemId, aAnnos) {
     var annosvc = this.annotations;
 
     aAnnos.forEach(function(anno) {
-      if (!anno.value) {
+      if (anno.value === undefined || anno.value === null) {
         annosvc.removeItemAnnotation(aItemId, anno.name);
-        return;
-      }
-      var flags = ("flags" in anno) ? anno.flags : 0;
-      var expires = ("expires" in anno) ?
-        anno.expires : Ci.nsIAnnotationService.EXPIRE_NEVER;
-      if (anno.type == annosvc.TYPE_BINARY) {
-        annosvc.setItemAnnotationBinary(aItemId, anno.name, anno.value,
-                                        anno.value.length, anno.mimeType,
-                                        flags, expires);
       }
       else {
+        let flags = ("flags" in anno) ? anno.flags : 0;
+        let expires = ("expires" in anno) ?
+          anno.expires : Ci.nsIAnnotationService.EXPIRE_NEVER;
         annosvc.setItemAnnotation(aItemId, anno.name, anno.value, flags,
                                   expires);
       }
     });
   },
 
   // Identifier getters for special folders.
   // You should use these everywhere PlacesUtils is available to avoid XPCOM
@@ -2695,18 +2664,17 @@ PlacesEditBookmarkURITransaction.prototy
 
 /**
  * Transaction for setting/unsetting an item annotation
  *
  * @param aItemId
  *        id of the item where to set annotation
  * @param aAnnotationObject
  *        Object representing an annotation, containing the following
- *        properties: name, flags, expires, type, mimeType (only used for
- *        binary annotations), value.
+ *        properties: name, flags, expires, value.
  *        If value is null the annotation will be removed
  *
  * @return nsITransaction object
  */
 this.PlacesSetItemAnnotationTransaction =
  function PlacesSetItemAnnotationTransaction(aItemId, aAnnotationObject)
 {
   this.item = new TransactionItemCache();
@@ -2718,31 +2686,30 @@ this.PlacesSetItemAnnotationTransaction 
 PlacesSetItemAnnotationTransaction.prototype = {
   __proto__: BaseTransaction.prototype,
 
   doTransaction: function SIATXN_doTransaction()
   {
     let annoName = this.new.annotations[0].name;
     if (PlacesUtils.annotations.itemHasAnnotation(this.item.id, annoName)) {
       // fill the old anno if it is set
-      let flags = {}, expires = {}, mimeType = {}, type = {};
+      let flags = {}, expires = {}, type = {};
       PlacesUtils.annotations.getItemAnnotationInfo(this.item.id, annoName, flags,
-                                                    expires, mimeType, type);
+                                                    expires, type);
       let value = PlacesUtils.annotations.getItemAnnotation(this.item.id,
                                                             annoName);
       this.item.annotations = [{ name: annoName,
                                 type: type.value,
                                 flags: flags.value,
                                 value: value,
                                 expires: expires.value }];
     }
     else {
       // create an empty old anno
       this.item.annotations = [{ name: annoName,
-                                type: Ci.nsIAnnotationService.TYPE_STRING,
                                 flags: 0,
                                 value: null,
                                 expires: Ci.nsIAnnotationService.EXPIRE_NEVER }];
     }
 
     PlacesUtils.setAnnotationsForItem(this.item.id, this.new.annotations);
   },
 
@@ -2755,18 +2722,17 @@ PlacesSetItemAnnotationTransaction.proto
 
 /**
  * Transaction for setting/unsetting a page annotation
  *
  * @param aURI
  *        URI of the page where to set annotation
  * @param aAnnotationObject
  *        Object representing an annotation, containing the following
- *        properties: name, flags, expires, type, mimeType (only used for
- *        binary annotations), value.
+ *        properties: name, flags, expires, value.
  *        If value is null the annotation will be removed
  *
  * @return nsITransaction object
  */
 this.PlacesSetPageAnnotationTransaction =
  function PlacesSetPageAnnotationTransaction(aURI, aAnnotationObject)
 {
   this.item = new TransactionItemCache();
@@ -2778,23 +2744,22 @@ this.PlacesSetPageAnnotationTransaction 
 PlacesSetPageAnnotationTransaction.prototype = {
   __proto__: BaseTransaction.prototype,
 
   doTransaction: function SPATXN_doTransaction()
   {
     let annoName = this.new.annotations[0].name;
     if (PlacesUtils.annotations.pageHasAnnotation(this.item.uri, annoName)) {
       // fill the old anno if it is set
-      let flags = {}, expires = {}, mimeType = {}, type = {};
+      let flags = {}, expires = {}, type = {};
       PlacesUtils.annotations.getPageAnnotationInfo(this.item.uri, annoName, flags,
-                                                    expires, mimeType, type);
+                                                    expires, type);
       let value = PlacesUtils.annotations.getPageAnnotation(this.item.uri,
                                                             annoName);
       this.item.annotations = [{ name: annoName,
-                                type: type.value,
                                 flags: flags.value,
                                 value: value,
                                 expires: expires.value }];
     }
     else {
       // create an empty old anno
       this.item.annotations = [{ name: annoName,
                                 type: Ci.nsIAnnotationService.TYPE_STRING,
--- a/toolkit/components/places/nsAnnoProtocolHandler.cpp
+++ b/toolkit/components/places/nsAnnoProtocolHandler.cpp
@@ -1,20 +1,21 @@
 //* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 /**
- * Implementation of moz-anno: URLs for accessing annotation values. This just
- * reads binary data from the annotation service.
+ * Implementation of moz-anno: URLs for accessing favicons.  The urls are sent
+ * to the favicon service.  If the favicon service doesn't have the
+ * data, a stream containing the default favicon will be returned.
  *
- * There is a special case for favicons. Annotation URLs with the name "favicon"
- * will be sent to the favicon service. If the favicon service doesn't have the
- * data, a stream containing the default favicon will be returned.
+ * The reference to annotations ("moz-anno") is a leftover from previous
+ * iterations of this component. As of now the moz-anno protocol is independent
+ * of annotations.
  */
 
 #include "nsAnnoProtocolHandler.h"
 #include "nsFaviconService.h"
 #include "nsIChannel.h"
 #include "nsIInputStreamChannel.h"
 #include "nsILoadGroup.h"
 #include "nsIStandardURL.h"
@@ -251,72 +252,28 @@ nsAnnoProtocolHandler::NewURI(const nsAC
 
 // nsAnnoProtocolHandler::NewChannel
 //
 
 NS_IMETHODIMP
 nsAnnoProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
 {
   NS_ENSURE_ARG_POINTER(aURI);
-  nsresult rv;
-
-  nsAutoCString path;
-  rv = aURI->GetPath(path);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIAnnotationService> annotationService = do_GetService(
-                              "@mozilla.org/browser/annotation-service;1", &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
 
   // annotation info
   nsCOMPtr<nsIURI> annoURI;
   nsAutoCString annoName;
-  rv = ParseAnnoURI(aURI, getter_AddRefs(annoURI), annoName);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // If this is a favicon annotation, we create a different channel that will
-  // ask the favicon service for information about the favicon.
-  if (annoName.EqualsLiteral(FAVICON_ANNOTATION_NAME))
-    return NewFaviconChannel(aURI, annoURI, _retval);
-
-  // normal handling for annotations
-  uint8_t* data;
-  uint32_t dataLen;
-  nsAutoCString mimeType;
-
-  // get the data from the annotation service and hand it off to the stream
-  rv = annotationService->GetPageAnnotationBinary(annoURI, annoName, &data,
-                                                  &dataLen, mimeType);
+  nsresult rv = ParseAnnoURI(aURI, getter_AddRefs(annoURI), annoName);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  // disallow annotations with no MIME types
-  if (mimeType.IsEmpty()) {
-    NS_Free(data);
-    return NS_ERROR_NOT_AVAILABLE;
-  }
+  // Only favicon annotation are supported.
+  if (!annoName.EqualsLiteral(FAVICON_ANNOTATION_NAME))
+    return NS_ERROR_INVALID_ARG;
 
-  nsCOMPtr<nsIStringInputStream> stream = do_CreateInstance(
-                                          NS_STRINGINPUTSTREAM_CONTRACTID, &rv);
-  if (NS_FAILED(rv)) {
-    NS_Free(data);
-    return rv;
-  }
-  rv = stream->AdoptData((char*)data, dataLen);
-  if (NS_FAILED(rv)) {
-    NS_Free(data);
-    return rv;
-  }
-
-  nsCOMPtr<nsIChannel> channel;
-  rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, stream, mimeType);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  *_retval = channel;
-  NS_ADDREF(*_retval);
-  return NS_OK;
+  return NewFaviconChannel(aURI, annoURI, _retval);
 }
 
 
 // nsAnnoProtocolHandler::AllowPort
 //
 //    Don't override any bans on bad ports.
 
 NS_IMETHODIMP
--- a/toolkit/components/places/nsAnnoProtocolHandler.h
+++ b/toolkit/components/places/nsAnnoProtocolHandler.h
@@ -2,17 +2,16 @@
 /* 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/. */
 
 #ifndef nsAnnoProtocolHandler_h___
 #define nsAnnoProtocolHandler_h___
 
 #include "nsCOMPtr.h"
-#include "nsIAnnotationService.h"
 #include "nsIProtocolHandler.h"
 #include "nsIURI.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
 #include "mozilla/Attributes.h"
 
 // {e8b8bdb7-c96c-4d82-9c6f-2b3c585ec7ea}
 #define NS_ANNOPROTOCOLHANDLER_CID \
--- a/toolkit/components/places/nsAnnotationService.cpp
+++ b/toolkit/components/places/nsAnnotationService.cpp
@@ -35,23 +35,22 @@ using namespace mozilla::places;
   PR_BEGIN_MACRO                                                               \
   for (int32_t i = 0; i < mObservers.Count(); i++)                             \
     mObservers[i]->_notification;                                              \
   PR_END_MACRO
 
 const int32_t nsAnnotationService::kAnnoIndex_ID = 0;
 const int32_t nsAnnotationService::kAnnoIndex_PageOrItem = 1;
 const int32_t nsAnnotationService::kAnnoIndex_NameID = 2;
-const int32_t nsAnnotationService::kAnnoIndex_MimeType = 3;
-const int32_t nsAnnotationService::kAnnoIndex_Content = 4;
-const int32_t nsAnnotationService::kAnnoIndex_Flags = 5;
-const int32_t nsAnnotationService::kAnnoIndex_Expiration = 6;
-const int32_t nsAnnotationService::kAnnoIndex_Type = 7;
-const int32_t nsAnnotationService::kAnnoIndex_DateAdded = 8;
-const int32_t nsAnnotationService::kAnnoIndex_LastModified = 9;
+const int32_t nsAnnotationService::kAnnoIndex_Content = 3;
+const int32_t nsAnnotationService::kAnnoIndex_Flags = 4;
+const int32_t nsAnnotationService::kAnnoIndex_Expiration = 5;
+const int32_t nsAnnotationService::kAnnoIndex_Type = 6;
+const int32_t nsAnnotationService::kAnnoIndex_DateAdded = 7;
+const int32_t nsAnnotationService::kAnnoIndex_LastModified = 8;
 
 namespace mozilla {
 namespace places {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// AnnotatedResult
 
 AnnotatedResult::AnnotatedResult(const nsCString& aGUID,
@@ -161,18 +160,16 @@ nsAnnotationService::SetAnnotationString
   nsresult rv = StartSetAnnotation(aURI, aItemId, aName, aFlags, aExpiration,
                                    nsIAnnotationService::TYPE_STRING,
                                    statement);
   NS_ENSURE_SUCCESS(rv, rv);
   mozStorageStatementScoper scoper(statement);
 
   rv = statement->BindStringByName(NS_LITERAL_CSTRING("content"), aValue);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = statement->BindNullByName(NS_LITERAL_CSTRING("mime_type"));
-  NS_ENSURE_SUCCESS(rv, rv);
 
   rv = statement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
@@ -389,18 +386,16 @@ nsAnnotationService::SetAnnotationInt32I
   nsresult rv = StartSetAnnotation(aURI, aItemId, aName, aFlags, aExpiration,
                                    nsIAnnotationService::TYPE_INT32,
                                    statement);
   NS_ENSURE_SUCCESS(rv, rv);
   mozStorageStatementScoper scoper(statement);
 
   rv = statement->BindInt32ByName(NS_LITERAL_CSTRING("content"), aValue);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = statement->BindNullByName(NS_LITERAL_CSTRING("mime_type"));
-  NS_ENSURE_SUCCESS(rv, rv);
 
   rv = statement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
@@ -461,18 +456,16 @@ nsAnnotationService::SetAnnotationInt64I
   nsresult rv = StartSetAnnotation(aURI, aItemId, aName, aFlags, aExpiration,
                                    nsIAnnotationService::TYPE_INT64,
                                    statement);
   NS_ENSURE_SUCCESS(rv, rv);
   mozStorageStatementScoper scoper(statement);
 
   rv = statement->BindInt64ByName(NS_LITERAL_CSTRING("content"), aValue);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = statement->BindNullByName(NS_LITERAL_CSTRING("mime_type"));
-  NS_ENSURE_SUCCESS(rv, rv);
 
   rv = statement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
@@ -533,18 +526,16 @@ nsAnnotationService::SetAnnotationDouble
   nsresult rv = StartSetAnnotation(aURI, aItemId, aName, aFlags, aExpiration,
                                    nsIAnnotationService::TYPE_DOUBLE,
                                    statement);
   NS_ENSURE_SUCCESS(rv, rv);
   mozStorageStatementScoper scoper(statement);
 
   rv = statement->BindDoubleByName(NS_LITERAL_CSTRING("content"), aValue);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = statement->BindNullByName(NS_LITERAL_CSTRING("mime_type"));
-  NS_ENSURE_SUCCESS(rv, rv);
 
   rv = statement->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
@@ -586,99 +577,16 @@ nsAnnotationService::SetItemAnnotationDo
                                             aFlags, aExpiration);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NOTIFY_ANNOS_OBSERVERS(OnItemAnnotationSet(aItemId, aName));
 
   return NS_OK;
 }
 
-
-nsresult
-nsAnnotationService::SetAnnotationBinaryInternal(nsIURI* aURI,
-                                                 int64_t aItemId,
-                                                 const nsACString& aName,
-                                                 const uint8_t* aData,
-                                                 uint32_t aDataLen,
-                                                 const nsACString& aMimeType,
-                                                 int32_t aFlags,
-                                                 uint16_t aExpiration)
-{
-  if (aMimeType.Length() == 0)
-    return NS_ERROR_INVALID_ARG;
-
-  mozStorageTransaction transaction(mDB->MainConn(), false);
-  nsCOMPtr<mozIStorageStatement> statement;
-  nsresult rv = StartSetAnnotation(aURI, aItemId, aName, aFlags, aExpiration,
-                                   nsIAnnotationService::TYPE_BINARY,
-                                   statement);
-  NS_ENSURE_SUCCESS(rv, rv);
-  mozStorageStatementScoper scoper(statement);
-
-  rv = statement->BindBlobByName(NS_LITERAL_CSTRING("content"), aData, aDataLen);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = statement->BindUTF8StringByName(NS_LITERAL_CSTRING("mime_type"), aMimeType);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = transaction.Commit();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsAnnotationService::SetPageAnnotationBinary(nsIURI* aURI,
-                                             const nsACString& aName,
-                                             const uint8_t* aData,
-                                             uint32_t aDataLen,
-                                             const nsACString& aMimeType,
-                                             int32_t aFlags,
-                                             uint16_t aExpiration)
-{
-  NS_ENSURE_ARG(aURI);
-
-  nsresult rv = SetAnnotationBinaryInternal(aURI, 0, aName, aData, aDataLen,
-                                            aMimeType, aFlags, aExpiration);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  NOTIFY_ANNOS_OBSERVERS(OnPageAnnotationSet(aURI, aName));
-
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsAnnotationService::SetItemAnnotationBinary(int64_t aItemId,
-                                             const nsACString& aName,
-                                             const uint8_t* aData,
-                                             uint32_t aDataLen,
-                                             const nsACString& aMimeType,
-                                             int32_t aFlags,
-                                             uint16_t aExpiration)
-{
-  NS_ENSURE_ARG_MIN(aItemId, 1);
-
-  if (aExpiration == EXPIRE_WITH_HISTORY)
-    return NS_ERROR_INVALID_ARG;
-
-  nsresult rv = SetAnnotationBinaryInternal(nullptr, aItemId, aName, aData,
-                                            aDataLen, aMimeType, aFlags,
-                                            aExpiration);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  NOTIFY_ANNOS_OBSERVERS(OnItemAnnotationSet(aItemId, aName));
-
-  return NS_OK;
-}
-
-
 NS_IMETHODIMP
 nsAnnotationService::GetPageAnnotationString(nsIURI* aURI,
                                              const nsACString& aName,
                                              nsAString& _retval)
 {
   NS_ENSURE_ARG(aURI);
 
   nsCOMPtr<mozIStorageStatement> statement;
@@ -742,20 +650,16 @@ nsAnnotationService::GetPageAnnotation(n
     }
     case nsIAnnotationService::TYPE_STRING: {
       nsAutoString valueString;
       rv = statement->GetString(kAnnoIndex_Content, valueString);
       if (NS_SUCCEEDED(rv))
         rv = value->SetAsAString(valueString);
       break;
     }
-    case nsIAnnotationService::TYPE_BINARY: {
-      rv = NS_ERROR_INVALID_ARG;
-      break;
-    }
     default: {
       rv = NS_ERROR_UNEXPECTED;
       break;
     }
   }
 
   if (NS_SUCCEEDED(rv))
     NS_ADDREF(*_retval = value);
@@ -790,20 +694,16 @@ nsAnnotationService::GetItemAnnotation(i
     }
     case nsIAnnotationService::TYPE_STRING: {
       nsAutoString valueString;
       rv = statement->GetString(kAnnoIndex_Content, valueString);
       if (NS_SUCCEEDED(rv))
         rv = value->SetAsAString(valueString);
       break;
     }
-    case nsIAnnotationService::TYPE_BINARY: {
-      rv = NS_ERROR_INVALID_ARG;
-      break;
-    }
     default: {
       rv = NS_ERROR_UNEXPECTED;
       break;
     }
   }
 
   if (NS_SUCCEEDED(rv))
     NS_ADDREF(*_retval = value);
@@ -974,92 +874,35 @@ nsAnnotationService::GetItemAnnotationDo
   ENSURE_ANNO_TYPE(TYPE_DOUBLE, statement);
   *_retval = statement->AsDouble(kAnnoIndex_Content);
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
-nsAnnotationService::GetPageAnnotationBinary(nsIURI* aURI,
-                                             const nsACString& aName,
-                                             uint8_t** _data,
-                                             uint32_t* _dataLen,
-                                             nsACString& _mimeType)
-{
-  NS_ENSURE_ARG(aURI);
-  NS_ENSURE_ARG_POINTER(_data);
-  NS_ENSURE_ARG_POINTER(_dataLen);
-
-  nsCOMPtr<mozIStorageStatement> statement;
-  nsresult rv = StartGetAnnotation(aURI, 0, aName, statement);
-  if (NS_FAILED(rv))
-    return rv;
-
-  mozStorageStatementScoper scoper(statement);
-  ENSURE_ANNO_TYPE(TYPE_BINARY, statement);
-  rv = statement->GetBlob(kAnnoIndex_Content, _dataLen, _data);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = statement->GetUTF8String(kAnnoIndex_MimeType, _mimeType);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsAnnotationService::GetItemAnnotationBinary(int64_t aItemId,
-                                             const nsACString& aName,
-                                             uint8_t** _data,
-                                             uint32_t* _dataLen,
-                                             nsACString& _mimeType)
-{
-  NS_ENSURE_ARG_MIN(aItemId, 1);
-  NS_ENSURE_ARG_POINTER(_data);
-  NS_ENSURE_ARG_POINTER(_dataLen);
-
-  nsCOMPtr<mozIStorageStatement> statement;
-  nsresult rv = StartGetAnnotation(nullptr, aItemId, aName, statement);
-  if (NS_FAILED(rv))
-    return rv;
-
-  mozStorageStatementScoper scoper(statement);
-  ENSURE_ANNO_TYPE(TYPE_BINARY, statement);
-  rv = statement->GetBlob(kAnnoIndex_Content, _dataLen, _data);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = statement->GetUTF8String(kAnnoIndex_MimeType, _mimeType);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-
-NS_IMETHODIMP
 nsAnnotationService::GetPageAnnotationInfo(nsIURI* aURI,
                                            const nsACString& aName,
                                            int32_t* _flags,
                                            uint16_t* _expiration,
-                                           nsACString& _mimeType,
                                            uint16_t* _storageType)
 {
   NS_ENSURE_ARG(aURI);
   NS_ENSURE_ARG_POINTER(_flags);
   NS_ENSURE_ARG_POINTER(_expiration);
   NS_ENSURE_ARG_POINTER(_storageType);
 
   nsCOMPtr<mozIStorageStatement> statement;
   nsresult rv = StartGetAnnotation(aURI, 0, aName, statement);
   if (NS_FAILED(rv))
     return rv;
 
   mozStorageStatementScoper scoper(statement);
   *_flags = statement->AsInt32(kAnnoIndex_Flags);
   *_expiration = (uint16_t)statement->AsInt32(kAnnoIndex_Expiration);
-  rv = statement->GetUTF8String(kAnnoIndex_MimeType, _mimeType);
-  NS_ENSURE_SUCCESS(rv, rv);
   int32_t type = (uint16_t)statement->AsInt32(kAnnoIndex_Type);
   if (type == 0) {
     // For annotations created before explicit typing,
     // we can't determine type, just return as string type.
     *_storageType = nsIAnnotationService::TYPE_STRING;
   }
   else
     *_storageType = type;
@@ -1068,34 +911,31 @@ nsAnnotationService::GetPageAnnotationIn
 }
 
 
 NS_IMETHODIMP
 nsAnnotationService::GetItemAnnotationInfo(int64_t aItemId,
                                            const nsACString& aName,
                                            int32_t* _flags,
                                            uint16_t* _expiration,
-                                           nsACString& _mimeType,
                                            uint16_t* _storageType)
 {
   NS_ENSURE_ARG_MIN(aItemId, 1);
   NS_ENSURE_ARG_POINTER(_flags);
   NS_ENSURE_ARG_POINTER(_expiration);
   NS_ENSURE_ARG_POINTER(_storageType);
 
   nsCOMPtr<mozIStorageStatement> statement;
   nsresult rv = StartGetAnnotation(nullptr, aItemId, aName, statement);
   if (NS_FAILED(rv))
     return rv;
 
   mozStorageStatementScoper scoper(statement);
   *_flags = statement->AsInt32(kAnnoIndex_Flags);
   *_expiration = (uint16_t)statement->AsInt32(kAnnoIndex_Expiration);
-  rv = statement->GetUTF8String(kAnnoIndex_MimeType, _mimeType);
-  NS_ENSURE_SUCCESS(rv, rv);
   int32_t type = (uint16_t)statement->AsInt32(kAnnoIndex_Type);
   if (type == 0) {
     // For annotations created before explicit typing,
     // we can't determine type, just return as string type.
     *_storageType = nsIAnnotationService::TYPE_STRING;
   }
   else {
     *_storageType = type;
@@ -1665,20 +1505,20 @@ nsAnnotationService::CopyPageAnnotations
 
   nsresult rv = URIBinder::Bind(sourceStmt, NS_LITERAL_CSTRING("source_url"), aSourceURI);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = URIBinder::Bind(sourceStmt, NS_LITERAL_CSTRING("dest_url"), aDestURI);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> copyStmt = mDB->GetStatement(
     "INSERT INTO moz_annos "
-    "(place_id, anno_attribute_id, mime_type, content, flags, expiration, "
+    "(place_id, anno_attribute_id, content, flags, expiration, "
      "type, dateAdded, lastModified) "
     "SELECT (SELECT id FROM moz_places WHERE url = :page_url), "
-           "anno_attribute_id, mime_type, content, flags, expiration, type, "
+           "anno_attribute_id, content, flags, expiration, type, "
            ":date, :date "
     "FROM moz_annos "
     "WHERE place_id = :page_id "
     "AND anno_attribute_id = :name_id"
   );
   NS_ENSURE_STATE(copyStmt);
   mozStorageStatementScoper copyScoper(copyStmt);
 
@@ -1746,19 +1586,19 @@ nsAnnotationService::CopyItemAnnotations
 
   nsresult rv = sourceStmt->BindInt64ByName(NS_LITERAL_CSTRING("source_item_id"), aSourceItemId);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = sourceStmt->BindInt64ByName(NS_LITERAL_CSTRING("dest_item_id"), aDestItemId);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> copyStmt = mDB->GetStatement(
       "INSERT OR REPLACE INTO moz_items_annos "
-      "(item_id, anno_attribute_id, mime_type, content, flags, expiration, "
+      "(item_id, anno_attribute_id, content, flags, expiration, "
        "type, dateAdded, lastModified) "
-      "SELECT :dest_item_id, anno_attribute_id, mime_type, content, flags, expiration, "
+      "SELECT :dest_item_id, anno_attribute_id, content, flags, expiration, "
              "type, :date, :date "
       "FROM moz_items_annos "
       "WHERE item_id = :source_item_id "
       "AND anno_attribute_id = :name_id"
   );
   NS_ENSURE_STATE(copyStmt);
   mozStorageStatementScoper copyScoper(copyStmt);
 
@@ -1819,43 +1659,16 @@ nsAnnotationService::RemoveObserver(nsIA
 {
   NS_ENSURE_ARG(aObserver);
 
   if (!mObservers.RemoveObject(aObserver))
     return NS_ERROR_INVALID_ARG;
   return NS_OK;
 }
 
-
-// nsAnnotationService::GetAnnotationURI
-//
-// XXX: does not support item-annotations
-
-NS_IMETHODIMP
-nsAnnotationService::GetAnnotationURI(nsIURI* aURI,
-                                      const nsACString& aName,
-                                      nsIURI** _result)
-{
-  if (aName.IsEmpty())
-    return NS_ERROR_INVALID_ARG;
-
-  nsAutoCString annoSpec;
-  nsresult rv = aURI->GetSpec(annoSpec);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsAutoCString spec;
-  spec.AssignLiteral("moz-anno:");
-  spec += aName;
-  spec += NS_LITERAL_CSTRING(":");
-  spec += annoSpec;
-
-  return NS_NewURI(_result, spec);
-}
-
-
 nsresult
 nsAnnotationService::HasAnnotationInternal(nsIURI* aURI,
                                            int64_t aItemId,
                                            const nsACString& aName,
                                            bool* _hasAnno)
 {
   bool isItemAnnotation = (aItemId > 0);
   nsCOMPtr<mozIStorageStatement> stmt;
@@ -1925,27 +1738,27 @@ nsAnnotationService::StartGetAnnotation(
                                         int64_t aItemId,
                                         const nsACString& aName,
                                         nsCOMPtr<mozIStorageStatement>& aStatement)
 {
   bool isItemAnnotation = (aItemId > 0);
 
   if (isItemAnnotation) {
     aStatement = mDB->GetStatement(
-      "SELECT a.id, a.item_id, :anno_name, a.mime_type, a.content, a.flags, "
+      "SELECT a.id, a.item_id, :anno_name, a.content, a.flags, "
              "a.expiration, a.type "
       "FROM moz_anno_attributes n "
       "JOIN moz_items_annos a ON a.anno_attribute_id = n.id "
       "WHERE a.item_id = :item_id "
       "AND n.name = :anno_name"
     );
   }
   else {
     aStatement = mDB->GetStatement(
-      "SELECT a.id, a.place_id, :anno_name, a.mime_type, a.content, a.flags, "
+      "SELECT a.id, a.place_id, :anno_name, a.content, a.flags, "
              "a.expiration, a.type "
       "FROM moz_anno_attributes n "
       "JOIN moz_annos a ON n.id = a.anno_attribute_id "
       "JOIN moz_places h ON h.id = a.place_id "
       "WHERE h.url = :page_url "
         "AND n.name = :anno_name"
     );
   }
@@ -1972,17 +1785,17 @@ nsAnnotationService::StartGetAnnotation(
   getAnnoScoper.Abandon();
 
   return NS_OK;
 }
 
 
 /**
  * This does most of the setup work needed to set an annotation, except for
- * binding the the actual value and MIME type and executing the statement.
+ * binding the the actual value and executing the statement.
  * It will either update an existing annotation or insert a new one.
  *
  * @note The aStatement RESULT IS NOT ADDREFED.  This is just one of the class
  *       vars, which control its scope.  DO NOT RELEASE.
  *       The caller must take care of resetting the statement if this succeeds.
  */
 nsresult
 nsAnnotationService::StartSetAnnotation(nsIURI* aURI,
@@ -2065,28 +1878,28 @@ nsAnnotationService::StartSetAnnotation(
   int64_t fkId = stmt->AsInt64(0);
   int64_t nameID = stmt->AsInt64(1);
   int64_t oldAnnoId = stmt->AsInt64(2);
   int64_t oldAnnoDate = stmt->AsInt64(3);
 
   if (isItemAnnotation) {
     aStatement = mDB->GetStatement(
       "INSERT OR REPLACE INTO moz_items_annos "
-        "(id, item_id, anno_attribute_id, mime_type, content, flags, "
+        "(id, item_id, anno_attribute_id, content, flags, "
          "expiration, type, dateAdded, lastModified) "
-      "VALUES (:id, :fk, :name_id, :mime_type, :content, :flags, "
+      "VALUES (:id, :fk, :name_id, :content, :flags, "
       ":expiration, :type, :date_added, :last_modified)"
     );
   }
   else {
     aStatement = mDB->GetStatement(
       "INSERT OR REPLACE INTO moz_annos "
-        "(id, place_id, anno_attribute_id, mime_type, content, flags, "
+        "(id, place_id, anno_attribute_id, content, flags, "
          "expiration, type, dateAdded, lastModified) "
-      "VALUES (:id, :fk, :name_id, :mime_type, :content, :flags, "
+      "VALUES (:id, :fk, :name_id, :content, :flags, "
       ":expiration, :type, :date_added, :last_modified)"
     );
   }
   NS_ENSURE_STATE(aStatement);
   mozStorageStatementScoper setAnnoScoper(aStatement);
 
   // Don't replace existing annotations.
   if (oldAnnoId > 0) {
@@ -2101,28 +1914,28 @@ nsAnnotationService::StartSetAnnotation(
     rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("date_added"), PR_Now());
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("fk"), fkId);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("name_id"), nameID);
   NS_ENSURE_SUCCESS(rv, rv);
-  // MimeType and Content will be bound by the caller.
+
   rv = aStatement->BindInt32ByName(NS_LITERAL_CSTRING("flags"), aFlags);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aStatement->BindInt32ByName(NS_LITERAL_CSTRING("expiration"), aExpiration);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aStatement->BindInt32ByName(NS_LITERAL_CSTRING("type"), aType);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aStatement->BindInt64ByName(NS_LITERAL_CSTRING("last_modified"), PR_Now());
   NS_ENSURE_SUCCESS(rv, rv);
 
-  // on success, leave the statement open, the caller will set the value
-  // and MIME type and execute the statement
+  // On success, leave the statement open, the caller will set the value
+  // and execute the statement.
   setAnnoScoper.Abandon();
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIObserver
 
--- a/toolkit/components/places/nsAnnotationService.h
+++ b/toolkit/components/places/nsAnnotationService.h
@@ -87,17 +87,16 @@ protected:
   nsCOMArray<nsIAnnotationObserver> mObservers;
   bool mHasSessionAnnotations;
 
   static nsAnnotationService* gAnnotationService;
 
   static const int kAnnoIndex_ID;
   static const int kAnnoIndex_PageOrItem;
   static const int kAnnoIndex_NameID;
-  static const int kAnnoIndex_MimeType;
   static const int kAnnoIndex_Content;
   static const int kAnnoIndex_Flags;
   static const int kAnnoIndex_Expiration;
   static const int kAnnoIndex_Type;
   static const int kAnnoIndex_DateAdded;
   static const int kAnnoIndex_LastModified;
 
   nsresult HasAnnotationInternal(nsIURI* aURI,
@@ -137,24 +136,16 @@ protected:
                                       int32_t aFlags,
                                       uint16_t aExpiration);
   nsresult SetAnnotationDoubleInternal(nsIURI* aURI,
                                        int64_t aItemId,
                                        const nsACString& aName,
                                        double aValue,
                                        int32_t aFlags,
                                        uint16_t aExpiration);
-  nsresult SetAnnotationBinaryInternal(nsIURI* aURI,
-                                       int64_t aItemId,
-                                       const nsACString& aName,
-                                       const uint8_t* aData,
-                                       uint32_t aDataLen,
-                                       const nsACString& aMimeType,
-                                       int32_t aFlags,
-                                       uint16_t aExpiration);
 
   nsresult RemoveAnnotationInternal(nsIURI* aURI,
                                     int64_t aItemId,
                                     const nsACString& aName);
 
 public:
   nsresult GetPagesWithAnnotationCOMArray(const nsACString& aName,
                                           nsCOMArray<nsIURI>* _results);
--- a/toolkit/components/places/nsIAnnotationService.idl
+++ b/toolkit/components/places/nsIAnnotationService.idl
@@ -27,17 +27,17 @@ interface nsIAnnotationObserver : nsISup
      * annotations are expired (normally happens when the app exits).
      */
     void onPageAnnotationRemoved(in nsIURI aURI,
                                  in AUTF8String aName);
     void onItemAnnotationRemoved(in long long aItemId,
                                  in AUTF8String aName);
 };
 
-[scriptable, uuid(c7f425cc-a063-49ef-9f4c-b08eb2f1730a)]
+[scriptable, uuid(D4CDAAB1-8EEC-47A8-B420-AD7CB333056A)]
 interface nsIAnnotationService : nsISupports
 {
     /**
      * Valid values for aExpiration, which sets the expiration policy for your
      * annotation. The times for the days, weeks and months policies are
      * measured since the last visit date of the page in question. These 
      * will not expire so long as the user keeps visiting the page from time
      * to time.
@@ -75,17 +75,16 @@ interface nsIAnnotationService : nsISupp
     // For short-lived temporary data that you still want to outlast a session.
     // Removed at 7 days.
     const unsigned short EXPIRE_DAYS = 6;
 
     // type constants
     const unsigned short TYPE_INT32  = 1;
     const unsigned short TYPE_DOUBLE = 2;
     const unsigned short TYPE_STRING = 3;
-    const unsigned short TYPE_BINARY = 4;
     const unsigned short TYPE_INT64  = 5;
 
     /**
      * Sets an annotation, overwriting any previous annotation with the same
      * URL/name. IT IS YOUR JOB TO NAMESPACE YOUR ANNOTATION NAMES.
      * Use the form "namespace/value", so your name would be like
      * "bills_extension/page_state" or "history/thumbnail".
      *
@@ -107,19 +106,17 @@ interface nsIAnnotationService : nsISupp
      * annotation.  This will ensure the annotation exists until the item is
      * removed by the user.
      * See EXPIRE_* constants above for further information.
      *
      * The annotation "favicon" is special. Favicons are stored in the favicon
      * service, but are special cased in the protocol handler so they look like
      * annotations. Do not set favicons using this service, it will not work.
      *
-     * Binary annotations should be set using
-     * setItemAnnotationBinary/setPageAnnotationBinary. For other types, only
-     * C++ consumers may use the type-specific methods.
+     * Only C++ consumers may use the type-specific methods.
      *
      * @throws NS_ERROR_ILLEGAL_VALUE if the page or the bookmark doesn't exist.
      */
     void setPageAnnotation(in nsIURI aURI,
                            in AUTF8String aName,
                            in nsIVariant aValue,
                            in long aFlags,
                            in unsigned short aExpiration);
@@ -188,40 +185,21 @@ interface nsIAnnotationService : nsISupp
                                             in double aValue,
                                             in long aFlags,
                                             in unsigned short aExpiration);
     [noscript] void setItemAnnotationDouble(in long long aItemId,
                                             in AUTF8String aName,
                                             in double aValue,
                                             in long aFlags,
                                             in unsigned short aExpiration);
-    /**
-     * Sets an annotation just like setAnnotationString, but takes binary data
-     * as input. You MUST supply a valid MIME type.
-     *
-     * @throws NS_ERROR_ILLEGAL_VALUE if the page or the bookmark doesn't exist.
-     */
-    void setPageAnnotationBinary(in nsIURI aURI, in AUTF8String aName,
-                                 [const,array,size_is(aDataLen)] in octet aData,
-                                 in unsigned long aDataLen,
-                                 in AUTF8String aMimeType,
-                                 in long aFlags,
-                                 in unsigned short aExpiration);
-    void setItemAnnotationBinary(in long long aItemId, in AUTF8String aName,
-                                 [const,array,size_is(aDataLen)] in octet aData,
-                                 in unsigned long aDataLen,
-                                 in AUTF8String aMimeType,
-                                 in long aFlags,
-                                 in unsigned short aExpiration);
 
     /**
      * Retrieves the value of a given annotation. Throws an error if the
-     * annotation does not exist. Throws for binary annotations, for which
-     * getPageAnnotationBinary/getItemAnnotationBinary should be used. C++
-     * consumers may use the type-specific methods.
+     * annotation does not exist. C++ consumers may use the type-specific
+     * methods.
      *
      * The type-specific methods throw if the given annotation is set in
      * a different type.
      */
     nsIVariant getPageAnnotation(in nsIURI aURI,
                                  in AUTF8String aName);
     nsIVariant getItemAnnotation(in long long aItemId,
                                  in AUTF8String aName);
@@ -254,52 +232,34 @@ interface nsIAnnotationService : nsISupp
      * @see getPageAnnotation
      */
     [noscript] double getPageAnnotationDouble(in nsIURI aURI,
                                               in AUTF8String aName);
     [noscript] double getItemAnnotationDouble(in long long aItemId,
                                               in AUTF8String aName);
 
     /**
-     * @see getPageAnnotation. This also returns the
-     * MIME type.
-     */
-    void getPageAnnotationBinary(in nsIURI aURI,
-                                 in AUTF8String aName,
-                                 [array,size_is(aDataLen)] out octet aData,
-                                 out unsigned long aDataLen,
-                                 out AUTF8String aMimeType);
-    void getItemAnnotationBinary(in long long aItemId,
-                                 in AUTF8String aName,
-                                 [array,size_is(aDataLen)] out octet aData,
-                                 out unsigned long aDataLen,
-                                 out AUTF8String aMimeType);
-
-    /**
-     * Retrieves info about an existing annotation. aMimeType will be empty
-     * if the value was not binary data.
+     * Retrieves info about an existing annotation.
      *
      * aType will be one of TYPE_* constansts above
      *
      * example JS:
-     *   var flags = {}, exp = {}, mimeType = {};
-     *   annotator.getAnnotationInfo(myURI, "foo", flags, exp, mimeType);
+     *   var flags = {}, exp = {}, type = {};
+     *   annotator.getAnnotationInfo(myURI, "foo", flags, exp, type);
      *   // now you can use 'exp.value' and 'flags.value'
      */
     void getPageAnnotationInfo(in nsIURI aURI,
                                in AUTF8String aName,
                                out int32_t aFlags,
                                out unsigned short aExpiration,
-                               out AUTF8String aMimeType,
                                out unsigned short aType);
     void getItemAnnotationInfo(in long long aItemId,
                                in AUTF8String aName,
                                out long aFlags,
                                out unsigned short aExpiration,
-                               out AUTF8String aMimeType,
                                out unsigned short aType);
 
     /**
      * Retrieves the type of an existing annotation
      * Use getAnnotationInfo if you need this along with the mime-type etc.
      *
      * @param aURI
      *        the uri on which the annotation is set
@@ -326,17 +286,16 @@ interface nsIAnnotationService : nsISupp
       [retval, array, size_is(resultCount)] out long long results);
 
     /**
      * Returns a list of mozIAnnotation(s), having a given annotation name.
      *
      * @param name
      *        The annotation to search for.
      * @return list of mozIAnnotation objects.
-     * @note binary annotations are not supported and thus skipped.
      */
     void getAnnotationsWithName(
         in AUTF8String name,
         [optional] out unsigned long count,
         [retval, array, size_is(count)] out mozIAnnotatedResult results);
 
     /**
      * Get the names of all annotations for this URI.
@@ -400,26 +359,16 @@ interface nsIAnnotationService : nsISupp
      */
     void addObserver(in nsIAnnotationObserver aObserver);
 
 
     /**
      * Removes an annotaton observer previously registered by addObserver.
      */
     void removeObserver(in nsIAnnotationObserver aObserver);
-
-    /**
-     * Returns a URI that can be used to access the given binary annotation.
-     * This function does NOT check that the annotation exists. Also, note that
-     * you can only load URIs for annotations that have have a valid MIME type
-     * set by setAnnotationBinary. No non-URI valid chars in name, especially
-     * colon, which will mess up parsing.
-     */
-    nsIURI getAnnotationURI(in nsIURI aURI,
-                            in AUTF8String aName);
 };
 
 /**
  * Represents a place annotated with a given annotation.  If a place has
  * multiple annotations, it can be represented by multiple
  * mozIAnnotatedResult(s).
  */
 [scriptable, uuid(81fd0188-db6a-492e-80b6-f6414913b396)]
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -1141,42 +1141,39 @@ int32_t nsNavHistoryContainerResultNode:
             NS_ENSURE_SUCCESS(annosvc->METHOD_ITEM(b->mItemId, annoName,      \
                                                    B_VAL), 0);                \
           } else {                                                            \
             NS_ENSURE_SUCCESS(annosvc->METHOD_PAGE(b_uri, annoName,           \
                                                    B_VAL), 0);                \
           }                                                                   \
         }
 
-    // Surprising as it is, we don't support sorting by a binary annotation
-    if (annoType != nsIAnnotationService::TYPE_BINARY) {
-      if (annoType == nsIAnnotationService::TYPE_STRING) {
-        nsAutoString a_val, b_val;
-        GET_ANNOTATIONS_VALUES(GetItemAnnotationString,
-                               GetPageAnnotationString, a_val, b_val);
-        value = SortComparison_StringLess(a_val, b_val);
-      }
-      else if (annoType == nsIAnnotationService::TYPE_INT32) {
-        int32_t a_val = 0, b_val = 0;
-        GET_ANNOTATIONS_VALUES(GetItemAnnotationInt32,
-                               GetPageAnnotationInt32, &a_val, &b_val);
-        value = (a_val < b_val) ? -1 : (a_val > b_val) ? 1 : 0;
-      }
-      else if (annoType == nsIAnnotationService::TYPE_INT64) {
-        int64_t a_val = 0, b_val = 0;
-        GET_ANNOTATIONS_VALUES(GetItemAnnotationInt64,
-                               GetPageAnnotationInt64, &a_val, &b_val);
-        value = (a_val < b_val) ? -1 : (a_val > b_val) ? 1 : 0;
-      }
-      else if (annoType == nsIAnnotationService::TYPE_DOUBLE) {
-        double a_val = 0, b_val = 0;
-        GET_ANNOTATIONS_VALUES(GetItemAnnotationDouble,
-                               GetPageAnnotationDouble, &a_val, &b_val);
-        value = (a_val < b_val) ? -1 : (a_val > b_val) ? 1 : 0;
-      }
+    if (annoType == nsIAnnotationService::TYPE_STRING) {
+      nsAutoString a_val, b_val;
+      GET_ANNOTATIONS_VALUES(GetItemAnnotationString,
+                             GetPageAnnotationString, a_val, b_val);
+      value = SortComparison_StringLess(a_val, b_val);
+    }
+    else if (annoType == nsIAnnotationService::TYPE_INT32) {
+      int32_t a_val = 0, b_val = 0;
+      GET_ANNOTATIONS_VALUES(GetItemAnnotationInt32,
+                             GetPageAnnotationInt32, &a_val, &b_val);
+      value = (a_val < b_val) ? -1 : (a_val > b_val) ? 1 : 0;
+    }
+    else if (annoType == nsIAnnotationService::TYPE_INT64) {
+      int64_t a_val = 0, b_val = 0;
+      GET_ANNOTATIONS_VALUES(GetItemAnnotationInt64,
+                             GetPageAnnotationInt64, &a_val, &b_val);
+      value = (a_val < b_val) ? -1 : (a_val > b_val) ? 1 : 0;
+    }
+    else if (annoType == nsIAnnotationService::TYPE_DOUBLE) {
+      double a_val = 0, b_val = 0;
+      GET_ANNOTATIONS_VALUES(GetItemAnnotationDouble,
+                             GetPageAnnotationDouble, &a_val, &b_val);
+      value = (a_val < b_val) ? -1 : (a_val > b_val) ? 1 : 0;
     }
   }
 
   // Note we also fall back to the title-sorting route one of the items didn't
   // have the annotation set or if both had it set but in a different storage
   // type
   if (value == 0)
     return SortComparison_TitleLess(a, b, nullptr);
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -143,46 +143,16 @@ function task_populateDB(aArray)
               PlacesUtils.annotations.setItemAnnotation(qdata.itemId,
                                                         qdata.annoName,
                                                         qdata.annoVal,
                                                         qdata.annoFlags,
                                                         qdata.annoExpiration);
             }
           }
 
-          if (qdata.isPageBinaryAnnotation) {
-            if (qdata.removeAnnotation)
-              PlacesUtils.annotations.removePageAnnotation(uri(qdata.uri),
-                                                           qdata.annoName);
-            else {
-              PlacesUtils.annotations.setPageAnnotationBinary(uri(qdata.uri),
-                                                              qdata.annoName,
-                                                              qdata.binarydata,
-                                                              qdata.binaryDataLength,
-                                                              qdata.annoMimeType,
-                                                              qdata.annoFlags,
-                                                              qdata.annoExpiration);
-            }
-          }
-
-          if (qdata.isItemBinaryAnnotation) {
-            if (qdata.removeAnnotation)
-              PlacesUtils.annotations.removeItemAnnotation(qdata.itemId,
-                                                           qdata.annoName);
-            else {
-              PlacesUtils.annotations.setItemAnnotationBinary(qdata.itemId,
-                                                              qdata.annoName,
-                                                              qdata.binaryData,
-                                                              qdata.binaryDataLength,
-                                                              qdata.annoMimeType,
-                                                              qdata.annoFlags,
-                                                              qdata.annoExpiration);
-            }
-          }
-
           if (qdata.isFolder) {
             let folderId = PlacesUtils.bookmarks.createFolder(qdata.parentFolder,
                                                               qdata.title,
                                                               qdata.index);
             if (qdata.readOnly)
               PlacesUtils.bookmarks.setFolderReadonly(folderId, true);
           }
 
@@ -257,22 +227,16 @@ function queryData(obj) {
   this.isPageAnnotation = obj.isPageAnnotation ? obj.isPageAnnotation : false;
   this.removeAnnotation= obj.removeAnnotation ? true : false;
   this.annoName = obj.annoName ? obj.annoName : "";
   this.annoVal = obj.annoVal ? obj.annoVal : "";
   this.annoFlags = obj.annoFlags ? obj.annoFlags : 0;
   this.annoExpiration = obj.annoExpiration ? obj.annoExpiration : 0;
   this.isItemAnnotation = obj.isItemAnnotation ? obj.isItemAnnotation : false;
   this.itemId = obj.itemId ? obj.itemId : 0;
-  this.isPageBinaryAnnotation = obj.isPageBinaryAnnotation ?
-                                obj.isPageBinaryAnnotation : false;
-  this.isItemBinaryAnnotation = obj.isItemBinaryAnnotation ?
-                                obj.isItemBinaryAnnotation : false;
-  this.binaryData = obj.binaryData ? obj.binaryData : null;
-  this.binaryDataLength = obj.binaryDataLength ? obj.binaryDataLength : 0;
   this.annoMimeType = obj.annoMimeType ? obj.annoMimeType : "";
   this.isTag = obj.isTag ? obj.isTag : false;
   this.tagArray = obj.tagArray ? obj.tagArray : null;
   this.isLivemark = obj.isLivemark ? obj.isLivemark : false;
   this.parentFolder = obj.parentFolder ? obj.parentFolder
                                        : PlacesUtils.placesRootId;
   this.feedURI = obj.feedURI ? obj.feedURI : "";
   this.index = obj.index ? obj.index : PlacesUtils.bookmarks.DEFAULT_INDEX;
--- a/toolkit/components/places/tests/unit/test_annotations.js
+++ b/toolkit/components/places/tests/unit/test_annotations.js
@@ -58,31 +58,29 @@ function run_test()
 add_task(function test_execute()
 {
   var testURI = uri("http://mozilla.com/");
   var testItemId = bmsvc.insertBookmark(bmsvc.bookmarksMenuFolder, testURI, -1, "");
   var testAnnoName = "moz-test-places/annotations";
   var testAnnoVal = "test";
 
   annosvc.addObserver(annoObserver);
-
   // create new string annotation
   try {
     annosvc.setPageAnnotation(testURI, testAnnoName, testAnnoVal, 0, 0);
   } catch(ex) {
     do_throw("unable to add page-annotation");
   }
   do_check_eq(annoObserver.PAGE_lastSet_URI, testURI.spec);
   do_check_eq(annoObserver.PAGE_lastSet_AnnoName, testAnnoName);
 
   // get string annotation
   do_check_true(annosvc.pageHasAnnotation(testURI, testAnnoName));
   var storedAnnoVal = annosvc.getPageAnnotation(testURI, testAnnoName);
   do_check_true(testAnnoVal === storedAnnoVal);
-
   // string item-annotation
   try {
     var lastModified = bmsvc.getItemLastModified(testItemId);
     // Verify that lastModified equals dateAdded before we set the annotation.
     do_check_eq(lastModified, bmsvc.getItemDateAdded(testItemId));
     // Workaround possible VM timers issues moving last modified to the past.
     bmsvc.setItemLastModified(testItemId, --lastModified);
     annosvc.setItemAnnotation(testItemId, testAnnoName, testAnnoVal, 0, 0);
@@ -130,26 +128,24 @@ add_task(function test_execute()
     do_throw("fetching page-annotation that doesn't exist, should've thrown");
   } catch(ex) {}
   try {
     annosvc.getItemAnnotation(testURI, "blah");
     do_throw("fetching item-annotation that doesn't exist, should've thrown");
   } catch(ex) {}
 
   // get annotation info
-  var flags = {}, exp = {}, mimeType = {}, storageType = {};
-  annosvc.getPageAnnotationInfo(testURI, testAnnoName, flags, exp, mimeType, storageType);
+  var flags = {}, exp = {}, storageType = {};
+  annosvc.getPageAnnotationInfo(testURI, testAnnoName, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   do_check_eq(storageType.value, Ci.nsIAnnotationService.TYPE_STRING);
-  annosvc.getItemAnnotationInfo(testItemId, testAnnoName, flags, exp, mimeType, storageType);
+  annosvc.getItemAnnotationInfo(testItemId, testAnnoName, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   do_check_eq(storageType.value, Ci.nsIAnnotationService.TYPE_STRING);
 
   // get annotation names for a uri
   var annoNames = annosvc.getPageAnnotationNames(testURI);
   do_check_eq(annoNames.length, 1);
   do_check_eq(annoNames[0], "moz-test-places/annotations");
 
   // get annotation names for an item
@@ -210,112 +206,66 @@ add_task(function test_execute()
   do_check_true(annosvc.itemHasAnnotation(newItemId, copiedAnno));
   do_check_eq(annosvc.getItemAnnotation(newItemId, "oldAnno"), "new");
 
   // test int32 anno type
   var int32Key = testAnnoName + "/types/Int32";
   var int32Val = 23;
   annosvc.setPageAnnotation(testURI, int32Key, int32Val, 0, 0);
   do_check_true(annosvc.pageHasAnnotation(testURI, int32Key));
-  var flags = {}, exp = {}, mimeType = {}, storageType = {};
-  annosvc.getPageAnnotationInfo(testURI, int32Key, flags, exp, mimeType,
-                                storageType);
+  var flags = {}, exp = {}, storageType = {};
+  annosvc.getPageAnnotationInfo(testURI, int32Key, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   do_check_eq(storageType.value, Ci.nsIAnnotationService.TYPE_INT32);
   var storedVal = annosvc.getPageAnnotation(testURI, int32Key);
   do_check_true(int32Val === storedVal);
   annosvc.setItemAnnotation(testItemId, int32Key, int32Val, 0, 0);
   do_check_true(annosvc.itemHasAnnotation(testItemId, int32Key));
-  annosvc.getItemAnnotationInfo(testItemId, int32Key, flags, exp, mimeType,
-                                storageType);
+  annosvc.getItemAnnotationInfo(testItemId, int32Key, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   storedVal = annosvc.getItemAnnotation(testItemId, int32Key);
   do_check_true(int32Val === storedVal);
 
   // test int64 anno type
   var int64Key = testAnnoName + "/types/Int64";
   var int64Val = 4294967296;
   annosvc.setPageAnnotation(testURI, int64Key, int64Val, 0, 0);
-  annosvc.getPageAnnotationInfo(testURI, int64Key, flags, exp, mimeType, storageType);
+  annosvc.getPageAnnotationInfo(testURI, int64Key, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   storedVal = annosvc.getPageAnnotation(testURI, int64Key);
   do_check_true(int64Val === storedVal);
   annosvc.setItemAnnotation(testItemId, int64Key, int64Val, 0, 0);
   do_check_true(annosvc.itemHasAnnotation(testItemId, int64Key));
-  annosvc.getItemAnnotationInfo(testItemId, int64Key, flags, exp, mimeType,
-                                storageType);
+  annosvc.getItemAnnotationInfo(testItemId, int64Key, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   storedVal = annosvc.getItemAnnotation(testItemId, int64Key);
   do_check_true(int64Val === storedVal);
 
   // test double anno type
   var doubleKey = testAnnoName + "/types/Double";
   var doubleVal = 0.000002342;
   annosvc.setPageAnnotation(testURI, doubleKey, doubleVal, 0, 0);
-  annosvc.getPageAnnotationInfo(testURI, doubleKey, flags, exp, mimeType, storageType);
+  annosvc.getPageAnnotationInfo(testURI, doubleKey, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   storedVal = annosvc.getPageAnnotation(testURI, doubleKey);
   do_check_true(doubleVal === storedVal);
   annosvc.setItemAnnotation(testItemId, doubleKey, doubleVal, 0, 0);
   do_check_true(annosvc.itemHasAnnotation(testItemId, doubleKey));
-  annosvc.getItemAnnotationInfo(testItemId, doubleKey, flags, exp, mimeType,
-                                storageType);
+  annosvc.getItemAnnotationInfo(testItemId, doubleKey, flags, exp, storageType);
   do_check_eq(flags.value, 0);
   do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, null);
   do_check_eq(storageType.value, Ci.nsIAnnotationService.TYPE_DOUBLE);
   storedVal = annosvc.getItemAnnotation(testItemId, doubleKey);
   do_check_true(doubleVal === storedVal);
 
-  // test binary anno type
-  var binaryKey = testAnnoName + "/types/Binary";
-  var binaryVal = Array.prototype.map.call("splarg", function(x) { return x.charCodeAt(0); });
-  annosvc.setPageAnnotationBinary(testURI, binaryKey, binaryVal, binaryVal.length, "text/plain", 0, 0);
-  annosvc.getPageAnnotationInfo(testURI, binaryKey, flags, exp, mimeType, storageType);
-  do_check_eq(flags.value, 0);
-  do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, "text/plain");
-  do_check_eq(storageType.value, Ci.nsIAnnotationService.TYPE_BINARY);
-  var data = {}, length = {};
-  annosvc.getPageAnnotationBinary(testURI, binaryKey, data, length, mimeType);
-  do_check_eq(binaryVal.toString(), data.value.toString());
-  do_check_eq(typeof data.value, "object");
-  annosvc.setItemAnnotationBinary(testItemId, binaryKey, binaryVal,
-                                  binaryVal.length, "text/plain", 0, 0);
-  annosvc.getItemAnnotationInfo(testItemId, binaryKey, flags, exp, mimeType,
-                                storageType);
-  do_check_eq(flags.value, 0);
-  do_check_eq(exp.value, 0);
-  do_check_eq(mimeType.value, "text/plain");
-  do_check_eq(storageType.value, Ci.nsIAnnotationService.TYPE_BINARY);
-  annosvc.getItemAnnotationBinary(testItemId, binaryKey, data, length,
-                                  mimeType);
-  do_check_eq(binaryVal.toString(), data.value.toString());
-  do_check_eq(typeof data.value, "object");
-
-  // test that binary-accessors throw for wrong types
-  try {
-    var data = {}, length = {}, mimeType = {};
-    annosvc.getPageAnnotationBinary(testURI, int32Key, data, length, mimeType);
-    do_throw("page-annotation binary accessor didn't throw for a wrong type!");
-    annosvc.getItemAnnotationBinary(testItemId, int32Key, data, length,
-                                    mimeType);
-    do_throw("item-annotation binary accessor didn't throw for a wrong type!");
-  } catch(ex) {}
-
   // test annotation removal
   annosvc.removePageAnnotation(testURI, int32Key);
 
   annosvc.setItemAnnotation(testItemId, testAnnoName, testAnnoVal, 0, 0);
   // verify that removing an annotation updates the last modified date
   var lastModified3 = bmsvc.getItemLastModified(testItemId);
   // Workaround possible VM timers issues moving last modified to the past.
   bmsvc.setItemLastModified(testItemId, --lastModified3);
--- a/toolkit/components/places/tests/unit/test_utils_setAnnotationsFor.js
+++ b/toolkit/components/places/tests/unit/test_utils_setAnnotationsFor.js
@@ -17,29 +17,30 @@ const TEST_URL = "http://test.mozilla.or
 function run_test() {
   var testURI = uri(TEST_URL);
   // add a bookmark
   var itemId = bs.insertBookmark(bs.unfiledBookmarksFolder, testURI,
                                  bs.DEFAULT_INDEX, "test");
 
   // create annotations array
   var testAnnos = [{ name: "testAnno/test0",
-                     type: Ci.nsIAnnotationService.TYPE_STRING,
                      flags: 0,
                      value: "test0",
                      expires: Ci.nsIAnnotationService.EXPIRE_NEVER },
                    { name: "testAnno/test1",
-                     type: Ci.nsIAnnotationService.TYPE_STRING,
                      flags: 0,
                      value: "test1",
                      expires: Ci.nsIAnnotationService.EXPIRE_NEVER },
                    { name: "testAnno/test2",
-                     type: Ci.nsIAnnotationService.TYPE_STRING,
                      flags: 0,
                      value: "test2",
+                     expires: Ci.nsIAnnotationService.EXPIRE_NEVER },
+                   { name: "testAnno/test3",
+                     flags: 0,
+                     value: 0,
                      expires: Ci.nsIAnnotationService.EXPIRE_NEVER }];
 
   // Add item annotations
   PlacesUtils.setAnnotationsForItem(itemId, testAnnos);
   // Check for correct addition
   testAnnos.forEach(function(anno) {
     do_check_true(as.itemHasAnnotation(itemId, anno.name));
     do_check_eq(as.getItemAnnotation(itemId, anno.name), anno.value);
@@ -48,18 +49,22 @@ function run_test() {
   // Add page annotations
   PlacesUtils.setAnnotationsForURI(testURI, testAnnos);
   // Check for correct addition
   testAnnos.forEach(function(anno) {
     do_check_true(as.pageHasAnnotation(testURI, anno.name));
     do_check_eq(as.getPageAnnotation(testURI, anno.name), anno.value);
   });
 
-  // To unset annotations we set their values to null
-  testAnnos.forEach(function(anno) { anno.value = null; });
+  // To unset annotations we unset their values or set them to
+  //null/undefined
+  testAnnos[0].value = null;
+  testAnnos[1].value = undefined;
+  delete testAnnos[2].value;
+  delete testAnnos[3].value;
 
   // Unset all item annotations
   PlacesUtils.setAnnotationsForItem(itemId, testAnnos);
   // Check for correct removal
   testAnnos.forEach(function(anno) {
     do_check_false(as.itemHasAnnotation(itemId, anno.name));
     // sanity: page annotations should not be removed here
     do_check_true(as.pageHasAnnotation(testURI, anno.name));