Bug 1448876 - Get rid of nsIClipboardDragDropHooks and nsIClipboardDragDropHookList interfaces r=bz
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 26 Mar 2018 23:56:53 +0900
changeset 410381 222afb91d7d3e0338965dea63536dd28f5348811
parent 410380 e16e68c35e9ac215a906823a9ca2f4a86ca84d83
child 410382 05f76e30598f77d7cc1f62e11d1a9af3c58ec33d
push id33728
push userrgurzau@mozilla.com
push dateWed, 28 Mar 2018 21:54:22 +0000
treeherdermozilla-central@c03413e3a823 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1448876
milestone61.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 1448876 - Get rid of nsIClipboardDragDropHooks and nsIClipboardDragDropHookList interfaces r=bz nsIClipboardDragDropHooks and nsIClipboardDragDropHookList allow XUL apps to customize drag and drop operation and paste operation. However, this feature was used only by ChatZilla and it doesn't work on Gecko anymore. So, we can get rid of them from our tree. MozReview-Commit-ID: Ibs3V1gI8Ry
docshell/base/moz.build
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsDocShellTransferableHooks.cpp
docshell/base/nsDocShellTransferableHooks.h
dom/base/nsCopySupport.cpp
dom/base/nsCopySupport.h
dom/base/nsGlobalWindowCommands.cpp
editor/libeditor/EditorUtils.cpp
editor/libeditor/EditorUtils.h
editor/libeditor/HTMLEditorDataTransfer.cpp
editor/libeditor/TextEditorDataTransfer.cpp
widget/moz.build
widget/nsIClipboardDragDropHookList.idl
widget/nsIClipboardDragDropHooks.idl
--- a/docshell/base/moz.build
+++ b/docshell/base/moz.build
@@ -81,17 +81,16 @@ EXPORTS.mozilla += [
 UNIFIED_SOURCES += [
     'LoadContext.cpp',
     'nsAboutRedirector.cpp',
     'nsDefaultURIFixup.cpp',
     'nsDocShell.cpp',
     'nsDocShellEditorData.cpp',
     'nsDocShellEnumerator.cpp',
     'nsDocShellLoadInfo.cpp',
-    'nsDocShellTransferableHooks.cpp',
     'nsDocShellTreeOwner.cpp',
     'nsDSURIContentListener.cpp',
     'nsPingListener.cpp',
     'nsRefreshTimer.cpp',
     'nsWebNavigationInfo.cpp',
     'SerializedLoadContext.cpp',
 ]
 
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -171,17 +171,16 @@
 #include "nsContentSecurityManager.h"
 #include "nsContentUtils.h"
 #include "nsCURILoader.h"
 #include "nsDocShellCID.h"
 #include "nsDocShellEditorData.h"
 #include "nsDocShellEnumerator.h"
 #include "nsDocShellLoadInfo.h"
 #include "nsDocShellLoadTypes.h"
-#include "nsDocShellTransferableHooks.h"
 #include "nsDOMCID.h"
 #include "nsDOMNavigationTiming.h"
 #include "nsDSURIContentListener.h"
 #include "nsError.h"
 #include "nsEscape.h"
 #include "nsFocusManager.h"
 #include "nsGlobalWindow.h"
 #include "nsJSEnvironment.h"
@@ -624,21 +623,16 @@ nsDocShell::GetInterface(const nsIID& aI
     *aSink = mFind;
     NS_ADDREF((nsISupports*)*aSink);
     return NS_OK;
   } else if (aIID.Equals(NS_GET_IID(nsIEditingSession))) {
     nsCOMPtr<nsIEditingSession> es;
     GetEditingSession(getter_AddRefs(es));
     es.forget(aSink);
     return *aSink ? NS_OK : NS_NOINTERFACE;
-  } else if (aIID.Equals(NS_GET_IID(nsIClipboardDragDropHookList)) &&
-             NS_SUCCEEDED(EnsureTransferableHookData())) {
-    *aSink = mTransferableHookData;
-    NS_ADDREF((nsISupports*)*aSink);
-    return NS_OK;
   } else if (aIID.Equals(NS_GET_IID(nsISelectionDisplay))) {
     nsIPresShell* shell = GetPresShell();
     if (shell) {
       return shell->QueryInterface(aIID, aSink);
     }
   } else if (aIID.Equals(NS_GET_IID(nsIDocShellTreeOwner))) {
     nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
     nsresult rv = GetTreeOwner(getter_AddRefs(treeOwner));
@@ -5505,18 +5499,16 @@ nsDocShell::Destroy()
     // course.
   }
 
   // Stop any URLs that are currently being loaded...
   Stop(nsIWebNavigation::STOP_ALL);
 
   mEditorData = nullptr;
 
-  mTransferableHookData = nullptr;
-
   // Save the state of the current document, before destroying the window.
   // This is needed to capture the state of a frameset when the new document
   // causes the frameset to be destroyed...
   PersistLayoutHistoryState();
 
   // Remove this docshell from its parent's child list
   nsCOMPtr<nsIDocShellTreeItem> docShellParentAsItem =
     do_QueryInterface(GetAsSupports(mParent));
@@ -12995,28 +12987,16 @@ nsDocShell::EnsureEditorData()
     // per docshell.
     mEditorData = new nsDocShellEditorData(this);
   }
 
   return mEditorData ? NS_OK : NS_ERROR_NOT_AVAILABLE;
 }
 
 nsresult
-nsDocShell::EnsureTransferableHookData()
-{
-  MOZ_ASSERT(!mIsBeingDestroyed);
-
-  if (!mTransferableHookData) {
-    mTransferableHookData = new nsTransferableHookData();
-  }
-
-  return NS_OK;
-}
-
-nsresult
 nsDocShell::EnsureFind()
 {
   nsresult rv;
   if (!mFind) {
     mFind = do_CreateInstance("@mozilla.org/embedcomp/find;1", &rv);
     if (NS_FAILED(rv)) {
       return rv;
     }
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -69,17 +69,16 @@ enum class TaskCategory;
 namespace dom {
 class ClientInfo;
 class ClientSource;
 class EventTarget;
 typedef uint32_t ScreenOrientationInternal;
 } // namespace dom
 } // namespace mozilla
 
-class nsIClipboardDragDropHookList;
 class nsICommandManager;
 class nsIContentViewer;
 class nsIController;
 class nsIDocShellTreeOwner;
 class nsIDocument;
 class nsIDOMNode;
 class nsIGlobalHistory2;
 class nsIHttpChannel;
@@ -959,19 +958,16 @@ private: // data members
   // Holds a weak pointer to a RestorePresentationEvent object if any that
   // holds a weak pointer back to us. We use this pointer to possibly revoke
   // the event whenever necessary.
   nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
 
   // Editor data, if this document is designMode or contentEditable.
   nsAutoPtr<nsDocShellEditorData> mEditorData;
 
-  // Transferable hooks/callbacks
-  nsCOMPtr<nsIClipboardDragDropHookList> mTransferableHookData;
-
   // Secure browser UI object
   nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
 
   // The URI we're currently loading. This is only relevant during the
   // firing of a pagehide/unload. The caller of FirePageHideNotification()
   // is responsible for setting it and unsetting it. It may be null if the
   // pagehide/unload is happening for some reason other than just loading a
   // new URI.
deleted file mode 100644
--- a/docshell/base/nsDocShellTransferableHooks.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "nsDocShellTransferableHooks.h"
-#include "nsIClipboardDragDropHooks.h"
-#include "nsIClipboardDragDropHookList.h"
-#include "nsArrayEnumerator.h"
-
-nsTransferableHookData::nsTransferableHookData()
-{
-}
-
-nsTransferableHookData::~nsTransferableHookData()
-{
-}
-
-NS_IMPL_ISUPPORTS(nsTransferableHookData, nsIClipboardDragDropHookList)
-
-NS_IMETHODIMP
-nsTransferableHookData::AddClipboardDragDropHooks(
-    nsIClipboardDragDropHooks* aOverrides)
-{
-  NS_ENSURE_ARG(aOverrides);
-
-  // don't let a hook be added more than once
-  if (mHookList.IndexOfObject(aOverrides) == -1) {
-    if (!mHookList.AppendObject(aOverrides)) {
-      return NS_ERROR_FAILURE;
-    }
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsTransferableHookData::RemoveClipboardDragDropHooks(
-    nsIClipboardDragDropHooks* aOverrides)
-{
-  NS_ENSURE_ARG(aOverrides);
-  if (!mHookList.RemoveObject(aOverrides)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsTransferableHookData::GetHookEnumerator(nsISimpleEnumerator** aResult)
-{
-  return NS_NewArrayEnumerator(aResult, mHookList);
-}
deleted file mode 100644
--- a/docshell/base/nsDocShellTransferableHooks.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 nsDocShellTransferableHooks_h__
-#define nsDocShellTransferableHooks_h__
-
-#include "nsIClipboardDragDropHookList.h"
-#include "nsCOMArray.h"
-
-class nsIClipboardDragDropHooks;
-
-class nsTransferableHookData : public nsIClipboardDragDropHookList
-{
-public:
-  nsTransferableHookData();
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSICLIPBOARDDRAGDROPHOOKLIST
-
-protected:
-  virtual ~nsTransferableHookData();
-
-  nsCOMArray<nsIClipboardDragDropHooks> mHookList;
-};
-
-#endif // nsDocShellTransferableHooks_h__
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -21,18 +21,16 @@
 #include "imgIContainer.h"
 #include "imgIRequest.h"
 #include "nsIPresShell.h"
 #include "nsFocusManager.h"
 #include "mozilla/dom/DataTransfer.h"
 
 #include "nsIDocShell.h"
 #include "nsIContentViewerEdit.h"
-#include "nsIClipboardDragDropHooks.h"
-#include "nsIClipboardDragDropHookList.h"
 #include "nsIClipboardHelper.h"
 #include "nsISelectionController.h"
 
 #include "nsPIDOMWindow.h"
 #include "nsIDocument.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
@@ -274,22 +272,18 @@ SelectionCopyHelper(nsISelection *aSel, 
         if (!textPlainBuf.IsEmpty()) {
           // Add the unicode DataFlavor to the transferable
           rv = AppendString(trans, textPlainBuf, kUnicodeMime);
           NS_ENSURE_SUCCESS(rv, rv);
         }
       }
 
       if (doPutOnClipboard && clipboard) {
-        bool actuallyPutOnClipboard = true;
-        nsCopySupport::DoHooks(aDoc, trans, &actuallyPutOnClipboard);
-
         // put the transferable on the clipboard
-        if (actuallyPutOnClipboard)
-          clipboard->SetData(trans, nullptr, aClipboardID);
+        clipboard->SetData(trans, nullptr, aClipboardID);
       }
 
       // Return the transferable to the caller if requested.
       if (aTransferable != nullptr) {
         trans.swap(*aTransferable);
       }
     }
   }
@@ -346,59 +340,16 @@ nsCopySupport::GetTransferableForNode(ns
     return result.StealNSResult();
   }
   // It's not the primary selection - so don't skip invisible content.
   uint32_t flags = 0;
   return SelectionCopyHelper(selection, aDoc, false, 0, flags,
                              aTransferable);
 }
 
-nsresult nsCopySupport::DoHooks(nsIDocument *aDoc, nsITransferable *aTrans,
-                                bool *aDoPutOnClipboard)
-{
-  NS_ENSURE_ARG(aDoc);
-
-  *aDoPutOnClipboard = true;
-
-  nsCOMPtr<nsISupports> container = aDoc->GetContainer();
-  nsCOMPtr<nsIClipboardDragDropHookList> hookObj = do_GetInterface(container);
-  if (!hookObj) return NS_ERROR_FAILURE;
-
-  nsCOMPtr<nsISimpleEnumerator> enumerator;
-  hookObj->GetHookEnumerator(getter_AddRefs(enumerator));
-  if (!enumerator) return NS_ERROR_FAILURE;
-
-  // the logic here should follow the behavior specified in
-  // nsIClipboardDragDropHooks.h
-
-  nsCOMPtr<nsIClipboardDragDropHooks> override;
-  nsCOMPtr<nsISupports> isupp;
-  bool hasMoreHooks = false;
-  nsresult rv = NS_OK;
-  while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreHooks))
-         && hasMoreHooks)
-  {
-    rv = enumerator->GetNext(getter_AddRefs(isupp));
-    if (NS_FAILED(rv)) break;
-    override = do_QueryInterface(isupp);
-    if (override)
-    {
-#ifdef DEBUG
-      nsresult hookResult =
-#endif
-      override->OnCopyOrDrag(nullptr, aTrans, aDoPutOnClipboard);
-      NS_ASSERTION(NS_SUCCEEDED(hookResult), "OnCopyOrDrag hook failed");
-      if (!*aDoPutOnClipboard)
-        break;
-    }
-  }
-
-  return rv;
-}
-
 nsresult
 nsCopySupport::GetContents(const nsACString& aMimeType, uint32_t aFlags, nsISelection *aSel, nsIDocument *aDoc, nsAString& outdata)
 {
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIDocumentEncoder> docEncoder;
 
   nsAutoCString encoderContractID(NS_DOC_ENCODER_CONTRACTID_BASE);
--- a/dom/base/nsCopySupport.h
+++ b/dom/base/nsCopySupport.h
@@ -28,18 +28,16 @@ class Selection;
 
 class nsCopySupport
 {
   // class of static helper functions for copy support
   public:
     static nsresult ClearSelectionCache();
     static nsresult HTMLCopy(nsISelection *aSel, nsIDocument *aDoc,
                              int16_t aClipboardID, bool aWithRubyAnnotation);
-    static nsresult DoHooks(nsIDocument *aDoc, nsITransferable *aTrans,
-                            bool *aDoPutOnClipboard);
 
     // Get the selection, or entire document, in the format specified by the mime type
     // (text/html or text/plain). If aSel is non-null, use it, otherwise get the entire
     // doc.
     static nsresult GetContents(const nsACString& aMimeType, uint32_t aFlags, nsISelection *aSel, nsIDocument *aDoc, nsAString& outdata);
 
     static nsresult ImageCopy(nsIImageLoadingContent* aImageElement,
                               nsILoadContext* aLoadContext,
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -32,19 +32,16 @@
 #include "ContentEventHandler.h"
 #include "nsContentUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Selection.h"
 #include "mozilla/layers/KeyboardMap.h"
 
-#include "nsIClipboardDragDropHooks.h"
-#include "nsIClipboardDragDropHookList.h"
-
 using namespace mozilla;
 using namespace mozilla::layers;
 
 constexpr const char * sSelectAllString = "cmd_selectAll";
 constexpr const char * sSelectNoneString = "cmd_selectNone";
 constexpr const char * sCopyImageLocationString = "cmd_copyImageLocation";
 constexpr const char * sCopyImageContentsString = "cmd_copyImageContents";
 constexpr const char * sCopyImageString = "cmd_copyImage";
@@ -913,111 +910,16 @@ nsGoBackCommand::IsWebNavCommandEnabled(
 
 nsresult
 nsGoBackCommand::DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation)
 {
   return aWebNavigation->GoBack();
 }
 #endif
 
-/*---------------------------------------------------------------------------
-
-  nsClipboardDragDropHookCommand
-      params        value type   possible values
-      "addhook"     isupports    nsIClipboardDragDropHooks as nsISupports
-      "removehook"  isupports    nsIClipboardDragDropHooks as nsISupports
-
-----------------------------------------------------------------------------*/
-
-class nsClipboardDragDropHookCommand final : public nsIControllerCommand
-{
-  ~nsClipboardDragDropHookCommand() {}
-
-public:
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSICONTROLLERCOMMAND
-
-protected:
-  // no member variables, please, we're stateless!
-};
-
-
-NS_IMPL_ISUPPORTS(nsClipboardDragDropHookCommand, nsIControllerCommand)
-
-NS_IMETHODIMP
-nsClipboardDragDropHookCommand::IsCommandEnabled(const char * aCommandName,
-                                                 nsISupports *aCommandContext,
-                                                 bool *outCmdEnabled)
-{
-  *outCmdEnabled = true;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsClipboardDragDropHookCommand::DoCommand(const char *aCommandName,
-                                          nsISupports *aCommandContext)
-{
-  return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-nsClipboardDragDropHookCommand::DoCommandParams(const char *aCommandName,
-                                                nsICommandParams *aParams,
-                                                nsISupports *aCommandContext)
-{
-  NS_ENSURE_ARG(aParams);
-
-  nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(aCommandContext);
-  NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
-
-  nsIDocShell *docShell = window->GetDocShell();
-
-  nsCOMPtr<nsIClipboardDragDropHookList> obj = do_GetInterface(docShell);
-  if (!obj) return NS_ERROR_INVALID_ARG;
-
-  nsCOMPtr<nsISupports> isuppHook;
-
-  nsresult returnValue = NS_OK;
-  nsresult rv = aParams->GetISupportsValue("addhook", getter_AddRefs(isuppHook));
-  if (NS_SUCCEEDED(rv))
-  {
-    nsCOMPtr<nsIClipboardDragDropHooks> hook = do_QueryInterface(isuppHook);
-    if (hook)
-      returnValue = obj->AddClipboardDragDropHooks(hook);
-    else
-      returnValue = NS_ERROR_INVALID_ARG;
-  }
-
-  rv = aParams->GetISupportsValue("removehook", getter_AddRefs(isuppHook));
-  if (NS_SUCCEEDED(rv))
-  {
-    nsCOMPtr<nsIClipboardDragDropHooks> hook = do_QueryInterface(isuppHook);
-    if (hook)
-    {
-      rv = obj->RemoveClipboardDragDropHooks(hook);
-      if (NS_FAILED(rv) && NS_SUCCEEDED(returnValue))
-        returnValue = rv;
-    }
-    else
-      returnValue = NS_ERROR_INVALID_ARG;
-  }
-
-  return returnValue;
-}
-
-NS_IMETHODIMP
-nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
-                                                      nsICommandParams *aParams,
-                                                      nsISupports *aCommandContext)
-{
-  NS_ENSURE_ARG_POINTER(aParams);
-  return aParams->SetBooleanValue("state_enabled", true);
-}
-
 class nsLookUpDictionaryCommand final : public nsIControllerCommand
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTROLLERCOMMAND
 
 private:
   virtual ~nsLookUpDictionaryCommand()
@@ -1274,18 +1176,16 @@ nsWindowCommandRegistration::RegisterWin
 
   NS_REGISTER_ONE_COMMAND(nsClipboardGetContentsCommand, "cmd_getContents");
 
 #if 0   // Remove unless needed again, bug 204777
   NS_REGISTER_ONE_COMMAND(nsGoBackCommand, "cmd_browserBack");
   NS_REGISTER_ONE_COMMAND(nsGoForwardCommand, "cmd_browserForward");
 #endif
 
-  NS_REGISTER_ONE_COMMAND(nsClipboardDragDropHookCommand, "cmd_clipboardDragDropHook");
-
   NS_REGISTER_ONE_COMMAND(nsLookUpDictionaryCommand, "cmd_lookUpDictionary");
 
   return rv;
 }
 
 /* static */ bool
 nsGlobalWindowCommands::FindScrollCommand(const char* aCommandName,
                                           KeyboardScrollAction* aOutAction)
--- a/editor/libeditor/EditorUtils.cpp
+++ b/editor/libeditor/EditorUtils.cpp
@@ -5,27 +5,23 @@
 
 #include "mozilla/EditorUtils.h"
 
 #include "mozilla/EditorDOMPoint.h"
 #include "mozilla/OwningNonNull.h"
 #include "mozilla/dom/Selection.h"
 #include "nsComponentManagerUtils.h"
 #include "nsError.h"
-#include "nsIClipboardDragDropHookList.h"
-// hooks
-#include "nsIClipboardDragDropHooks.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
 #include "nsIDOMDocument.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsINode.h"
-#include "nsISimpleEnumerator.h"
 
 class nsISupports;
 class nsRange;
 
 namespace mozilla {
 
 using namespace dom;
 
@@ -178,57 +174,9 @@ EditorUtils::IsDescendantOf(const nsINod
       aOutPoint->Set(node->AsContent());
       return true;
     }
   }
 
   return false;
 }
 
-/******************************************************************************
- * utility methods for drag/drop/copy/paste hooks
- *****************************************************************************/
-
-nsresult
-EditorHookUtils::GetHookEnumeratorFromDocument(nsIDOMDocument* aDoc,
-                                               nsISimpleEnumerator** aResult)
-{
-  nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDoc);
-  NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
-
-  nsCOMPtr<nsIDocShell> docShell = doc->GetDocShell();
-  nsCOMPtr<nsIClipboardDragDropHookList> hookObj = do_GetInterface(docShell);
-  NS_ENSURE_TRUE(hookObj, NS_ERROR_FAILURE);
-
-  return hookObj->GetHookEnumerator(aResult);
-}
-
-bool
-EditorHookUtils::DoInsertionHook(nsIDOMDocument* aDoc,
-                                 nsIDOMEvent* aDropEvent,
-                                 nsITransferable *aTrans)
-{
-  nsCOMPtr<nsISimpleEnumerator> enumerator;
-  GetHookEnumeratorFromDocument(aDoc, getter_AddRefs(enumerator));
-  NS_ENSURE_TRUE(enumerator, true);
-
-  bool hasMoreHooks = false;
-  while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreHooks)) &&
-         hasMoreHooks) {
-    nsCOMPtr<nsISupports> isupp;
-    if (NS_FAILED(enumerator->GetNext(getter_AddRefs(isupp)))) {
-      break;
-    }
-
-    nsCOMPtr<nsIClipboardDragDropHooks> override = do_QueryInterface(isupp);
-    if (override) {
-      bool doInsert = true;
-      DebugOnly<nsresult> hookResult =
-        override->OnPasteOrDrop(aDropEvent, aTrans, &doInsert);
-      NS_ASSERTION(NS_SUCCEEDED(hookResult), "hook failure in OnPasteOrDrop");
-      NS_ENSURE_TRUE(doInsert, false);
-    }
-  }
-
-  return true;
-}
-
 } // namespace mozilla
--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -541,23 +541,11 @@ public:
   static bool IsDescendantOf(const nsINode& aNode,
                              const nsINode& aParent,
                              EditorRawDOMPoint* aOutPoint = nullptr);
   static bool IsDescendantOf(const nsINode& aNode,
                              const nsINode& aParent,
                              EditorDOMPoint* aOutPoint);
 };
 
-class EditorHookUtils final
-{
-public:
-  static bool DoInsertionHook(nsIDOMDocument* aDoc, nsIDOMEvent* aEvent,
-                              nsITransferable* aTrans);
-
-private:
-  static nsresult GetHookEnumeratorFromDocument(
-                    nsIDOMDocument*aDoc,
-                    nsISimpleEnumerator** aEnumerator);
-};
-
 } // namespace mozilla
 
 #endif // #ifndef mozilla_EditorUtils_h
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -1410,42 +1410,29 @@ HTMLEditor::Paste(int32_t aSelectionType
       nsAutoString text;
       textDataObj = do_QueryInterface(infoDataObj);
       textDataObj->GetData(text);
       NS_ASSERTION(text.Length() <= (infoLen/2), "Invalid length!");
       infoStr.Assign(text.get(), infoLen / 2);
     }
   }
 
-  // handle transferable hooks
-  nsCOMPtr<nsIDOMDocument> domdoc;
-  GetDocument(getter_AddRefs(domdoc));
-  if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, trans)) {
-    return NS_OK;
-  }
-
   return InsertFromTransferable(trans, nullptr, contextStr, infoStr, bHavePrivateHTMLFlavor,
                                 nullptr, 0, true);
 }
 
 NS_IMETHODIMP
 HTMLEditor::PasteTransferable(nsITransferable* aTransferable)
 {
   // Use an invalid value for the clipboard type as data comes from aTransferable
   // and we don't currently implement a way to put that in the data transfer yet.
   if (!FireClipboardEvent(ePaste, nsIClipboard::kGlobalClipboard)) {
     return NS_OK;
   }
 
-  // handle transferable hooks
-  nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
-  if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, aTransferable)) {
-    return NS_OK;
-  }
-
   nsAutoString contextStr, infoStr;
   return InsertFromTransferable(aTransferable, nullptr, contextStr, infoStr, false,
                                 nullptr, 0, true);
 }
 
 /**
  * HTML PasteNoFormatting. Ignore any HTML styles and formating in paste source.
  */
--- a/editor/libeditor/TextEditorDataTransfer.cpp
+++ b/editor/libeditor/TextEditorDataTransfer.cpp
@@ -305,22 +305,16 @@ TextEditor::Paste(int32_t aSelectionType
 
   // Get the nsITransferable interface for getting the data from the clipboard
   nsCOMPtr<nsITransferable> trans;
   rv = PrepareTransferable(getter_AddRefs(trans));
   if (NS_SUCCEEDED(rv) && trans) {
     // Get the Data from the clipboard
     if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) &&
         IsModifiable()) {
-      // handle transferable hooks
-      nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
-      if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, trans)) {
-        return NS_OK;
-      }
-
       rv = InsertTextFromTransferable(trans, nullptr, 0, true);
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
@@ -331,22 +325,16 @@ TextEditor::PasteTransferable(nsITransfe
   if (!FireClipboardEvent(ePaste, -1)) {
     return NS_OK;
   }
 
   if (!IsModifiable()) {
     return NS_OK;
   }
 
-  // handle transferable hooks
-  nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
-  if (!EditorHookUtils::DoInsertionHook(domdoc, nullptr, aTransferable)) {
-    return NS_OK;
-  }
-
   return InsertTextFromTransferable(aTransferable, nullptr, 0, true);
 }
 
 NS_IMETHODIMP
 TextEditor::CanPaste(int32_t aSelectionType,
                      bool* aCanPaste)
 {
   NS_ENSURE_ARG_POINTER(aCanPaste);
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -89,18 +89,16 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']
         'nsITaskbarProgress.idl',
     ]
 
 XPIDL_SOURCES += [
     'nsIAppShell.idl',
     'nsIBaseWindow.idl',
     'nsIBidiKeyboard.idl',
     'nsIClipboard.idl',
-    'nsIClipboardDragDropHookList.idl',
-    'nsIClipboardDragDropHooks.idl',
     'nsIClipboardHelper.idl',
     'nsIClipboardOwner.idl',
     'nsIColorPicker.idl',
     'nsIDisplayInfo.idl',
     'nsIDragService.idl',
     'nsIDragSession.idl',
     'nsIFilePicker.idl',
     'nsIFormatConverter.idl',
deleted file mode 100644
--- a/widget/nsIClipboardDragDropHookList.idl
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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 nsIClipboardDragDropHooks;
-interface nsISimpleEnumerator;
-
-
-/**
- * Please note that the following api is not intended for embedders;
- * it is intended as an internal (to gecko).  Embedders can indirectly
- * call these by sending commands (see description in 
- * nsIClipboardDragDropHooks.idl).
- *
- * Internal gecko usage is accomplished by calling get_Interface on a
- * docshell.
- */
-
-
-// 876A2015-6B66-11D7-8F18-0003938A9D96
-[scriptable,uuid(876A2015-6B66-11D7-8F18-0003938A9D96)]
-interface nsIClipboardDragDropHookList : nsISupports
-{
-  /**
-   * Add a hook to list.
-   * @param aHooks  implementation of hooks
-   */
-  void addClipboardDragDropHooks(in nsIClipboardDragDropHooks aHooks);
-
-  /**
-   * Remove a hook from list (note if this implementation is not present
-   * in the list then removal will be ignored).
-   * @param aHooks  implementation of hooks
-   */
-  void removeClipboardDragDropHooks(in nsIClipboardDragDropHooks aHooks);
-
-  /**
-   * Gets an enumerator for all hooks which have been added.
-   * @return nsISimpleEnumerator for nsIClipboardDragDropHooks
-   */
-  nsISimpleEnumerator getHookEnumerator();
-};
-
deleted file mode 100644
--- a/widget/nsIClipboardDragDropHooks.idl
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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 nsITransferable;
-interface nsIDragSession;
-interface nsIDOMEvent;
-
-
-/**
- * Interfaces for overriding the built-in drag, drop, copy, and paste
- * implementations in the content area and editors. Use this to do things
- * such as prevent a drag from starting, adding or removing
- * data and flavors, or preventing the drop.
- *
- * Embedders who want to have these hooks made available should implement
- * nsIClipboardDragDropHooks and use the command manager to send the
- * appropriate commands with these parameters/settings: 
- *      command:  cmd_clipboardDragDropHook
- *
- *      params        value type   possible values
- *      "addhook"     isupports    nsIClipboardDragDropHooks as nsISupports
- *      "removehook"  isupports    nsIClipboardDragDropHooks as nsISupports
- *
- * Notes:
- *  * Overrides/hooks need to be added to each window (as appropriate).
- *    Adding them to the first window does not enable them for every window.
- *  * If more than one implementation is set for a window, the hooks will be
- *    called in the order they are added.
- *  * Adding the same hook to the same window will not add a second call.
- *    Each hook can only be called once per user action/api.
- *  * Not all hooks are guaranteed to be called.  If there are multiple hooks
- *    set for a window, any of them has an opportunity to cancel the action
- *    so no further processing will occur.
- *  * If any errors occur (without setting the boolean result) the default
- *    action will occur.
- *  * AllowDrop will be called MANY times during drag so ensure that it is
- *    efficient. 
- */
-
-
-[scriptable,uuid(e03e6c5e-0d84-4c0b-8739-e6b8d51922de)]
-interface nsIClipboardDragDropHooks : nsISupports
-{
-  /**
-   * Prevents the drag from starting
-   *
-   * @param event DOM event (drag gesture)
-   *
-   * @return TRUE  drag can proceed
-   * @return FALSE drag is cancelled, does not go to OS
-   */
-  boolean allowStartDrag(in nsIDOMEvent event);
-  
-  /**
-   * Tells gecko whether a drop is allowed on this content area
-   *
-   * @param event   DOM event (drag over)
-   * @param session the drag session from which client can get
-   *                   the flavors present or the actual data
-   *
-   * @return TRUE  indicates to OS that if a drop does happen on this
-   *                browser, it will be accepted.
-   * @return FALSE indicates to OS drop is not allowed. On win32, this
-   *                will change the cursor to "reject".
-   */
-  boolean allowDrop(in nsIDOMEvent event, in nsIDragSession session);
-
-  /**
-   * Alter the flavors or data presented to the OS
-   * Used for drag and copy actions
-   * Because this can be called many times, it is highly recommended
-   * that the implementation be very efficient so user feedback is
-   * not negatively impacted.
-   *
-   * @param event  DOM event (drag drop); null if triggered by copy.
-   * @param trans  the transferable holding the list of flavors
-   *               and the data for each flavor
-   *
-   * @return TRUE  copy/drag can proceed
-   * @return FALSE copy/drag is cancelled, does not go to OS
-   */
-  boolean onCopyOrDrag(in nsIDOMEvent aEvent, in nsITransferable trans);
-
-  /**
-   * Provide an alternative action to the built-in behavior when
-   * something is dropped on the browser or in an editor
-   *
-   * @param event  DOM event (drag drop); null if triggered by paste.
-   * @param trans  the transferable holding the list of flavors
-   *               and the data for each flavor
-   *
-   * @return TRUE  action was handled, do not perform built-in
-   *                behavior
-   * @return FALSE action was not overridden, do built-in behavior
-   */
-  boolean onPasteOrDrop(in nsIDOMEvent event, in nsITransferable trans);
-};
-