Bug 699844 - Remove the Bookmarks annotations service API. r=mak
authorMark Banner <standard8@mozilla.com>
Mon, 26 Oct 2020 12:32:55 +0000
changeset 554492 61283442e9fe37fa0595c4b9f17f00182d69a421
parent 554491 413a70305cc689eb203f9bfb461a15415aea075c
child 554493 3c57cdfde03a63d2716267a70f439759f90abc02
push id37894
push userdluca@mozilla.com
push dateTue, 27 Oct 2020 04:41:26 +0000
treeherdermozilla-central@46a0e993f8bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs699844
milestone84.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 699844 - Remove the Bookmarks annotations service API. r=mak Differential Revision: https://phabricator.services.mozilla.com/D93315
toolkit/components/build/nsToolkitCompsCID.h
toolkit/components/places/History.jsm
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/components.conf
toolkit/components/places/moz.build
toolkit/components/places/nsAnnotationService.cpp
toolkit/components/places/nsAnnotationService.h
toolkit/components/places/nsIAnnotationService.idl
toolkit/components/places/nsNavBookmarks.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
toolkit/components/places/tests/expiration/test_annos_expire_never.js
toolkit/components/places/tests/expiration/test_clearHistory.js
toolkit/components/places/tests/head_common.js
toolkit/components/places/tests/history/test_update.js
toolkit/components/places/tests/maintenance/test_preventive_maintenance.js
toolkit/components/places/tests/queries/head_queries.js
toolkit/components/places/tests/unit/test_annotations.js
toolkit/components/places/tests/unit/test_telemetry.js
toolkit/components/places/tests/unit/xpcshell.ini
--- a/toolkit/components/build/nsToolkitCompsCID.h
+++ b/toolkit/components/build/nsToolkitCompsCID.h
@@ -26,19 +26,16 @@
   "@mozilla.org/autocomplete/search;1?name=form-history"
 
 #define NS_URLCLASSIFIERHASHCOMPLETER_CONTRACTID \
   "@mozilla.org/url-classifier/hashcompleter;1"
 
 #define NS_NAVHISTORYSERVICE_CONTRACTID \
   "@mozilla.org/browser/nav-history-service;1"
 
-#define NS_ANNOTATIONSERVICE_CONTRACTID \
-  "@mozilla.org/browser/annotation-service;1"
-
 #define NS_NAVBOOKMARKSSERVICE_CONTRACTID \
   "@mozilla.org/browser/nav-bookmarks-service;1"
 
 #define NS_TAGGINGSERVICE_CONTRACTID "@mozilla.org/browser/tagging-service;1"
 
 #define NS_FAVICONSERVICE_CONTRACTID "@mozilla.org/browser/favicon-service;1"
 
 #define NS_KEY_VALUE_SERVICE_CONTRACTID "@mozilla.org/key-value-service;1"
@@ -86,23 +83,16 @@
 
 #define NS_NAVHISTORYRESULTTREEVIEWER_CID            \
   {                                                  \
     0x2ea8966f, 0x0671, 0x4c02, {                    \
       0x9c, 0x70, 0x94, 0x59, 0x56, 0xd4, 0x54, 0x34 \
     }                                                \
   }
 
-#define NS_ANNOTATIONSERVICE_CID                     \
-  {                                                  \
-    0x5e8d4751, 0x1852, 0x434b, {                    \
-      0xa9, 0x92, 0x2c, 0x6d, 0x2a, 0x25, 0xfa, 0x46 \
-    }                                                \
-  }
-
 #define NS_NAVBOOKMARKSSERVICE_CID                   \
   {                                                  \
     0x9de95a0c, 0x39a4, 0x4d64, {                    \
       0x9a, 0x53, 0x17, 0x94, 0x0d, 0xd7, 0xca, 0xbb \
     }                                                \
   }
 
 #define NS_FAVICONSERVICE_CID                        \
--- a/toolkit/components/places/History.jsm
+++ b/toolkit/components/places/History.jsm
@@ -119,16 +119,21 @@ function notify(observers, notification,
   for (let observer of observers) {
     try {
       observer[notification](...args);
     } catch (ex) {}
   }
 }
 
 var History = Object.freeze({
+  ANNOTATION_EXPIRE_NEVER: 4,
+  // Constants for the type of annotation.
+  ANNOTATION_TYPE_STRING: 3,
+  ANNOTATION_TYPE_INT64: 5,
+
   /**
    * Fetch the available information for one page.
    *
    * @param guidOrURI: (string) or (URL, nsIURI or href)
    *      Either the full URI of the page or the GUID of the page.
    * @param [optional] options (object)
    *      An optional object whose properties describe options:
    *        - `includeVisits` (boolean) set this to true if `visits` in the
@@ -1680,18 +1685,18 @@ var update = async function(db, pageInfo
         );
 
         for (let anno of annosToUpdate) {
           let content = pageInfo.annotations.get(anno);
           // TODO: We only really need to save the type whilst we still support
           // accessing page annotations via the annotation service.
           let type =
             typeof content == "string"
-              ? Ci.nsIAnnotationService.TYPE_STRING
-              : Ci.nsIAnnotationService.TYPE_INT64;
+              ? History.ANNOTATION_TYPE_STRING
+              : History.ANNOTATION_TYPE_INT64;
           let date = PlacesUtils.toPRTime(new Date());
 
           // This will replace the id every time an annotation is updated. This is
           // not currently an issue as we're not joining on the id field.
           await db.execute(
             `
             INSERT OR REPLACE INTO moz_annos
               (place_id, anno_attribute_id, content, flags,
@@ -1700,17 +1705,17 @@ var update = async function(db, pageInfo
                     (SELECT id FROM moz_anno_attributes WHERE name = :anno_name),
                     :content, 0, :expiration, :type, :date_added,
                     :last_modified)
           `,
             {
               id,
               anno_name: anno,
               content,
-              expiration: PlacesUtils.annotations.EXPIRE_NEVER,
+              expiration: History.ANNOTATION_EXPIRE_NEVER,
               type,
               // The date fields are unused, so we just set them both to the latest.
               date_added: date,
               last_modified: date,
             }
           );
         }
       }
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1973,23 +1973,16 @@ XPCOMUtils.defineLazyGetter(PlacesUtils,
       get: (target, name) =>
         Bookmarks.hasOwnProperty(name) ? Bookmarks[name] : bmsvc[name],
     })
   );
 });
 
 XPCOMUtils.defineLazyServiceGetter(
   PlacesUtils,
-  "annotations",
-  "@mozilla.org/browser/annotation-service;1",
-  "nsIAnnotationService"
-);
-
-XPCOMUtils.defineLazyServiceGetter(
-  PlacesUtils,
   "tagging",
   "@mozilla.org/browser/tagging-service;1",
   "nsITaggingService"
 );
 
 XPCOMUtils.defineLazyGetter(this, "bundle", function() {
   const PLACES_STRING_BUNDLE_URI = "chrome://places/locale/places.properties";
   return Services.strings.createBundle(PLACES_STRING_BUNDLE_URI);
--- a/toolkit/components/places/components.conf
+++ b/toolkit/components/places/components.conf
@@ -15,24 +15,16 @@ Classes = [
     },
     {
         'cid': '{e8b8bdb7-c96c-4d82-9c6f-2b3c585ec7ea}',
         'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-anno'],
         'type': 'nsAnnoProtocolHandler',
         'headers': ['/toolkit/components/places/nsAnnoProtocolHandler.h'],
     },
     {
-        'cid': '{5e8d4751-1852-434b-a992-2c6d2a25fa46}',
-        'contract_ids': ['@mozilla.org/browser/annotation-service;1'],
-        'singleton': True,
-        'type': 'nsAnnotationService',
-        'headers': ['/toolkit/components/places/nsAnnotationService.h'],
-        'constructor': 'nsAnnotationService::GetSingleton',
-    },
-    {
         'cid': '{984e3259-9266-49cf-b605-60b022a00756}',
         'contract_ids': ['@mozilla.org/browser/favicon-service;1'],
         'singleton': True,
         'type': 'nsFaviconService',
         'headers': ['/toolkit/components/places/nsFaviconService.h'],
         'constructor': 'nsFaviconService::GetSingleton',
     },
     {
--- a/toolkit/components/places/moz.build
+++ b/toolkit/components/places/moz.build
@@ -14,17 +14,16 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'places'
 
 if CONFIG['MOZ_PLACES']:
     XPIDL_SOURCES += [
         'mozIAsyncHistory.idl',
         'mozIPlacesAutoComplete.idl',
         'mozIPlacesPendingOperation.idl',
         'mozISyncedBookmarksMirror.idl',
-        'nsIAnnotationService.idl',
         'nsIFaviconService.idl',
         'nsINavBookmarksService.idl',
         'nsITaggingService.idl',
     ]
 
     EXPORTS.mozilla.places = [
         'Database.h',
         'History.h',
@@ -35,17 +34,16 @@ if CONFIG['MOZ_PLACES']:
     ]
 
     UNIFIED_SOURCES += [
         'Database.cpp',
         'FaviconHelpers.cpp',
         'Helpers.cpp',
         'History.cpp',
         'nsAnnoProtocolHandler.cpp',
-        'nsAnnotationService.cpp',
         'nsFaviconService.cpp',
         'nsNavBookmarks.cpp',
         'nsNavHistory.cpp',
         'nsNavHistoryQuery.cpp',
         'nsNavHistoryResult.cpp',
         'PageIconProtocolHandler.cpp',
         'PlaceInfo.cpp',
         'Shutdown.cpp',
deleted file mode 100644
--- a/toolkit/components/places/nsAnnotationService.cpp
+++ /dev/null
@@ -1,552 +0,0 @@
-/* -*- 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/. */
-
-#include "mozilla/ArrayUtils.h"
-
-#include "nsAnnotationService.h"
-#include "nsNavHistory.h"
-#include "nsPlacesTables.h"
-#include "nsPlacesIndexes.h"
-#include "nsPlacesMacros.h"
-#include "Helpers.h"
-
-#include "nsNetUtil.h"
-#include "nsIVariant.h"
-#include "nsString.h"
-#include "nsVariant.h"
-#include "mozilla/storage.h"
-
-#include "GeckoProfiler.h"
-
-#include "nsNetCID.h"
-
-using namespace mozilla;
-using namespace mozilla::places;
-
-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_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;
-
-PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsAnnotationService, gAnnotationService)
-
-NS_IMPL_ISUPPORTS(nsAnnotationService, nsIAnnotationService,
-                  nsISupportsWeakReference)
-
-nsAnnotationService::nsAnnotationService() {
-  NS_ASSERTION(!gAnnotationService,
-               "Attempting to create two instances of the service!");
-  gAnnotationService = this;
-}
-
-nsAnnotationService::~nsAnnotationService() {
-  NS_ASSERTION(gAnnotationService == this,
-               "Deleting a non-singleton instance of the service");
-  if (gAnnotationService == this) gAnnotationService = nullptr;
-}
-
-nsresult nsAnnotationService::Init() {
-  mDB = Database::GetDatabase();
-  NS_ENSURE_STATE(mDB);
-
-  return NS_OK;
-}
-
-nsresult nsAnnotationService::SetAnnotationStringInternal(
-    int64_t aItemId, BookmarkData* aBookmark, const nsACString& aName,
-    const nsAString& aValue, int32_t aFlags, uint16_t aExpiration) {
-  mozStorageTransaction transaction(mDB->MainConn(), false);
-  nsCOMPtr<mozIStorageStatement> statement;
-
-  nsresult rv =
-      StartSetAnnotation(aItemId, aBookmark, aName, aFlags, aExpiration,
-                         nsIAnnotationService::TYPE_STRING, statement);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mozStorageStatementScoper scoper(statement);
-
-  rv = statement->BindStringByName("content"_ns, aValue);
-  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::SetItemAnnotation(int64_t aItemId, const nsACString& aName,
-                                       nsIVariant* aValue, int32_t aFlags,
-                                       uint16_t aExpiration, uint16_t aSource,
-                                       bool aDontUpdateLastModified) {
-  AUTO_PROFILER_LABEL("nsAnnotationService::SetItemAnnotation", OTHER);
-
-  NS_ENSURE_ARG_MIN(aItemId, 1);
-  NS_ENSURE_ARG(aValue);
-
-  uint16_t dataType = aValue->GetDataType();
-  BookmarkData bookmark;
-
-  switch (dataType) {
-    case nsIDataType::VTYPE_INT8:
-    case nsIDataType::VTYPE_UINT8:
-    case nsIDataType::VTYPE_INT16:
-    case nsIDataType::VTYPE_UINT16:
-    case nsIDataType::VTYPE_INT32:
-    case nsIDataType::VTYPE_UINT32:
-    case nsIDataType::VTYPE_BOOL: {
-      int32_t valueInt;
-      nsresult rv = aValue->GetAsInt32(&valueInt);
-      if (NS_SUCCEEDED(rv)) {
-        NS_ENSURE_SUCCESS(rv, rv);
-        rv = SetAnnotationInt32Internal(aItemId, &bookmark, aName, valueInt,
-                                        aFlags, aExpiration);
-        NS_ENSURE_SUCCESS(rv, rv);
-        break;
-      }
-      // Fall through int64_t case otherwise.
-      [[fallthrough]];
-    }
-    case nsIDataType::VTYPE_INT64:
-    case nsIDataType::VTYPE_UINT64: {
-      int64_t valueLong;
-      nsresult rv = aValue->GetAsInt64(&valueLong);
-      if (NS_SUCCEEDED(rv)) {
-        NS_ENSURE_SUCCESS(rv, rv);
-        rv = SetAnnotationInt64Internal(aItemId, &bookmark, aName, valueLong,
-                                        aFlags, aExpiration);
-        NS_ENSURE_SUCCESS(rv, rv);
-        break;
-      }
-      // Fall through double case otherwise.
-      [[fallthrough]];
-    }
-    case nsIDataType::VTYPE_FLOAT:
-    case nsIDataType::VTYPE_DOUBLE: {
-      double valueDouble;
-      nsresult rv = aValue->GetAsDouble(&valueDouble);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = SetAnnotationDoubleInternal(aItemId, &bookmark, aName, valueDouble,
-                                       aFlags, aExpiration);
-      NS_ENSURE_SUCCESS(rv, rv);
-      break;
-    }
-    case nsIDataType::VTYPE_CHAR:
-    case nsIDataType::VTYPE_WCHAR:
-    case nsIDataType::VTYPE_CHAR_STR:
-    case nsIDataType::VTYPE_WCHAR_STR:
-    case nsIDataType::VTYPE_STRING_SIZE_IS:
-    case nsIDataType::VTYPE_WSTRING_SIZE_IS:
-    case nsIDataType::VTYPE_UTF8STRING:
-    case nsIDataType::VTYPE_CSTRING:
-    case nsIDataType::VTYPE_ASTRING: {
-      nsAutoString stringValue;
-      nsresult rv = aValue->GetAsAString(stringValue);
-      NS_ENSURE_SUCCESS(rv, rv);
-      rv = SetAnnotationStringInternal(aItemId, &bookmark, aName, stringValue,
-                                       aFlags, aExpiration);
-      NS_ENSURE_SUCCESS(rv, rv);
-      break;
-    }
-    default:
-      return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
-  return NS_OK;
-}
-
-nsresult nsAnnotationService::SetAnnotationInt32Internal(
-    int64_t aItemId, BookmarkData* aBookmark, const nsACString& aName,
-    int32_t aValue, int32_t aFlags, uint16_t aExpiration) {
-  mozStorageTransaction transaction(mDB->MainConn(), false);
-  nsCOMPtr<mozIStorageStatement> statement;
-  nsresult rv =
-      StartSetAnnotation(aItemId, aBookmark, aName, aFlags, aExpiration,
-                         nsIAnnotationService::TYPE_INT32, statement);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mozStorageStatementScoper scoper(statement);
-
-  rv = statement->BindInt32ByName("content"_ns, aValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = transaction.Commit();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-nsresult nsAnnotationService::SetAnnotationInt64Internal(
-    int64_t aItemId, BookmarkData* aBookmark, const nsACString& aName,
-    int64_t aValue, int32_t aFlags, uint16_t aExpiration) {
-  mozStorageTransaction transaction(mDB->MainConn(), false);
-  nsCOMPtr<mozIStorageStatement> statement;
-  nsresult rv =
-      StartSetAnnotation(aItemId, aBookmark, aName, aFlags, aExpiration,
-                         nsIAnnotationService::TYPE_INT64, statement);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mozStorageStatementScoper scoper(statement);
-
-  rv = statement->BindInt64ByName("content"_ns, aValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = transaction.Commit();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-nsresult nsAnnotationService::SetAnnotationDoubleInternal(
-    int64_t aItemId, BookmarkData* aBookmark, const nsACString& aName,
-    double aValue, int32_t aFlags, uint16_t aExpiration) {
-  mozStorageTransaction transaction(mDB->MainConn(), false);
-  nsCOMPtr<mozIStorageStatement> statement;
-  nsresult rv =
-      StartSetAnnotation(aItemId, aBookmark, aName, aFlags, aExpiration,
-                         nsIAnnotationService::TYPE_DOUBLE, statement);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  mozStorageStatementScoper scoper(statement);
-
-  rv = statement->BindDoubleByName("content"_ns, aValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = transaction.Commit();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-nsresult nsAnnotationService::GetValueFromStatement(
-    nsCOMPtr<mozIStorageStatement>& aStatement, nsIVariant** _retval) {
-  nsresult rv;
-
-  nsCOMPtr<nsIWritableVariant> value = new nsVariant();
-  int32_t type = aStatement->AsInt32(kAnnoIndex_Type);
-  switch (type) {
-    case nsIAnnotationService::TYPE_INT32:
-    case nsIAnnotationService::TYPE_INT64:
-    case nsIAnnotationService::TYPE_DOUBLE: {
-      rv = value->SetAsDouble(aStatement->AsDouble(kAnnoIndex_Content));
-      break;
-    }
-    case nsIAnnotationService::TYPE_STRING: {
-      nsAutoString valueString;
-      rv = aStatement->GetString(kAnnoIndex_Content, valueString);
-      if (NS_SUCCEEDED(rv)) rv = value->SetAsAString(valueString);
-      break;
-    }
-    default: {
-      rv = NS_ERROR_UNEXPECTED;
-      break;
-    }
-  }
-  if (NS_SUCCEEDED(rv)) {
-    value.forget(_retval);
-  }
-  return rv;
-}
-
-NS_IMETHODIMP
-nsAnnotationService::GetItemAnnotation(int64_t aItemId, const nsACString& aName,
-                                       nsIVariant** _retval) {
-  NS_ENSURE_ARG_MIN(aItemId, 1);
-  NS_ENSURE_ARG_POINTER(_retval);
-
-  nsCOMPtr<mozIStorageStatement> statement;
-  nsresult rv = StartGetAnnotation(aItemId, aName, statement);
-  if (NS_FAILED(rv)) return rv;
-
-  mozStorageStatementScoper scoper(statement);
-
-  return GetValueFromStatement(statement, _retval);
-}
-
-/**
- * @note We don't remove anything from the moz_anno_attributes table. If we
- *       delete the last item of a given name, that item really should go away.
- *       It will be cleaned up by expiration.
- */
-nsresult nsAnnotationService::RemoveAnnotationInternal(
-    int64_t aItemId, BookmarkData* aBookmark, const nsACString& aName) {
-  nsCOMPtr<mozIStorageStatement> statement;
-  statement = mDB->GetStatement(
-      "DELETE FROM moz_items_annos "
-      "WHERE item_id = :item_id "
-      "AND anno_attribute_id = "
-      "(SELECT id FROM moz_anno_attributes WHERE name = :anno_name)");
-  NS_ENSURE_STATE(statement);
-  mozStorageStatementScoper scoper(statement);
-
-  nsresult rv;
-  rv = statement->BindInt64ByName("item_id"_ns, aItemId);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = statement->BindUTF8StringByName("anno_name"_ns, aName);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
-  if (bookmarks) {
-    MOZ_ASSERT(aBookmark);
-    if (NS_FAILED(bookmarks->FetchItemInfo(aItemId, *aBookmark))) {
-      aBookmark->id = -1;
-    }
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAnnotationService::RemoveItemAnnotation(int64_t aItemId,
-                                          const nsACString& aName,
-                                          uint16_t aSource) {
-  NS_ENSURE_ARG_MIN(aItemId, 1);
-
-  BookmarkData bookmark;
-  nsresult rv = RemoveAnnotationInternal(aItemId, &bookmark, aName);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-nsresult nsAnnotationService::RemoveItemAnnotations(int64_t aItemId) {
-  NS_ENSURE_ARG_MIN(aItemId, 1);
-
-  // Should this be precompiled or a getter?
-  nsCOMPtr<mozIStorageStatement> statement =
-      mDB->GetStatement("DELETE FROM moz_items_annos WHERE item_id = :item_id");
-  NS_ENSURE_STATE(statement);
-  mozStorageStatementScoper scoper(statement);
-
-  nsresult rv = statement->BindInt64ByName("item_id"_ns, aItemId);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = statement->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsAnnotationService::ItemHasAnnotation(int64_t aItemId, const nsACString& aName,
-                                       bool* _hasAnno) {
-  NS_ENSURE_ARG_MIN(aItemId, 1);
-  NS_ENSURE_ARG_POINTER(_hasAnno);
-
-  nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-      "SELECT b.id, "
-      "(SELECT id FROM moz_anno_attributes WHERE name = :anno_name) AS nameid, "
-      "a.id, a.dateAdded "
-      "FROM moz_bookmarks b "
-      "LEFT JOIN moz_items_annos a ON a.item_id = b.id "
-      "AND a.anno_attribute_id = nameid "
-      "WHERE b.id = :item_id");
-  NS_ENSURE_STATE(stmt);
-  mozStorageStatementScoper checkAnnoScoper(stmt);
-
-  nsresult rv = stmt->BindUTF8StringByName("anno_name"_ns, aName);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = stmt->BindInt64ByName("item_id"_ns, aItemId);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasResult;
-  rv = stmt->ExecuteStep(&hasResult);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (!hasResult) {
-    // We are trying to get an annotation on an invalid bookmarks or
-    // history entry.
-    // Here we preserve the old behavior, returning that we don't have the
-    // annotation, ignoring the fact itemId is invalid.
-    // Otherwise we should return NS_ERROR_INVALID_ARG, but this will somehow
-    // break the API.  In future we could want to be pickier.
-    *_hasAnno = false;
-  } else {
-    int64_t annotationId = stmt->AsInt64(2);
-    *_hasAnno = (annotationId > 0);
-  }
-
-  return NS_OK;
-}
-
-/**
- * This loads the statement and steps it once so you can get data out of it.
- *
- * @note You have to reset the statement when you're done if this succeeds.
- * @throws NS_ERROR_NOT_AVAILABLE if the annotation is not found.
- */
-
-nsresult nsAnnotationService::StartGetAnnotation(
-    int64_t aItemId, const nsACString& aName,
-    nsCOMPtr<mozIStorageStatement>& aStatement) {
-  aStatement = mDB->GetStatement(
-      "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");
-  NS_ENSURE_STATE(aStatement);
-  mozStorageStatementScoper getAnnoScoper(aStatement);
-
-  nsresult rv;
-  rv = aStatement->BindInt64ByName("item_id"_ns, aItemId);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = aStatement->BindUTF8StringByName("anno_name"_ns, aName);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasResult = false;
-  rv = aStatement->ExecuteStep(&hasResult);
-  if (NS_FAILED(rv) || !hasResult) return NS_ERROR_NOT_AVAILABLE;
-
-  // on success, DON'T reset the statement, the caller needs to read from it,
-  // and it is the caller's job to reset it.
-  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 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(
-    int64_t aItemId, BookmarkData* aBookmark, const nsACString& aName,
-    int32_t aFlags, uint16_t aExpiration, uint16_t aType,
-    nsCOMPtr<mozIStorageStatement>& aStatement) {
-  MOZ_ASSERT(aExpiration == EXPIRE_NEVER, "Only EXPIRE_NEVER is supported");
-  NS_ENSURE_ARG(aExpiration == EXPIRE_NEVER);
-
-  // Ensure the annotation name exists.
-  nsCOMPtr<mozIStorageStatement> addNameStmt = mDB->GetStatement(
-      "INSERT OR IGNORE INTO moz_anno_attributes (name) VALUES (:anno_name)");
-  NS_ENSURE_STATE(addNameStmt);
-  mozStorageStatementScoper scoper(addNameStmt);
-
-  nsresult rv = addNameStmt->BindUTF8StringByName("anno_name"_ns, aName);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = addNameStmt->Execute();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // We have to check 2 things:
-  // - if the annotation already exists we should update it.
-  // - we should not allow setting annotations on invalid URIs or itemIds.
-  // This query will tell us:
-  // - whether the item or page exists.
-  // - whether the annotation already exists.
-  // - the nameID associated with the annotation name.
-  // - the id and dateAdded of the old annotation, if it exists.
-  nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
-      "SELECT b.id, "
-      "(SELECT id FROM moz_anno_attributes WHERE name = :anno_name) AS nameid, "
-      "a.id, a.dateAdded, b.parent, b.type, b.lastModified, b.guid, p.guid "
-      "FROM moz_bookmarks b "
-      "JOIN moz_bookmarks p ON p.id = b.parent "
-      "LEFT JOIN moz_items_annos a ON a.item_id = b.id "
-      "AND a.anno_attribute_id = nameid "
-      "WHERE b.id = :item_id");
-  NS_ENSURE_STATE(stmt);
-  mozStorageStatementScoper checkAnnoScoper(stmt);
-
-  rv = stmt->BindUTF8StringByName("anno_name"_ns, aName);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = stmt->BindInt64ByName("item_id"_ns, aItemId);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool hasResult;
-  rv = stmt->ExecuteStep(&hasResult);
-  NS_ENSURE_SUCCESS(rv, rv);
-  if (!hasResult) {
-    // We are trying to create an annotation on an invalid bookmark
-    // or history entry.
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  int64_t fkId = stmt->AsInt64(0);
-  int64_t nameID = stmt->AsInt64(1);
-  int64_t oldAnnoId = stmt->AsInt64(2);
-  int64_t oldAnnoDate = stmt->AsInt64(3);
-
-  aStatement = mDB->GetStatement(
-      "INSERT OR REPLACE INTO moz_items_annos "
-      "(id, item_id, anno_attribute_id, content, flags, "
-      "expiration, type, dateAdded, lastModified) "
-      "VALUES (:id, :fk, :name_id, :content, :flags, "
-      ":expiration, :type, :date_added, :last_modified)");
-
-  // Since we're already querying `moz_bookmarks`, we fetch the changed
-  // bookmark's info here, instead of using `FetchItemInfo`.
-  MOZ_ASSERT(aBookmark);
-  aBookmark->id = fkId;
-  aBookmark->parentId = stmt->AsInt64(4);
-  aBookmark->type = stmt->AsInt64(5);
-
-  aBookmark->lastModified = static_cast<PRTime>(stmt->AsInt64(6));
-  if (NS_FAILED(stmt->GetUTF8String(7, aBookmark->guid)) ||
-      NS_FAILED(stmt->GetUTF8String(8, aBookmark->parentGuid))) {
-    aBookmark->id = -1;
-  }
-  NS_ENSURE_STATE(aStatement);
-  mozStorageStatementScoper setAnnoScoper(aStatement);
-
-  // Don't replace existing annotations.
-  if (oldAnnoId > 0) {
-    rv = aStatement->BindInt64ByName("id"_ns, oldAnnoId);
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = aStatement->BindInt64ByName("date_added"_ns, oldAnnoDate);
-    NS_ENSURE_SUCCESS(rv, rv);
-  } else {
-    rv = aStatement->BindNullByName("id"_ns);
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = aStatement->BindInt64ByName("date_added"_ns, RoundedPRNow());
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  rv = aStatement->BindInt64ByName("fk"_ns, fkId);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = aStatement->BindInt64ByName("name_id"_ns, nameID);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = aStatement->BindInt32ByName("flags"_ns, aFlags);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = aStatement->BindInt32ByName("expiration"_ns, aExpiration);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = aStatement->BindInt32ByName("type"_ns, aType);
-  NS_ENSURE_SUCCESS(rv, rv);
-  rv = aStatement->BindInt64ByName("last_modified"_ns, RoundedPRNow());
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // On success, leave the statement open, the caller will set the value
-  // and execute the statement.
-  setAnnoScoper.Abandon();
-
-  return NS_OK;
-}
deleted file mode 100644
--- a/toolkit/components/places/nsAnnotationService.h
+++ /dev/null
@@ -1,112 +0,0 @@
-//* -*- 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/. */
-
-#ifndef nsAnnotationService_h___
-#define nsAnnotationService_h___
-
-#include "nsIAnnotationService.h"
-#include "nsTArray.h"
-#include "nsCOMArray.h"
-#include "nsCOMPtr.h"
-#include "nsServiceManagerUtils.h"
-#include "nsWeakReference.h"
-#include "Database.h"
-#include "nsString.h"
-#include "mozilla/Attributes.h"
-
-namespace mozilla {
-namespace places {
-
-struct BookmarkData;
-
-}  // namespace places
-}  // namespace mozilla
-
-class nsAnnotationService final : public nsIAnnotationService,
-                                  public nsSupportsWeakReference {
-  using BookmarkData = mozilla::places::BookmarkData;
-
- public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIANNOTATIONSERVICE
-
-  nsAnnotationService();
-
-  /**
-   * Obtains the service's object.
-   */
-  static already_AddRefed<nsAnnotationService> GetSingleton();
-
-  /**
-   * Initializes the service's object.  This should only be called once.
-   */
-  nsresult Init();
-
-  /**
-   * Returns a cached pointer to the annotation service for consumers in the
-   * places directory.
-   */
-  static nsAnnotationService* GetAnnotationService() {
-    if (!gAnnotationService) {
-      nsCOMPtr<nsIAnnotationService> serv =
-          do_GetService(NS_ANNOTATIONSERVICE_CONTRACTID);
-      NS_ENSURE_TRUE(serv, nullptr);
-      NS_ASSERTION(gAnnotationService,
-                   "Should have static instance pointer now");
-    }
-    return gAnnotationService;
-  }
-
- private:
-  ~nsAnnotationService();
-
- protected:
-  RefPtr<mozilla::places::Database> mDB;
-
-  static nsAnnotationService* gAnnotationService;
-
-  static const int kAnnoIndex_ID;
-  static const int kAnnoIndex_PageOrItem;
-  static const int kAnnoIndex_NameID;
-  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 StartGetAnnotation(int64_t aItemId, const nsACString& aName,
-                              nsCOMPtr<mozIStorageStatement>& aStatement);
-
-  nsresult StartSetAnnotation(int64_t aItemId, BookmarkData* aBookmark,
-                              const nsACString& aName, int32_t aFlags,
-                              uint16_t aExpiration, uint16_t aType,
-                              nsCOMPtr<mozIStorageStatement>& aStatement);
-
-  nsresult SetAnnotationStringInternal(int64_t aItemId, BookmarkData* aBookmark,
-                                       const nsACString& aName,
-                                       const nsAString& aValue, int32_t aFlags,
-                                       uint16_t aExpiration);
-  nsresult SetAnnotationInt32Internal(int64_t aItemId, BookmarkData* aBookmark,
-                                      const nsACString& aName, int32_t aValue,
-                                      int32_t aFlags, uint16_t aExpiration);
-  nsresult SetAnnotationInt64Internal(int64_t aItemId, BookmarkData* aBookmark,
-                                      const nsACString& aName, int64_t aValue,
-                                      int32_t aFlags, uint16_t aExpiration);
-  nsresult SetAnnotationDoubleInternal(int64_t aItemId, BookmarkData* aBookmark,
-                                       const nsACString& aName, double aValue,
-                                       int32_t aFlags, uint16_t aExpiration);
-
-  nsresult RemoveAnnotationInternal(int64_t aItemId, BookmarkData* aBookmark,
-                                    const nsACString& aName);
-
-  nsresult GetValueFromStatement(nsCOMPtr<mozIStorageStatement>& aStatement,
-                                 nsIVariant** _retval);
-
- public:
-  nsresult RemoveItemAnnotations(int64_t aItemId);
-};
-
-#endif /* nsAnnotationService_h___ */
deleted file mode 100644
--- a/toolkit/components/places/nsIAnnotationService.idl
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- 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 nsIVariant;
-
-/**
- *
- *
- *  THE ANNOTATION SERVICE API IS
- *
- *  ===  D E P R E C A T E D  ===
- *
- * See https://bugzilla.mozilla.org/show_bug.cgi?id=699844
- *
- *
- */
-
-[scriptable, uuid(D4CDAAB1-8EEC-47A8-B420-AD7CB333056A)]
-interface nsIAnnotationService : nsISupports
-{
-    /**
-     * Valid values for aExpiration, which sets the expiration policy for your
-     * annotation.
-     */
-
-    // For annotations that only live as long as the URI is in the database.
-    // A page annotation will expire if the page has no visits
-    // and is not bookmarked.
-    // An item annotation will expire when the item is deleted.
-    const unsigned short EXPIRE_NEVER = 4;
-
-    // type constants
-    const unsigned short TYPE_INT32  = 1;
-    const unsigned short TYPE_DOUBLE = 2;
-    const unsigned short TYPE_STRING = 3;
-    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".
-     *
-     * Do not use characters that are not valid in URLs such as spaces, ":",
-     * commas, or most other symbols. You should stick to ASCII letters and
-     * numbers plus "_", "-", and "/".
-     *
-     * aExpiration is one of EXPIRE_* above. aFlags should be 0 for now, some
-     * flags will be defined in the future.
-     *
-     * For item annotations, aSource should be a change source constant from
-     * nsINavBookmarksService::SOURCE_*, and defaults to SOURCE_DEFAULT if
-     * omitted. Setting an item annotation also notifies
-     * `nsINavBookmarkObserver::onItemChanged` for the affected item.
-     *
-     * 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.
-     *
-     * Only C++ consumers may use the type-specific methods.
-     *
-     * @throws NS_ERROR_ILLEGAL_VALUE if the page or the bookmark doesn't exist.
-     */
-    void setItemAnnotation(in long long aItemId,
-                           in AUTF8String aName,
-                           in nsIVariant aValue,
-                           in long aFlags,
-                           in unsigned short aExpiration,
-                           [optional] in unsigned short aSource,
-                           [optional] in bool aDontUpdateLastModified);
-
-    /**
-     * Retrieves the value of a given annotation. Throws an error if the
-     * 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 getItemAnnotation(in long long aItemId,
-                                 in AUTF8String aName);
-
-    /**
-     * Test for annotation existence.
-     */
-    boolean itemHasAnnotation(in long long aItemId,
-                              in AUTF8String aName);
-
-    /**
-     * Removes a specific annotation. Succeeds even if the annotation is
-     * not found.
-     *
-     * Removing an item annotation also notifies
-     * `nsINavBookmarkObserver::onItemChanged` for the affected item.
-     */
-    void removeItemAnnotation(in long long aItemId,
-                              in AUTF8String aName,
-                              [optional] in unsigned short aSource);
-};
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -1,17 +1,16 @@
 /* -*- 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/. */
 
 #include "nsNavBookmarks.h"
 
 #include "nsNavHistory.h"
-#include "nsAnnotationService.h"
 #include "nsPlacesMacros.h"
 #include "Helpers.h"
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsNetUtil.h"
 #include "nsUnicharUtils.h"
 #include "nsPrintfCString.h"
 #include "nsQueryObject.h"
@@ -555,26 +554,16 @@ nsNavBookmarks::RemoveItem(int64_t aItem
   NS_ENSURE_ARG(!IsRoot(aItemId));
 
   BookmarkData bookmark;
   nsresult rv = FetchItemInfo(aItemId, bookmark);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mozStorageTransaction transaction(mDB->MainConn(), false);
 
-  // First, if not a tag, remove item annotations.
-  int64_t tagsRootId = TagsRootId();
-  bool isUntagging = bookmark.grandParentId == tagsRootId;
-  if (bookmark.parentId != tagsRootId && !isUntagging) {
-    nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
-    NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
-    rv = annosvc->RemoveItemAnnotations(bookmark.id);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
   if (bookmark.type == TYPE_FOLDER) {
     // Remove all of the folder's children.
     rv = RemoveFolderChildren(bookmark.id, aSource);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   nsCOMPtr<mozIStorageStatement> stmt =
       mDB->GetStatement("DELETE FROM moz_bookmarks WHERE id = :item_id");
@@ -605,17 +594,18 @@ nsNavBookmarks::RemoveItem(int64_t aItem
                            bookmark.lastModified);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Mark all affected separators as changed
   rv = AdjustSeparatorsSyncCounter(bookmark.parentId, bookmark.position,
                                    syncChangeDelta);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (isUntagging) {
+  int64_t tagsRootId = TagsRootId();
+  if (bookmark.grandParentId == tagsRootId) {
     // If we're removing a tag, increment the change counter for all bookmarks
     // with the URI.
     rv = AddSyncChangesForBookmarksWithURL(bookmark.url, syncChangeDelta);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -8,17 +8,16 @@
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/IntegerPrintfMacros.h"
 
 #include "nsNavHistory.h"
 
 #include "mozIPlacesAutoComplete.h"
 #include "nsNavBookmarks.h"
-#include "nsAnnotationService.h"
 #include "nsFaviconService.h"
 #include "nsPlacesMacros.h"
 #include "nsPlacesTriggers.h"
 #include "DateTimeFormat.h"
 #include "History.h"
 #include "Helpers.h"
 
 #include "nsTArray.h"
@@ -112,19 +111,16 @@ using namespace mozilla::places;
 #define PREF_FREC_DECAY_RATE_DEF 0.975f
 // An adaptive history entry is removed if unused for these many days.
 #define ADAPTIVE_HISTORY_EXPIRE_DAYS 90
 
 // In order to avoid calling PR_now() too often we use a cached "now" value
 // for repeating stuff.  These are milliseconds between "now" cache refreshes.
 #define RENEW_CACHED_NOW_TIMEOUT ((int32_t)3 * PR_MSEC_PER_SEC)
 
-// character-set annotation
-#define CHARSET_ANNO "URIProperties/characterSet"_ns
-
 // These macros are used when splitting history by date.
 // These are the day containers and catch-all final container.
 #define HISTORY_ADDITIONAL_DATE_CONT_NUM 3
 // We use a guess of the number of months considering all of them 30 days
 // long, but we split only the last 6 months.
 #define HISTORY_DATE_CONT_NUM(_daysFromOldestVisit) \
   (HISTORY_ADDITIONAL_DATE_CONT_NUM +               \
    std::min(6, (int32_t)ceilf((float)_daysFromOldestVisit / 30)))
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -3,17 +3,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/. */
 
 #include <stdio.h>
 #include "nsNavHistory.h"
 #include "nsNavBookmarks.h"
 #include "nsFaviconService.h"
-#include "nsAnnotationService.h"
 #include "Helpers.h"
 #include "mozilla/DebugOnly.h"
 #include "nsDebug.h"
 #include "nsNetUtil.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "prtime.h"
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
@@ -37,21 +37,16 @@ add_task(async function test_eraseEveryt
   });
   checkBookmarkObject(unfiledBookmark);
   let unfiledBookmarkInFolder = await PlacesUtils.bookmarks.insert({
     parentGuid: unfiledFolder.guid,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: "http://mozilla.org/",
   });
   checkBookmarkObject(unfiledBookmarkInFolder);
-  await setItemAnnotation(
-    unfiledBookmarkInFolder.guid,
-    "testanno1",
-    "testvalue1"
-  );
 
   let menuFolder = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.menuGuid,
     type: PlacesUtils.bookmarks.TYPE_FOLDER,
   });
   checkBookmarkObject(menuFolder);
   let menuBookmark = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.menuGuid,
@@ -60,17 +55,16 @@ add_task(async function test_eraseEveryt
   });
   checkBookmarkObject(menuBookmark);
   let menuBookmarkInFolder = await PlacesUtils.bookmarks.insert({
     parentGuid: menuFolder.guid,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: "http://mozilla.org/",
   });
   checkBookmarkObject(menuBookmarkInFolder);
-  await setItemAnnotation(menuBookmarkInFolder.guid, "testanno1", "testvalue1");
 
   let toolbarFolder = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
     type: PlacesUtils.bookmarks.TYPE_FOLDER,
   });
   checkBookmarkObject(toolbarFolder);
   let toolbarBookmark = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
@@ -79,46 +73,30 @@ add_task(async function test_eraseEveryt
   });
   checkBookmarkObject(toolbarBookmark);
   let toolbarBookmarkInFolder = await PlacesUtils.bookmarks.insert({
     parentGuid: toolbarFolder.guid,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: "http://mozilla.org/",
   });
   checkBookmarkObject(toolbarBookmarkInFolder);
-  await setItemAnnotation(
-    toolbarBookmarkInFolder.guid,
-    "testanno1",
-    "testvalue1"
-  );
 
   await PlacesTestUtils.promiseAsyncUpdates();
   Assert.ok(frecencyForUrl("http://example.com/") > frecencyForExample);
   Assert.ok(frecencyForUrl("http://example.com/") > frecencyForMozilla);
 
   let manyFrecenciesPromise = promiseManyFrecenciesChanged();
 
   await PlacesUtils.bookmarks.eraseEverything();
 
   // Ensure we get an onManyFrecenciesChanged notification.
   await manyFrecenciesPromise;
 
   Assert.equal(frecencyForUrl("http://example.com/"), frecencyForExample);
   Assert.equal(frecencyForUrl("http://example.com/"), frecencyForMozilla);
-
-  // Check there are no orphan annotations.
-  let conn = await PlacesUtils.promiseDBConnection();
-  let annoAttrs = await conn.execute(
-    `SELECT id, name FROM moz_anno_attributes`
-  );
-  Assert.equal(annoAttrs.length, 0);
-  let annos = await conn.execute(
-    `SELECT item_id, anno_attribute_id FROM moz_items_annos`
-  );
-  Assert.equal(annos.length, 0);
 });
 
 add_task(async function test_eraseEverything_roots() {
   await PlacesUtils.bookmarks.eraseEverything();
 
   // Ensure the roots have not been removed.
   Assert.ok(
     await PlacesUtils.bookmarks.fetch(PlacesUtils.bookmarks.unfiledGuid)
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
@@ -280,40 +280,16 @@ add_task(async function remove_multiple_
     expectedIndex++;
   }
 
   // Tidy up
   await PlacesUtils.bookmarks.remove(expectedRemaining);
   await PlacesTestUtils.promiseAsyncUpdates();
 });
 
-add_task(async function remove_bookmark_orphans() {
-  let bm1 = await PlacesUtils.bookmarks.insert({
-    parentGuid: PlacesUtils.bookmarks.unfiledGuid,
-    type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
-    url: "http://example.com/",
-    title: "a bookmark",
-  });
-  checkBookmarkObject(bm1);
-  await setItemAnnotation(bm1.guid, "testanno", "testvalue");
-
-  await PlacesUtils.bookmarks.remove(bm1.guid);
-
-  // Check there are no orphan annotations.
-  let conn = await PlacesUtils.promiseDBConnection();
-  let annoAttrs = await conn.execute(
-    `SELECT id, name FROM moz_anno_attributes`
-  );
-  Assert.equal(annoAttrs.length, 0);
-  let annos = await conn.execute(
-    `SELECT item_id, anno_attribute_id FROM moz_items_annos`
-  );
-  Assert.equal(annos.length, 0);
-});
-
 add_task(async function remove_bookmark_empty_title() {
   let bm1 = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.unfiledGuid,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: "http://example.com/",
     title: "",
   });
   checkBookmarkObject(bm1);
--- a/toolkit/components/places/tests/expiration/test_annos_expire_never.js
+++ b/toolkit/components/places/tests/expiration/test_annos_expire_never.js
@@ -6,24 +6,18 @@
 
 /**
  * What this is aimed to test:
  *
  * EXPIRE_NEVER annotations should be expired when a page is removed from the
  * database.
  * If the annotation is a page annotation this will happen when the page is
  * expired, namely when the page has no visits and is not bookmarked.
- * Otherwise if it's an item annotation the annotation will be expired when
- * the item is removed, thus expiration won't handle this case at all.
  */
 
-var as = Cc["@mozilla.org/browser/annotation-service;1"].getService(
-  Ci.nsIAnnotationService
-);
-
 add_task(async function test_annos_expire_never() {
   // Set interval to a large value so we don't expire on it.
   setInterval(3600); // 1h
 
   // Expire all expirable pages.
   setMaxPages(0);
 
   // Add some visited page and a couple expire never annotations for each.
@@ -40,36 +34,16 @@ add_task(async function test_annos_expir
     });
   }
 
   let pages = await getPagesWithAnnotation("page_expire1");
   Assert.equal(pages.length, 5);
   pages = await getPagesWithAnnotation("page_expire2");
   Assert.equal(pages.length, 5);
 
-  // Add some bookmarked page and a couple expire never annotations for each.
-  for (let i = 0; i < 5; i++) {
-    let pageURI = uri("http://item_anno." + i + ".mozilla.org/");
-    // We also add a visit before bookmarking.
-    await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
-    let bm = await PlacesUtils.bookmarks.insert({
-      parentGuid: PlacesUtils.bookmarks.unfiledGuid,
-      url: pageURI,
-      title: null,
-    });
-    let id = await PlacesUtils.promiseItemId(bm.guid);
-    as.setItemAnnotation(id, "item_persist1", "test", 0, as.EXPIRE_NEVER);
-    as.setItemAnnotation(id, "item_persist2", "test", 0, as.EXPIRE_NEVER);
-  }
-
-  let items = await getItemsWithAnnotation("item_persist1");
-  Assert.equal(items.length, 5);
-  items = await getItemsWithAnnotation("item_persist2");
-  Assert.equal(items.length, 5);
-
   // Add other visited page and a couple expire never annotations for each.
   // We won't expire these visits, so the annotations should survive.
   for (let i = 0; i < 5; i++) {
     let pageURI = uri("http://persist_page_anno." + i + ".mozilla.org/");
     await PlacesTestUtils.addVisits({ uri: pageURI, visitDate: now++ });
     await PlacesUtils.history.update({
       url: pageURI,
       annotations: new Map([
@@ -80,23 +54,19 @@ add_task(async function test_annos_expir
   }
 
   pages = await getPagesWithAnnotation("page_persist1");
   Assert.equal(pages.length, 5);
   pages = await getPagesWithAnnotation("page_persist2");
   Assert.equal(pages.length, 5);
 
   // Expire all visits for the first 5 pages and the bookmarks.
-  await promiseForceExpirationStep(10);
+  await promiseForceExpirationStep(5);
 
   pages = await getPagesWithAnnotation("page_expire1");
   Assert.equal(pages.length, 0);
   pages = await getPagesWithAnnotation("page_expire2");
   Assert.equal(pages.length, 0);
-  items = await getItemsWithAnnotation("item_persist1");
-  Assert.equal(items.length, 5);
-  items = await getItemsWithAnnotation("item_persist2");
-  Assert.equal(items.length, 5);
   pages = await getPagesWithAnnotation("page_persist1");
   Assert.equal(pages.length, 5);
   pages = await getPagesWithAnnotation("page_persist2");
   Assert.equal(pages.length, 5);
 });
--- a/toolkit/components/places/tests/expiration/test_clearHistory.js
+++ b/toolkit/components/places/tests/expiration/test_clearHistory.js
@@ -7,36 +7,32 @@
 /**
  * What this is aimed to test:
  *
  * History.clear() should expire everything but bookmarked pages and valid
  * annos.
  */
 
 add_task(async function test_historyClear() {
-  let as = PlacesUtils.annotations;
   // Set interval to a large value so we don't expire on it.
   setInterval(3600); // 1h
 
   // Expire all expirable pages.
   setMaxPages(0);
 
   // Add some bookmarked page with visit and annotations.
   for (let i = 0; i < 5; i++) {
     let pageURI = uri("http://item_anno." + i + ".mozilla.org/");
     // This visit will be expired.
     await PlacesTestUtils.addVisits({ uri: pageURI });
-    let bm = await PlacesUtils.bookmarks.insert({
+    await PlacesUtils.bookmarks.insert({
       parentGuid: PlacesUtils.bookmarks.unfiledGuid,
       url: pageURI,
       title: null,
     });
-    let id = await PlacesUtils.promiseItemId(bm.guid);
-    // Will persist because it's an EXPIRE_NEVER item anno.
-    as.setItemAnnotation(id, "persist", "test", 0, as.EXPIRE_NEVER);
     // Will persist because the page is bookmarked.
     await PlacesUtils.history.update({
       url: pageURI,
       annotations: new Map([["persist", "test"]]),
     });
   }
 
   // Add some visited page and annotations for each.
@@ -53,17 +49,9 @@ add_task(async function test_historyClea
 
   // Expire all visits for the bookmarks
   await PlacesUtils.history.clear();
 
   Assert.equal((await getPagesWithAnnotation("expire")).length, 0);
 
   let pages = await getPagesWithAnnotation("persist");
   Assert.equal(pages.length, 5);
-
-  let items = await getItemsWithAnnotation("persist");
-  Assert.equal(items.length, 5);
-
-  for (let guid of items) {
-    // Check item exists.
-    Assert.ok(await PlacesUtils.bookmarks.fetch({ guid }), "item exists");
-  }
 });
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -984,56 +984,16 @@ function getPagesWithAnnotation(name) {
       { name }
     );
 
     return rows.map(row => row.getResultByName("url"));
   });
 }
 
 /**
- * Gets the URLs of pages that have a particular annotation.
- *
- * @param {String} name The name of the annotation to search for.
- * @return An array of GUIDs found.
- */
-function getItemsWithAnnotation(name) {
-  return PlacesUtils.promiseDBConnection().then(async db => {
-    let rows = await db.execute(
-      `
-      SELECT b.guid FROM moz_anno_attributes n
-      JOIN moz_items_annos a ON n.id = a.anno_attribute_id
-      JOIN moz_bookmarks b ON b.id = a.item_id
-      WHERE n.name = :name
-    `,
-      { name }
-    );
-
-    return rows.map(row => row.getResultByName("guid"));
-  });
-}
-
-/**
- * Sets an annotation for an item.
- *
- * @param {String} guid The GUID of the item.
- * @param {String} name The name of the annotation.
- * @param {Number|String} value The value of the annotation.
- */
-async function setItemAnnotation(guid, name, value) {
-  let id = await PlacesUtils.promiseItemId(guid);
-  PlacesUtils.annotations.setItemAnnotation(
-    id,
-    name,
-    value,
-    0,
-    PlacesUtils.annotations.EXPIRE_NEVER
-  );
-}
-
-/**
  * Checks there are no orphan page annotations in the database, and no
  * orphan anno attribute names.
  */
 async function assertNoOrphanPageAnnotations() {
   let db = await PlacesUtils.promiseDBConnection();
 
   let rows = await db.execute(`
     SELECT place_id FROM moz_annos
--- a/toolkit/components/places/tests/history/test_update.js
+++ b/toolkit/components/places/tests/history/test_update.js
@@ -358,18 +358,18 @@ add_task(async function test_simple_chan
   let annotationInfo = await getAnnotationInfoFromDB(
     TEST_URL,
     "test/annotation"
   );
   Assert.deepEqual(
     {
       content: "testContent",
       flags: 0,
-      type: Ci.nsIAnnotationService.TYPE_STRING,
-      expiration: Ci.nsIAnnotationService.EXPIRE_NEVER,
+      type: PlacesUtils.history.ANNOTATION_TYPE_STRING,
+      expiration: PlacesUtils.history.ANNOTATION_EXPIRE_NEVER,
     },
     annotationInfo[0],
     "Should have stored the correct annotation data in the db"
   );
 
   await PlacesUtils.history.update({
     url: TEST_URL,
     annotations: new Map([["test/annotation2", "testAnno"]]),
@@ -420,18 +420,18 @@ add_task(async function test_simple_chan
     "Should have kept the value for the second annotation"
   );
 
   annotationInfo = await getAnnotationInfoFromDB(TEST_URL, "test/annotation");
   Assert.deepEqual(
     {
       content: 1234,
       flags: 0,
-      type: Ci.nsIAnnotationService.TYPE_INT64,
-      expiration: Ci.nsIAnnotationService.EXPIRE_NEVER,
+      type: PlacesUtils.history.ANNOTATION_TYPE_INT64,
+      expiration: PlacesUtils.history.ANNOTATION_EXPIRE_NEVER,
     },
     annotationInfo[0],
     "Should have updated the annotation data in the db"
   );
 
   await PlacesUtils.history.update({
     url: TEST_URL,
     annotations: new Map([["test/annotation", null]]),
--- a/toolkit/components/places/tests/maintenance/test_preventive_maintenance.js
+++ b/toolkit/components/places/tests/maintenance/test_preventive_maintenance.js
@@ -9,17 +9,16 @@
  * For every maintenance query create an uncoherent db and check that we take
  * correct fix steps, without polluting valid data.
  */
 
 // Get services and database connection
 var hs = PlacesUtils.history;
 var bs = PlacesUtils.bookmarks;
 var ts = PlacesUtils.tagging;
-var as = PlacesUtils.annotations;
 var fs = PlacesUtils.favicons;
 
 var mDBConn = hs.DBConnection;
 var gUnfiledFolderId;
 // ------------------------------------------------------------------------------
 // Helpers
 
 var defaultBookmarksMaxId = 0;
@@ -2757,17 +2756,16 @@ tests.push({
     await PlacesUtils.keywords.insert({
       url: this._uri1.spec,
       keyword: "testkeyword",
     });
     await PlacesUtils.history.update({
       url: this._uri2,
       annotations: new Map([["anno", "anno"]]),
     });
-    as.setItemAnnotation(this._bookmarkId, "anno", "anno", 0, as.EXPIRE_NEVER);
   },
 
   async check() {
     // Check that all items are correct
     let isVisited = await PlacesUtils.history.hasVisits(this._uri1);
     Assert.ok(isVisited);
     isVisited = await PlacesUtils.history.hasVisits(this._uri2);
     Assert.ok(isVisited);
@@ -2785,17 +2783,16 @@ tests.push({
     Assert.equal(
       (await PlacesUtils.keywords.fetch({ url: this._uri1.spec })).keyword,
       "testkeyword"
     );
     let pageInfo = await PlacesUtils.history.fetch(this._uri2, {
       includeAnnotations: true,
     });
     Assert.equal(pageInfo.annotations.get("anno"), "anno");
-    Assert.equal(as.getItemAnnotation(this._bookmarkId, "anno"), "anno");
 
     await new Promise(resolve => {
       fs.getFaviconURLForPage(this._uri2, aFaviconURI => {
         Assert.ok(aFaviconURI.equals(SMALLPNG_DATA_URI));
         resolve();
       });
     });
   },
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -99,33 +99,16 @@ async function task_populateDB(aArray) {
         await PlacesUtils.history.update({
           url: qdata.uri,
           annotations: new Map([
             [qdata.annoName, qdata.removeAnnotation ? null : qdata.annoVal],
           ]),
         });
       }
 
-      if (qdata.isItemAnnotation) {
-        if (qdata.removeAnnotation) {
-          PlacesUtils.annotations.removeItemAnnotation(
-            qdata.itemId,
-            qdata.annoName
-          );
-        } else {
-          PlacesUtils.annotations.setItemAnnotation(
-            qdata.itemId,
-            qdata.annoName,
-            qdata.annoVal,
-            0,
-            PlacesUtils.annotations.EXPIRE_NEVER
-          );
-        }
-      }
-
       if (qdata.isFolder) {
         await PlacesUtils.bookmarks.insert({
           parentGuid: qdata.parentGuid,
           type: PlacesUtils.bookmarks.TYPE_FOLDER,
           title: qdata.title,
           index: qdata.index,
         });
       }
@@ -198,17 +181,16 @@ function queryData(obj) {
   this.isRedirect = obj.isRedirect ? obj.isRedirect : false;
   this.isDetails = obj.isDetails ? obj.isDetails : false;
   this.title = obj.title ? obj.title : "";
   this.markPageAsTyped = obj.markPageAsTyped ? obj.markPageAsTyped : false;
   this.isPageAnnotation = obj.isPageAnnotation ? obj.isPageAnnotation : false;
   this.removeAnnotation = !!obj.removeAnnotation;
   this.annoName = obj.annoName ? obj.annoName : "";
   this.annoVal = obj.annoVal ? obj.annoVal : "";
-  this.isItemAnnotation = obj.isItemAnnotation ? obj.isItemAnnotation : false;
   this.itemId = obj.itemId ? obj.itemId : 0;
   this.annoMimeType = obj.annoMimeType ? obj.annoMimeType : "";
   this.isTag = obj.isTag ? obj.isTag : false;
   this.tagArray = obj.tagArray ? obj.tagArray : null;
   this.parentGuid = obj.parentGuid || PlacesUtils.bookmarks.unfiledGuid;
   this.feedURI = obj.feedURI ? obj.feedURI : "";
   this.index = obj.index ? obj.index : PlacesUtils.bookmarks.DEFAULT_INDEX;
   this.isFolder = obj.isFolder ? obj.isFolder : false;
deleted file mode 100644
--- a/toolkit/components/places/tests/unit/test_annotations.js
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* 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/. */
-
-// Get annotation service
-try {
-  var annosvc = Cc["@mozilla.org/browser/annotation-service;1"].getService(
-    Ci.nsIAnnotationService
-  );
-} catch (ex) {
-  do_throw("Could not get annotation service\n");
-}
-
-add_task(async function test_execute() {
-  let testURI = uri("http://mozilla.com/");
-  let testItem = await PlacesUtils.bookmarks.insert({
-    parentGuid: PlacesUtils.bookmarks.menuGuid,
-    title: "",
-    url: testURI,
-  });
-  let testItemId = await PlacesUtils.promiseItemId(testItem.guid);
-  let testAnnoName = "moz-test-places/annotations";
-  let testAnnoVal = "test";
-  let earlierDate = new Date(Date.now() - 1000);
-
-  // string item-annotation
-  let item = await PlacesUtils.bookmarks.fetch(testItem.guid);
-
-  // Verify that lastModified equals dateAdded before we set the annotation.
-  Assert.equal(item.lastModified.getTime(), item.dateAdded.getTime());
-  // Workaround possible VM timers issues moving last modified to the past.
-  await PlacesUtils.bookmarks.update({
-    guid: item.guid,
-    dateAdded: earlierDate,
-    lastModified: earlierDate,
-  });
-
-  try {
-    annosvc.setItemAnnotation(
-      testItemId,
-      testAnnoName,
-      testAnnoVal,
-      0,
-      annosvc.EXPIRE_NEVER
-    );
-  } catch (ex) {
-    do_throw("unable to add item annotation " + ex);
-  }
-
-  let updatedItem = await PlacesUtils.bookmarks.fetch(testItem.guid);
-
-  Assert.equal(
-    updatedItem.lastModified.getTime(),
-    earlierDate.getTime(),
-    "Setting an item annotation should not update lastModified"
-  );
-
-  try {
-    var annoVal = annosvc.getItemAnnotation(testItemId, testAnnoName);
-    // verify the anno value
-    Assert.ok(testAnnoVal === annoVal);
-  } catch (ex) {
-    do_throw("unable to get item annotation");
-  }
-
-  try {
-    annosvc.getItemAnnotation(testURI, "blah");
-    do_throw("fetching item-annotation that doesn't exist, should've thrown");
-  } catch (ex) {}
-
-  // test int32 anno type
-  var int32Key = testAnnoName + "/types/Int32";
-  var int32Val = 23;
-  annosvc.setItemAnnotation(
-    testItemId,
-    int32Key,
-    int32Val,
-    0,
-    annosvc.EXPIRE_NEVER
-  );
-  Assert.ok(annosvc.itemHasAnnotation(testItemId, int32Key));
-  let storedVal = annosvc.getItemAnnotation(testItemId, int32Key);
-  Assert.ok(int32Val === storedVal);
-
-  // test int64 anno type
-  var int64Key = testAnnoName + "/types/Int64";
-  var int64Val = 4294967296;
-  annosvc.setItemAnnotation(
-    testItemId,
-    int64Key,
-    int64Val,
-    0,
-    annosvc.EXPIRE_NEVER
-  );
-  Assert.ok(annosvc.itemHasAnnotation(testItemId, int64Key));
-  storedVal = annosvc.getItemAnnotation(testItemId, int64Key);
-  Assert.ok(int64Val === storedVal);
-
-  // test double anno type
-  var doubleKey = testAnnoName + "/types/Double";
-  var doubleVal = 0.000002342;
-  annosvc.setItemAnnotation(
-    testItemId,
-    doubleKey,
-    doubleVal,
-    0,
-    annosvc.EXPIRE_NEVER
-  );
-  Assert.ok(annosvc.itemHasAnnotation(testItemId, doubleKey));
-  storedVal = annosvc.getItemAnnotation(testItemId, doubleKey);
-  Assert.ok(doubleVal === storedVal);
-
-  // test annotation removal
-  annosvc.setItemAnnotation(
-    testItemId,
-    testAnnoName,
-    testAnnoVal,
-    0,
-    annosvc.EXPIRE_NEVER
-  );
-  // verify that removing an annotation does not update the last modified date
-  testItem = await PlacesUtils.bookmarks.fetch(testItem.guid);
-
-  // Workaround possible VM timers issues moving last modified to the past.
-  await PlacesUtils.bookmarks.update({
-    guid: testItem.guid,
-    dateAdded: earlierDate,
-    lastModified: earlierDate,
-  });
-  annosvc.removeItemAnnotation(testItemId, int32Key);
-
-  testItem = await PlacesUtils.bookmarks.fetch(testItem.guid);
-  info(
-    "verify that removing an annotation does not update the last modified date"
-  );
-  Assert.equal(
-    testItem.lastModified.getTime(),
-    earlierDate.getTime(),
-    "Setting an item annotation should not update lastModified"
-  );
-
-  // test that getItems/PagesWithAnnotation returns an empty array after
-  // removing all items/pages which had the annotation set, see bug 380317.
-  Assert.equal((await getItemsWithAnnotation(int32Key)).length, 0);
-  Assert.equal((await getPagesWithAnnotation(int32Key)).length, 0);
-
-  // Setting item annotations on invalid item ids should throw
-  var invalidIds = [-1, 0, 37643];
-  for (var id of invalidIds) {
-    try {
-      annosvc.setItemAnnotation(id, "foo", "bar", 0, annosvc.EXPIRE_NEVER);
-      do_throw("setItemAnnotation* should throw for invalid item id: " + id);
-    } catch (ex) {}
-  }
-
-  // setting an annotation with EXPIRE_HISTORY for an item should throw
-  item = await PlacesUtils.bookmarks.insert({
-    parentGuid: PlacesUtils.bookmarks.menuGuid,
-    title: "",
-    url: testURI,
-  });
-});
--- a/toolkit/components/places/tests/unit/test_telemetry.js
+++ b/toolkit/components/places/tests/unit/test_telemetry.js
@@ -16,17 +16,17 @@ var histograms = {
   PLACES_TAGGED_BOOKMARKS_PERC: val => Assert.equal(val, 100),
   PLACES_DATABASE_FILESIZE_MB: val => Assert.ok(val > 0),
   PLACES_DATABASE_FAVICONS_FILESIZE_MB: val => Assert.ok(val > 0),
   PLACES_DATABASE_PAGESIZE_B: val => Assert.equal(val, 32768),
   PLACES_DATABASE_SIZE_PER_PAGE_B: val => Assert.ok(val > 0),
   PLACES_EXPIRATION_STEPS_TO_CLEAN2: val => Assert.ok(val > 1),
   PLACES_IDLE_FRECENCY_DECAY_TIME_MS: val => Assert.ok(val >= 0),
   PLACES_IDLE_MAINTENANCE_TIME_MS: val => Assert.ok(val > 0),
-  PLACES_ANNOS_BOOKMARKS_COUNT: val => Assert.equal(val, 1),
+  PLACES_ANNOS_BOOKMARKS_COUNT: val => Assert.equal(val, 0),
   PLACES_ANNOS_PAGES_COUNT: val => Assert.equal(val, 1),
   PLACES_MAINTENANCE_DAYSFROMLAST: val => Assert.ok(val >= 0),
 };
 
 /**
  * Forces an expiration run.
  *
  * @param [optional] aLimit
@@ -64,17 +64,17 @@ function getExpirablePRTime(daysAgo = 7)
   dateObj = new Date(dateObj.getTime() - (daysAgo + 1) * 86400000);
   return dateObj.getTime() * 1000;
 }
 
 add_task(async function test_execute() {
   // Put some trash in the database.
   let uri = Services.io.newURI("http://moz.org/");
 
-  let bookmarks = await PlacesUtils.bookmarks.insertTree({
+  PlacesUtils.bookmarks.insertTree({
     guid: PlacesUtils.bookmarks.unfiledGuid,
     children: [
       {
         title: "moz test",
         type: PlacesUtils.bookmarks.TYPE_FOLDER,
         children: [
           {
             title: "moz test",
@@ -89,17 +89,16 @@ add_task(async function test_execute() {
   await PlacesUtils.keywords.insert({ url: uri.spec, keyword: "keyword" });
 
   // Set a large annotation.
   let content = "";
   while (content.length < 1024) {
     content += "0";
   }
 
-  await setItemAnnotation(bookmarks[1].guid, "test-anno", content);
   await PlacesUtils.history.update({
     url: uri,
     annotations: new Map([["test-anno", content]]),
   });
 
   // Request to gather telemetry data.
   Cc["@mozilla.org/places/categoriesStarter;1"]
     .getService(Ci.nsIObserver)
--- a/toolkit/components/places/tests/unit/xpcshell.ini
+++ b/toolkit/components/places/tests/unit/xpcshell.ini
@@ -38,17 +38,16 @@ skip-if = appname == "thunderbird"
 [test_463863.js]
 [test_485442_crash_bug_nsNavHistoryQuery_GetUri.js]
 [test_486978_sort_by_date_queries.js]
 [test_536081.js]
 [test_1085291.js]
 [test_1105208.js]
 [test_1105866.js]
 [test_1606731.js]
-[test_annotations.js]
 [test_asyncExecuteLegacyQueries.js]
 [test_async_transactions.js]
 [test_bookmarks_json.js]
 [test_bookmarks_json_corrupt.js]
 [test_bookmarks_html.js]
 [test_bookmarks_html_corrupt.js]
 [test_bookmarks_html_escape_entities.js]
 [test_bookmarks_html_import_tags.js]