Bug 363089, Remove nsIDOMEventReceiver, r+sr=jst
authorOlli.Pettay@helsinki.fi
Fri, 11 May 2007 04:15:11 -0700
changeset 1367 6506cd554cf6b753b4eb90d61c9a23abae98029a
parent 1366 e48e5be83e2561bf58ce2418e403d7646d40f44d
child 1368 b5c9deb7048ab235eef7a68cc44f1b093fead1c2
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs363089
milestone1.9a5pre
Bug 363089, Remove nsIDOMEventReceiver, r+sr=jst
content/base/src/nsContentAreaDragDrop.cpp
content/base/src/nsContentAreaDragDrop.h
content/base/src/nsContentUtils.cpp
content/base/src/nsDOMAttribute.cpp
content/base/src/nsDOMAttribute.h
content/base/src/nsDOMParser.cpp
content/base/src/nsDocument.cpp
content/base/src/nsDocument.h
content/base/src/nsGenericDOMDataNode.cpp
content/base/src/nsGenericDOMDataNode.h
content/base/src/nsGenericElement.cpp
content/base/src/nsGenericElement.h
content/base/src/nsSyncLoadService.cpp
content/base/src/nsXMLHttpRequest.cpp
content/events/public/nsPIDOMEventTarget.h
content/events/src/nsEventDispatcher.cpp
content/events/src/nsEventListenerManager.cpp
content/events/src/nsEventListenerManager.h
content/events/src/nsXMLEventsManager.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsHTMLAnchorElement.cpp
content/html/content/src/nsHTMLAreaElement.cpp
content/html/content/src/nsHTMLBRElement.cpp
content/html/content/src/nsHTMLBodyElement.cpp
content/html/content/src/nsHTMLButtonElement.cpp
content/html/content/src/nsHTMLDelElement.cpp
content/html/content/src/nsHTMLDivElement.cpp
content/html/content/src/nsHTMLFieldSetElement.cpp
content/html/content/src/nsHTMLFontElement.cpp
content/html/content/src/nsHTMLFormElement.cpp
content/html/content/src/nsHTMLFrameSetElement.cpp
content/html/content/src/nsHTMLHRElement.cpp
content/html/content/src/nsHTMLHeadElement.cpp
content/html/content/src/nsHTMLHeadingElement.cpp
content/html/content/src/nsHTMLHtmlElement.cpp
content/html/content/src/nsHTMLImageElement.cpp
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsHTMLLIElement.cpp
content/html/content/src/nsHTMLLabelElement.cpp
content/html/content/src/nsHTMLLegendElement.cpp
content/html/content/src/nsHTMLLinkElement.cpp
content/html/content/src/nsHTMLMapElement.cpp
content/html/content/src/nsHTMLMetaElement.cpp
content/html/content/src/nsHTMLOListElement.cpp
content/html/content/src/nsHTMLOptGroupElement.cpp
content/html/content/src/nsHTMLOptionElement.cpp
content/html/content/src/nsHTMLParagraphElement.cpp
content/html/content/src/nsHTMLPreElement.cpp
content/html/content/src/nsHTMLScriptElement.cpp
content/html/content/src/nsHTMLSelectElement.cpp
content/html/content/src/nsHTMLSpanElement.cpp
content/html/content/src/nsHTMLStyleElement.cpp
content/html/content/src/nsHTMLTableCaptionElement.cpp
content/html/content/src/nsHTMLTableCellElement.cpp
content/html/content/src/nsHTMLTableColElement.cpp
content/html/content/src/nsHTMLTableElement.cpp
content/html/content/src/nsHTMLTableRowElement.cpp
content/html/content/src/nsHTMLTableSectionElement.cpp
content/html/content/src/nsHTMLTextAreaElement.cpp
content/html/content/src/nsHTMLTitleElement.cpp
content/svg/content/src/nsSVGElement.cpp
content/xbl/public/nsIXBLService.h
content/xbl/src/nsXBLBinding.cpp
content/xbl/src/nsXBLEventHandler.cpp
content/xbl/src/nsXBLEventHandler.h
content/xbl/src/nsXBLPrototypeBinding.cpp
content/xbl/src/nsXBLPrototypeHandler.cpp
content/xbl/src/nsXBLPrototypeHandler.h
content/xbl/src/nsXBLService.cpp
content/xbl/src/nsXBLService.h
content/xbl/src/nsXBLWindowKeyHandler.cpp
content/xbl/src/nsXBLWindowKeyHandler.h
content/xul/content/src/nsXULElement.cpp
content/xul/content/src/nsXULElement.h
content/xul/document/src/nsXULDocument.cpp
content/xul/document/src/nsXULDocument.h
dom/public/coreEvents/Makefile.in
dom/public/coreEvents/nsIDOMEventReceiver.h
dom/src/base/nsDOMClassInfo.cpp
dom/src/base/nsGlobalWindow.cpp
dom/src/base/nsGlobalWindow.h
dom/src/base/nsWindowRoot.cpp
dom/src/base/nsWindowRoot.h
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsEditor.h
editor/libeditor/html/nsHTMLAbsPosition.cpp
editor/libeditor/html/nsHTMLDataTransfer.cpp
editor/libeditor/html/nsHTMLEditor.cpp
editor/libeditor/html/nsHTMLObjectResizer.cpp
editor/libeditor/text/nsPlaintextDataTransfer.cpp
editor/libeditor/text/nsPlaintextEditor.cpp
embedding/browser/gtk/src/EmbedPrivate.cpp
embedding/browser/gtk/src/EmbedPrivate.h
embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
embedding/browser/webBrowser/nsDocShellTreeOwner.h
extensions/python/dom/src/nsPyDOMModule.cpp
extensions/python/dom/src/nsPyRuntime.cpp
extensions/spellcheck/src/mozInlineSpellChecker.cpp
layout/base/nsDocumentViewer.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsIsIndexFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsImageMap.cpp
layout/generic/nsObjectFrame.cpp
layout/mathml/base/src/nsMathMLmactionFrame.cpp
layout/printing/nsPrintEngine.cpp
layout/xul/base/src/nsListBoxBodyFrame.cpp
layout/xul/base/src/nsMenuBarFrame.cpp
layout/xul/base/src/nsMenuBarFrame.h
layout/xul/base/src/nsMenuBarListener.cpp
layout/xul/base/src/nsMenuBarListener.h
layout/xul/base/src/nsMenuDismissalListener.h
layout/xul/base/src/nsMenuListener.cpp
layout/xul/base/src/nsMenuListener.h
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsMenuPopupFrame.h
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsSplitterFrame.cpp
xpfe/appshell/src/nsWebShellWindow.cpp
--- a/content/base/src/nsContentAreaDragDrop.cpp
+++ b/content/base/src/nsContentAreaDragDrop.cpp
@@ -45,17 +45,16 @@
 #include "nsString.h"
 
 // Interfaces needed to be included
 #include "nsIDOMNSUIEvent.h"
 #include "nsIDOMUIEvent.h"
 #include "nsISelection.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMAbstractView.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentRange.h"
 #include "nsIDOMRange.h"
@@ -93,16 +92,17 @@
 #include "nsIWebBrowserPersist.h"
 #include "nsEscape.h"
 #include "nsContentUtils.h"
 #include "nsIMIMEService.h"
 #include "imgIRequest.h"
 #include "nsContentCID.h"
 #include "nsISelectionController.h"
 #include "nsFrameSelection.h"
+#include "nsIDOMEventTarget.h"
 
 // private clipboard data flavors for html copy, used by editor when pasting
 #define kHTMLContext   "text/_moz_htmlcontext"
 #define kHTMLInfo      "text/_moz_htmlinfo"
 
 
 NS_IMPL_ADDREF(nsContentAreaDragDrop)
 NS_IMPL_RELEASE(nsContentAreaDragDrop)
@@ -185,19 +185,19 @@ nsContentAreaDragDrop::~nsContentAreaDra
 } // dtor
 
 
 NS_IMETHODIMP
 nsContentAreaDragDrop::HookupTo(nsIDOMEventTarget *inAttachPoint,
                                 nsIWebNavigation* inNavigator)
 {
   NS_ASSERTION(inAttachPoint, "Can't hookup Drag Listeners to NULL receiver");
-  mEventReceiver = do_QueryInterface(inAttachPoint);
-  NS_ASSERTION(mEventReceiver,
-               "Target doesn't implement nsIDOMEventReceiver as needed");
+  mEventTarget = do_QueryInterface(inAttachPoint);
+  NS_ASSERTION(mEventTarget,
+               "Target doesn't implement nsPIDOMEventTarget as needed");
   mNavigator = inNavigator;
 
   return AddDragListener();
 }
 
 
 NS_IMETHODIMP
 nsContentAreaDragDrop::Detach()
@@ -211,20 +211,20 @@ nsContentAreaDragDrop::Detach()
 //
 // Subscribe to the events that will allow us to track drags.
 //
 nsresult
 nsContentAreaDragDrop::AddDragListener()
 {
   nsresult rv = NS_ERROR_FAILURE;
 
-  if ( mEventReceiver ) {
+  if (mEventTarget) {
     nsIDOMDragListener *pListener = NS_STATIC_CAST(nsIDOMDragListener *, this);
-    rv = mEventReceiver->AddEventListenerByIID(pListener,
-                                               NS_GET_IID(nsIDOMDragListener));
+    rv = mEventTarget->AddEventListenerByIID(pListener,
+                                             NS_GET_IID(nsIDOMDragListener));
     if (NS_SUCCEEDED(rv))
       mListenerInstalled = PR_TRUE;
   }
 
   return rv;
 }
 
 
@@ -233,24 +233,24 @@ nsContentAreaDragDrop::AddDragListener()
 //
 // Unsubscribe from all the various drag events that we were listening to.
 //
 nsresult
 nsContentAreaDragDrop::RemoveDragListener()
 {
   nsresult rv = NS_ERROR_FAILURE;
 
-  if (mEventReceiver) {
+  if (mEventTarget) {
     nsIDOMDragListener *pListener = NS_STATIC_CAST(nsIDOMDragListener *, this);
     rv =
-      mEventReceiver->RemoveEventListenerByIID(pListener,
-                                               NS_GET_IID(nsIDOMDragListener));
+      mEventTarget->RemoveEventListenerByIID(pListener,
+                                             NS_GET_IID(nsIDOMDragListener));
     if (NS_SUCCEEDED(rv))
       mListenerInstalled = PR_FALSE;
-    mEventReceiver = nsnull;
+    mEventTarget = nsnull;
   }
 
   return rv;
 }
 
 
 
 //
--- a/content/base/src/nsContentAreaDragDrop.h
+++ b/content/base/src/nsContentAreaDragDrop.h
@@ -39,17 +39,17 @@
 #ifndef nsContentAreaDragDrop_h__
 #define nsContentAreaDragDrop_h__
 
 
 #include "nsCOMPtr.h"
 
 #include "nsIDragDropHandler.h"
 #include "nsIDOMDragListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsPIDOMEventTarget.h"
 #include "nsITransferable.h"
 
 class nsIDOMNode;
 class nsISelection;
 class nsITransferable;
 class nsIImage;
 class nsIPresShell;
 class nsPresContext;
@@ -115,17 +115,17 @@ private:
   void ExtractURLFromData(const nsACString & inFlavor,
                           nsISupports* inDataWrapper, PRUint32 inDataLen,
                           nsAString & outURL);
   nsresult GetHookEnumeratorFromEvent(nsIDOMEvent* inEvent,
                                       nsISimpleEnumerator** outEnumerator);
 
   PRPackedBool mListenerInstalled;
 
-  nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
+  nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
 
   // weak ref, this is probably my owning webshell
   // FIXME: we set this and never null it out.  That's bad!  See bug 332187.
   nsIWebNavigation* mNavigator;
 
 };
 
 
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -102,17 +102,16 @@
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsILoadGroup.h"
 #include "nsContentPolicyUtils.h"
 #include "nsNodeInfoManager.h"
 #include "nsIXBLService.h"
 #include "nsCRT.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDOMDocumentEvent.h"
 #ifdef MOZ_XTF
 #include "nsIXTFService.h"
 static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
 #endif
 #include "nsIMIMEService.h"
 #include "nsLWBrkCIID.h"
@@ -2975,20 +2974,20 @@ nsContentUtils::HasMutationListeners(nsI
   // global object will be null for documents that don't have windows.
   nsCOMPtr<nsPIDOMWindow> window;
   window = do_QueryInterface(doc->GetScriptGlobalObject());
   if (window && !window->HasMutationListeners(aType)) {
     return PR_FALSE;
   }
 
   // If we have a window, we can check it for mutation listeners now.
-  nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(window));
-  if (rec) {
+  nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(window));
+  if (piTarget) {
     nsCOMPtr<nsIEventListenerManager> manager;
-    rec->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
+    piTarget->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
     if (manager) {
       PRBool hasListeners = PR_FALSE;
       manager->HasMutationListeners(&hasListeners);
       if (hasListeners) {
         return PR_TRUE;
       }
     }
   }
--- a/content/base/src/nsDOMAttribute.cpp
+++ b/content/base/src/nsDOMAttribute.cpp
@@ -51,16 +51,17 @@
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOM3Attr.h"
 #include "nsIDOMUserDataHandler.h"
 #include "nsEventDispatcher.h"
 #include "nsGkAtoms.h"
 #include "nsCOMArray.h"
 #include "nsNodeUtils.h"
+#include "nsIEventListenerManager.h"
 
 //----------------------------------------------------------------------
 PRBool nsDOMAttribute::sInitialized;
 
 nsDOMAttribute::nsDOMAttribute(nsDOMAttributeMap *aAttrMap,
                                nsINodeInfo       *aNodeInfo,
                                const nsAString   &aValue)
   : nsIAttribute(aAttrMap, aNodeInfo), mValue(aValue)
@@ -729,24 +730,59 @@ nsDOMAttribute::PostHandleEvent(nsEventC
 nsresult
 nsDOMAttribute::DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
                                  nsPresContext* aPresContext,
                                  nsEventStatus* aEventStatus)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP
+nsresult
 nsDOMAttribute::GetListenerManager(PRBool aCreateIfNotFound,
                                    nsIEventListenerManager** aResult)
 {
   return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
 }
 
 nsresult
+nsDOMAttribute::AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                      const nsIID& aIID)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
+  }
+  return rv;
+}
+
+nsresult
+nsDOMAttribute::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                         const nsIID& aIID)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  GetListenerManager(PR_FALSE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
+  }
+  return NS_OK;
+}
+
+nsresult
+nsDOMAttribute::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->GetSystemEventGroupLM(aGroup);
+  }
+  return rv;
+}
+
+nsresult
 nsDOMAttribute::EnsureChildState(PRBool aSetText, PRBool &aHasChild) const
 {
   aHasChild = PR_FALSE;
 
   nsDOMAttribute* mutableThis = NS_CONST_CAST(nsDOMAttribute*, this);
 
   nsAutoString value;
   mutableThis->GetValue(value);
--- a/content/base/src/nsDOMAttribute.h
+++ b/content/base/src/nsDOMAttribute.h
@@ -95,18 +95,23 @@ public:
                                  PRBool aNotify);
   virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
   virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
   virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
   virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
   virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
                                     nsPresContext* aPresContext,
                                     nsEventStatus* aEventStatus);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
+  virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
+                                      nsIEventListenerManager** aResult);
+  virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                         const nsIID& aIID);
+  virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                            const nsIID& aIID);
+  virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   static void Initialize();
   static void Shutdown();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMAttribute, nsIAttribute)
 
 protected:
--- a/content/base/src/nsDOMParser.cpp
+++ b/content/base/src/nsDOMParser.cpp
@@ -45,17 +45,16 @@
 #include "nsStringStream.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIPrincipal.h"
 #include "nsIDOMClassInfo.h"
 #include "nsReadableUtils.h"
 #include "nsCRT.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsLoadListenerProxy.h"
 #include "nsStreamUtils.h"
 #include "nsThreadUtils.h"
 #include "nsNetCID.h"
 #include "nsContentUtils.h"
 #include "nsDOMJSUtils.h"
 #include "nsDOMError.h"
 
@@ -219,17 +218,17 @@ nsDOMParser::ParseFromStream(nsIInputStr
   
   nsCOMPtr<nsIDOMDocument> domDocument;
   rv = nsContentUtils::CreateDocument(EmptyString(), EmptyString(), nsnull,
                                       mDocumentURI, mBaseURI, mPrincipal,
                                       getter_AddRefs(domDocument));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Register as a load listener on the document
-  nsCOMPtr<nsIDOMEventReceiver> target(do_QueryInterface(domDocument));
+  nsCOMPtr<nsPIDOMEventTarget> target(do_QueryInterface(domDocument));
   if (target) {
     nsWeakPtr requestWeak(do_GetWeakReference(NS_STATIC_CAST(nsIDOMParser*, this)));
     nsLoadListenerProxy* proxy = new nsLoadListenerProxy(requestWeak);
     if (!proxy) return NS_ERROR_OUT_OF_MEMORY;
 
     // This will addref the proxy
     rv = target->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMEventListener*, 
                                                       proxy), 
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -906,17 +906,16 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_INTERFACE_MAP_ENTRY(nsIDOM3DocumentEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentStyle)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNSDocumentStyle)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentView)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentRange)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentTraversal)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentXBL)
   NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3Document)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
@@ -4539,17 +4538,17 @@ nsDocument::RenameNode(nsIDOMNode *aNode
 NS_IMETHODIMP
 nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
 {
   *aOwnerDocument = nsnull;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsDocument::GetListenerManager(PRBool aCreateIfNotFound,
                                nsIEventListenerManager** aInstancePtrResult)
 {
   if (mListenerManager) {
     *aInstancePtrResult = mListenerManager;
     NS_ADDREF(*aInstancePtrResult);
 
     return NS_OK;
@@ -5424,20 +5423,20 @@ CanCacheSubDocument(PLDHashTable *table,
 #ifdef DEBUG_bryner
 #define DEBUG_PAGE_CACHE
 #endif
 
 PRBool
 nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
 {
   // Check our event listener manager for unload/beforeunload listeners.
-  nsCOMPtr<nsIDOMEventReceiver> er = do_QueryInterface(mScriptGlobalObject);
-  if (er) {
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(mScriptGlobalObject);
+  if (piTarget) {
     nsCOMPtr<nsIEventListenerManager> manager;
-    er->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
+    piTarget->GetListenerManager(PR_FALSE, getter_AddRefs(manager));
     if (manager && manager->HasUnloadListeners()) {
       return PR_FALSE;
     }
   }
 
   nsCOMPtr<nsILoadGroup> loadGroup = GetDocumentLoadGroup();
   if (loadGroup) {
     nsCOMPtr<nsISimpleEnumerator> requests;
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -54,17 +54,16 @@
 #include "nsIDOM3Document.h"
 #include "nsIDOMDocumentView.h"
 #include "nsIDOMDocumentXBL.h"
 #include "nsIDOMNSDocument.h"
 #include "nsIDOMNSDocumentStyle.h"
 #include "nsIDOMDocumentRange.h"
 #include "nsIDOMDocumentTraversal.h"
 #include "nsStubDocumentObserver.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsIDOMNSEventTarget.h"
 #include "nsIDOMStyleSheetList.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIContent.h"
 #include "nsIEventListenerManager.h"
 #include "nsIDOM3Node.h"
@@ -283,17 +282,17 @@ class nsDocument : public nsIDocument,
                    public nsIDOM3DocumentEvent,
                    public nsIDOMNSDocumentStyle,
                    public nsIDOMDocumentView,
                    public nsIDOMDocumentRange,
                    public nsIDOMDocumentTraversal,
                    public nsIDOMDocumentXBL,
                    public nsIDOM3Document,
                    public nsSupportsWeakReference,
-                   public nsIDOMEventReceiver,
+                   public nsIDOMEventTarget,
                    public nsIDOM3EventTarget,
                    public nsIDOMNSEventTarget,
                    public nsIScriptObjectPrincipal,
                    public nsIRadioGroupContainer,
                    public nsStubMutationObserver
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@@ -526,16 +525,23 @@ public:
                                  PRBool aNotify);
   virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
   virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
   virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
   virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
   virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
                                     nsPresContext* aPresContext,
                                     nsEventStatus* aEventStatus);
+  virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
+                                      nsIEventListenerManager** aResult);
+  virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                         const nsIID& aIID);
+  virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                            const nsIID& aIID);
+  virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
   {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // nsIRadioGroupContainer
   NS_IMETHOD WalkRadioGroup(const nsAString& aName,
                             nsIRadioVisitor* aVisitor,
@@ -597,25 +603,16 @@ public:
   NS_DECL_NSIDOMDOCUMENTRANGE
 
   // nsIDOMDocumentTraversal
   NS_DECL_NSIDOMDOCUMENTTRAVERSAL
 
   // nsIDOMDocumentXBL
   NS_DECL_NSIDOMDOCUMENTXBL
 
-  // nsIDOMEventReceiver interface
-  NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
-                                   const nsIID& aIID);
-  NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
-                                      const nsIID& aIID);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
-  NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
-
   // nsIDOMEventTarget
   NS_DECL_NSIDOMEVENTTARGET
 
   // nsIDOM3EventTarget
   NS_DECL_NSIDOM3EVENTTARGET
 
   // nsIDOMNSEventTarget
   NS_DECL_NSIDOMNSEVENTTARGET
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -87,18 +87,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
   NS_IMPL_CYCLE_COLLECTION_UNLINK_LISTENERMANAGER
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericDOMDataNode)
   NS_INTERFACE_MAP_ENTRY(nsIContent)
   NS_INTERFACE_MAP_ENTRY(nsINode)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
-  NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventReceiver,
-                                 nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
                                  new nsNodeSupportsWeakRefTearoff(this))
@@ -706,23 +704,58 @@ nsGenericDOMDataNode::DispatchDOMEvent(n
                                        nsPresContext* aPresContext,
                                        nsEventStatus* aEventStatus)
 {
   return nsEventDispatcher::DispatchDOMEvent(NS_STATIC_CAST(nsINode*, this),
                                              aEvent, aDOMEvent,
                                              aPresContext, aEventStatus);
 }
 
-NS_IMETHODIMP
+nsresult
 nsGenericDOMDataNode::GetListenerManager(PRBool aCreateIfNotFound,
                                          nsIEventListenerManager** aResult)
 {
   return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
 }
 
+nsresult
+nsGenericDOMDataNode::AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                            const nsIID& aIID)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
+  }
+  return rv;
+}
+
+nsresult
+nsGenericDOMDataNode::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                               const nsIID& aIID)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  GetListenerManager(PR_FALSE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
+  }
+  return NS_OK;
+}
+
+nsresult
+nsGenericDOMDataNode::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->GetSystemEventGroupLM(aGroup);
+  }
+  return rv;
+}
+
 PRUint32
 nsGenericDOMDataNode::GetChildCount() const
 {
   return 0;
 }
 
 nsIContent *
 nsGenericDOMDataNode::GetChildAt(PRUint32 aIndex) const
--- a/content/base/src/nsGenericDOMDataNode.h
+++ b/content/base/src/nsGenericDOMDataNode.h
@@ -39,17 +39,17 @@
  * Base class for DOM Core's nsIDOMComment, nsIDOMDocumentType, nsIDOMText,
  * nsIDOMCDATASection, and nsIDOMProcessingInstruction nodes.
  */
 
 #ifndef nsGenericDOMDataNode_h___
 #define nsGenericDOMDataNode_h___
 
 #include "nsIDOMCharacterData.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsTextFragment.h"
 #include "nsVoidArray.h"
 #include "nsDOMError.h"
 #include "nsIEventListenerManager.h"
 #include "nsGenericElement.h"
 #include "nsCycleCollectionParticipant.h"
 
 class nsIDOMAttr;
@@ -175,18 +175,23 @@ public:
   virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
                                  PRBool aNotify);
   virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
   virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
   virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
   virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
                                     nsPresContext* aPresContext,
                                     nsEventStatus* aEventStatus);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
+  virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
+                                      nsIEventListenerManager** aResult);
+  virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                         const nsIID& aIID);
+  virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                            const nsIID& aIID);
+  virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
 
   // Implementation for nsIContent
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               PRBool aCompileEventHandlers);
   virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
                               PRBool aNullParent = PR_TRUE);
 
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -46,17 +46,16 @@
 #include "nsDOMAttribute.h"
 #include "nsDOMAttributeMap.h"
 #include "nsIAtom.h"
 #include "nsINodeInfo.h"
 #include "nsIDocument.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMText.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIContentIterator.h"
 #include "nsIEventListenerManager.h"
 #include "nsIFocusController.h"
 #include "nsILinkHandler.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 #include "nsIFrame.h"
@@ -210,23 +209,58 @@ nsINode::UnsetProperty(PRUint16 aCategor
   nsIDocument *doc = GetOwnerDoc();
   if (!doc)
     return nsnull;
 
   return doc->PropertyTable()->UnsetProperty(this, aCategory, aPropertyName,
                                              aStatus);
 }
 
-NS_IMETHODIMP
+nsresult
 nsGenericElement::GetListenerManager(PRBool aCreateIfNotFound,
                                      nsIEventListenerManager** aResult)
 {
   return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
 }
 
+nsresult
+nsGenericElement::AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                       const nsIID& aIID)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
+  }
+  return rv;
+}
+
+nsresult
+nsGenericElement::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                           const nsIID& aIID)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  GetListenerManager(PR_FALSE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
+  }
+  return NS_OK;
+}
+
+nsresult
+nsGenericElement::GetSystemEventGroup(nsIDOMEventGroup** aGroup)
+{
+  nsCOMPtr<nsIEventListenerManager> elm;
+  nsresult rv = GetListenerManager(PR_TRUE, getter_AddRefs(elm));
+  if (elm) {
+    return elm->GetSystemEventGroupLM(aGroup);
+  }
+  return rv;
+}
+
 nsINode::nsSlots*
 nsINode::CreateSlots()
 {
   return new nsSlots(mFlagsOrSlots);
 }
 
 void
 nsINode::AddMutationObserver(nsIMutationObserver* aMutationObserver)
@@ -691,17 +725,16 @@ nsDOMEventRTTearoff::nsDOMEventRTTearoff
 nsDOMEventRTTearoff::~nsDOMEventRTTearoff()
 {
 }
 
 NS_IMPL_CYCLE_COLLECTION_1(nsDOMEventRTTearoff, mContent)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEventRTTearoff)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
 NS_INTERFACE_MAP_END_AGGREGATED(mContent)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsDOMEventRTTearoff,
                                           nsIDOMEventTarget)
 NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS_WITH_DESTROY(nsDOMEventRTTearoff,
                                                         nsIDOMEventTarget,
@@ -758,80 +791,27 @@ nsDOMEventRTTearoff::LastRelease()
 
     return;
   }
 
   delete this;
 }
 
 nsresult
-nsDOMEventRTTearoff::GetEventReceiver(nsIDOMEventReceiver **aReceiver)
-{
-  nsCOMPtr<nsIEventListenerManager> listener_manager;
-  nsresult rv =
-    mContent->GetListenerManager(PR_TRUE, getter_AddRefs(listener_manager));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return CallQueryInterface(listener_manager, aReceiver);
-}
-
-nsresult
 nsDOMEventRTTearoff::GetDOM3EventTarget(nsIDOM3EventTarget **aTarget)
 {
   nsCOMPtr<nsIEventListenerManager> listener_manager;
   nsresult rv =
     mContent->GetListenerManager(PR_TRUE, getter_AddRefs(listener_manager));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return CallQueryInterface(listener_manager, aTarget);
 }
 
 NS_IMETHODIMP
-nsDOMEventRTTearoff::AddEventListenerByIID(nsIDOMEventListener *aListener,
-                                           const nsIID& aIID)
-{
-  nsCOMPtr<nsIDOMEventReceiver> event_receiver;
-  nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return event_receiver->AddEventListenerByIID(aListener, aIID);
-}
-
-NS_IMETHODIMP
-nsDOMEventRTTearoff::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
-                                              const nsIID& aIID)
-{
-  nsCOMPtr<nsIDOMEventReceiver> event_receiver;
-  nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return event_receiver->RemoveEventListenerByIID(aListener, aIID);
-}
-
-NS_IMETHODIMP
-nsDOMEventRTTearoff::GetListenerManager(PRBool aCreateIfNotFound,
-                                        nsIEventListenerManager** aResult)
-{
-  return mContent->GetListenerManager(aCreateIfNotFound, aResult);
-}
-
-NS_IMETHODIMP
-nsDOMEventRTTearoff::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
-{
-  nsCOMPtr<nsIEventListenerManager> manager;
-  GetListenerManager(PR_TRUE, getter_AddRefs(manager));
-
-  if (!manager) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return manager->GetSystemEventGroupLM(aGroup);
-}
-
-NS_IMETHODIMP
 nsDOMEventRTTearoff::GetScriptTypeID(PRUint32 *aLang)
 {
     *aLang = mContent->GetScriptTypeID();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMEventRTTearoff::SetScriptTypeID(PRUint32 aLang)
@@ -847,35 +827,31 @@ nsDOMEventRTTearoff::AddEventListener(co
                                       PRBool useCapture)
 {
   return
     AddEventListener(aType, aListener, useCapture,
                      !nsContentUtils::IsChromeDoc(mContent->GetOwnerDoc()));
 }
 
 NS_IMETHODIMP
-nsDOMEventRTTearoff::RemoveEventListener(const nsAString& type,
-                                         nsIDOMEventListener *listener,
-                                         PRBool useCapture)
+nsDOMEventRTTearoff::RemoveEventListener(const nsAString& aType,
+                                         nsIDOMEventListener* aListener,
+                                         PRBool aUseCapture)
 {
-  nsCOMPtr<nsIDOMEventReceiver> event_receiver;
-  nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return event_receiver->RemoveEventListener(type, listener, useCapture);
+  return RemoveGroupedEventListener(aType, aListener, aUseCapture, nsnull);
 }
 
 NS_IMETHODIMP
-nsDOMEventRTTearoff::DispatchEvent(nsIDOMEvent *evt, PRBool* _retval)
+nsDOMEventRTTearoff::DispatchEvent(nsIDOMEvent *aEvt, PRBool* _retval)
 {
-  nsCOMPtr<nsIDOMEventReceiver> event_receiver;
-  nsresult rv = GetEventReceiver(getter_AddRefs(event_receiver));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return event_receiver->DispatchEvent(evt, _retval);
+  nsEventStatus status = nsEventStatus_eIgnore;
+  nsresult rv =  nsEventDispatcher::DispatchDOMEvent(
+    NS_STATIC_CAST(nsPIDOMEventTarget*, mContent), nsnull, aEvt, nsnull, &status);
+  *_retval = (status != nsEventStatus_eConsumeNoDefault);
+  return rv;
 }
 
 // nsIDOM3EventTarget
 NS_IMETHODIMP
 nsDOMEventRTTearoff::AddGroupedEventListener(const nsAString& aType,
                                              nsIDOMEventListener *aListener,
                                              PRBool aUseCapture,
                                              nsIDOMEventGroup *aEvtGrp)
@@ -3054,18 +3030,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericElement)
   NS_INTERFACE_MAP_ENTRY(nsIContent)
   NS_INTERFACE_MAP_ENTRY(nsINode)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSElement, new nsNSElementTearoff(this))
-  NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventReceiver,
-                                 nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3EventTarget,
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSEventTarget,
                                  nsDOMEventRTTearoff::Create(this))
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
                                  new nsNodeSupportsWeakRefTearoff(this))
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -44,17 +44,17 @@
 #ifndef nsGenericElement_h___
 #define nsGenericElement_h___
 
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsIContent.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocumentFragment.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsIDOM3Node.h"
 #include "nsIDOMNSEventTarget.h"
 #include "nsIDOMNSElement.h"
 #include "nsILinkHandler.h"
 #include "nsGenericDOMNodeList.h"
 #include "nsContentUtils.h"
 #include "nsNodeUtils.h"
@@ -220,17 +220,17 @@ private:
  * nsDOMEventRTTearoff is a tearoff class used by nsGenericElement and
  * nsGenericDOMDataNode classes for implementing the interfaces
  * nsIDOMEventReceiver and nsIDOMEventTarget
  *
  * Use the method nsDOMEventRTTearoff::Create() to create one of these babies.
  * @see nsDOMEventRTTearoff::Create
  */
 
-class nsDOMEventRTTearoff : public nsIDOMEventReceiver,
+class nsDOMEventRTTearoff : public nsIDOMEventTarget,
                             public nsIDOM3EventTarget,
                             public nsIDOMNSEventTarget
 {
 private:
   // This class uses a caching scheme so we don't let users of this
   // class create new instances with 'new', in stead the callers
   // should use the static method
   // nsDOMEventRTTearoff::Create(). That's why the constructor and
@@ -243,17 +243,16 @@ private:
 
   /**
    * This method gets called by Release() when it's time to delete the
    * this object, in stead of always deleting the object we'll put the
    * object in the cache if unless the cache is already full.
    */
   void LastRelease();
 
-  nsresult GetEventReceiver(nsIDOMEventReceiver **aReceiver);
   nsresult GetDOM3EventTarget(nsIDOM3EventTarget **aTarget);
 
 public:
   virtual ~nsDOMEventRTTearoff();
 
   /**
    * Use this static method to create instances of nsDOMEventRTTearoff.
    * @param aContent the content to create a tearoff for
@@ -269,25 +268,16 @@ public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   // nsIDOMEventTarget
   NS_DECL_NSIDOMEVENTTARGET
 
   // nsIDOM3EventTarget
   NS_DECL_NSIDOM3EVENTTARGET
 
-  // nsIDOMEventReceiver
-  NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
-                                   const nsIID& aIID);
-  NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
-                                      const nsIID& aIID);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
-  NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
-
   // nsIDOMNSEventTarget
   NS_DECL_NSIDOMNSEVENTTARGET
 
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMEventRTTearoff,
                                            nsIDOMEventTarget)
 
 private:
   /**
@@ -394,18 +384,23 @@ public:
   virtual nsresult InsertChildAt(nsIContent* aKid, PRUint32 aIndex,
                                  PRBool aNotify);
   virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
   virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
   virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
   virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
                                     nsPresContext* aPresContext,
                                     nsEventStatus* aEventStatus);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
+  virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
+                                      nsIEventListenerManager** aResult);
+  virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                         const nsIID& aIID);
+  virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                            const nsIID& aIID);
+  virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
 
   // nsIContent interface methods
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               PRBool aCompileEventHandlers);
   virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
                               PRBool aNullParent = PR_TRUE);
   virtual nsIAtom *GetIDAttributeName() const;
--- a/content/base/src/nsSyncLoadService.cpp
+++ b/content/base/src/nsSyncLoadService.cpp
@@ -46,17 +46,16 @@
 #include "nsIDOMLoadListener.h"
 #include "nsIChannelEventSink.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDOMImplementation.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIPrivateDOMImplementation.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsContentUtils.h"
 #include "nsThreadUtils.h"
 #include "nsNetUtil.h"
 #include "nsAutoPtr.h"
 #include "nsLoadListenerProxy.h"
 #include "nsStreamUtils.h"
@@ -220,17 +219,17 @@ nsSyncLoader::LoadDocument(nsIChannel* a
 
     if (aForceToXML) {
         nsCOMPtr<nsIStreamListener> forceListener =
             new nsForceXMLListener(listener);
         listener.swap(forceListener);
     }
 
     // Register as a load listener on the document
-    nsCOMPtr<nsIDOMEventReceiver> target = do_QueryInterface(document);
+    nsCOMPtr<nsPIDOMEventTarget> target = do_QueryInterface(document);
     NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
 
     nsWeakPtr requestWeak = do_GetWeakReference(NS_STATIC_CAST(nsIDOMLoadListener*, this));
     nsLoadListenerProxy* proxy = new nsLoadListenerProxy(requestWeak);
     NS_ENSURE_TRUE(proxy, NS_ERROR_OUT_OF_MEMORY);
 
     // This will addref the proxy
     rv = target->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMEventListener*, 
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -45,17 +45,16 @@
 #include "nsIURI.h"
 #include "nsILoadGroup.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "nsIUploadChannel.h"
 #include "nsIDOMSerializer.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIEventListenerManager.h"
 #include "nsGUIEvent.h"
 #include "nsIPrivateDOMEvent.h"
 #include "prprf.h"
 #include "nsIDOMEventListener.h"
 #include "nsIJSContextStack.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsWeakPtr.h"
@@ -1297,17 +1296,17 @@ nsXMLHttpRequest::OnStartRequest(nsIRequ
                                                uri, principal,
                                                getter_AddRefs(mDocument));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Reset responseBody
   mResponseBody.Truncate();
 
   // Register as a load listener on the document
-  nsCOMPtr<nsIDOMEventReceiver> target(do_QueryInterface(mDocument));
+  nsCOMPtr<nsPIDOMEventTarget> target(do_QueryInterface(mDocument));
   if (target) {
     nsWeakPtr requestWeak =
       do_GetWeakReference(NS_STATIC_CAST(nsIXMLHttpRequest*, this));
     nsCOMPtr<nsIDOMEventListener> proxy = new nsLoadListenerProxy(requestWeak);
     if (!proxy) return NS_ERROR_OUT_OF_MEMORY;
 
     // This will addref the proxy
     rv = target->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMEventListener*,
--- a/content/events/public/nsPIDOMEventTarget.h
+++ b/content/events/public/nsPIDOMEventTarget.h
@@ -41,21 +41,23 @@
 #include "nsISupports.h"
 #include "nsEvent.h"
 
 class nsIDOMEvent;
 class nsPresContext;
 class nsEventChainPreVisitor;
 class nsEventChainPostVisitor;
 class nsIEventListenerManager;
+class nsIDOMEventListener;
+class nsIDOMEventGroup;
 
 // 360fa72e-c709-42cc-9285-1f755ec90376
 #define NS_PIDOMEVENTTARGET_IID \
-{ 0x360fa72e, 0xc709, 0x42cc, \
-  { 0x92, 0x85, 0x1f, 0x75, 0x5e, 0xc9, 0x03, 0x76 } }
+  { 0x44a6597b, 0x9fc3, 0x4a8d, \
+    { 0xb7, 0xa4, 0xd9, 0x00, 0x9a, 0xbf, 0x9d, 0x15 } }
 
 class nsPIDOMEventTarget : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMEVENTTARGET_IID)
 
   /**
    * Returns the nsPIDOMEventTarget object which should be used as the target
@@ -124,15 +126,31 @@ public:
 
   /**
    * Get the event listener manager, the guy you talk to to register for events
    * on this node.
    * @param aCreateIfNotFound If PR_FALSE, returns a listener manager only if
    *                          one already exists. [IN]
    * @param aResult           The event listener manager [OUT]
    */
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult) = 0;
+  virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
+                                      nsIEventListenerManager** aResult) = 0;
+
+  /**
+   * Add an event listener for nsIID.
+   */
+  virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                         const nsIID& aIID) = 0;
+  /**
+   * Remove event listener for nsIID.
+   */
+  virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                            const nsIID& aIID) = 0;
+  
+  /**
+   * Get the system event group.
+   */
+  virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMEventTarget, NS_PIDOMEVENTTARGET_IID)
 
 #endif // !defined(nsPIDOMEventTarget_h_)
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -38,17 +38,16 @@
 #include "nsEventDispatcher.h"
 #include "nsIDocument.h"
 #include "nsIAtom.h"
 #include "nsDOMEvent.h"
 #include "nsINode.h"
 #include "nsPIDOMEventTarget.h"
 #include "nsPresContext.h"
 #include "nsIPrivateDOMEvent.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIEventListenerManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsContentUtils.h"
 #include "nsDOMError.h"
 #include "nsMutationEvent.h"
 #include NEW_H
--- a/content/events/src/nsEventListenerManager.cpp
+++ b/content/events/src/nsEventListenerManager.cpp
@@ -388,17 +388,16 @@ nsEventListenerManager::Shutdown()
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsEventListenerManager)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEventListenerManager)
    NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEventListenerManager)
    NS_INTERFACE_MAP_ENTRY(nsIEventListenerManager)
    NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
    NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
-   NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsEventListenerManager, nsIEventListenerManager)
 NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsEventListenerManager, nsIEventListenerManager)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsEventListenerManager)
   PRInt32 i, count = tmp->mListeners.Count();
   nsListenerStruct *ls;
@@ -1368,45 +1367,16 @@ nsEventListenerManager::CanTrigger(const
 }
 
 NS_IMETHODIMP
 nsEventListenerManager::IsRegisteredHere(const nsAString & type, PRBool *_retval)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-// nsIDOMEventReceiver interface
-NS_IMETHODIMP 
-nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aListener, 
-                                              const nsIID& aIID)
-{
-  return AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
-}
-
-NS_IMETHODIMP 
-nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
-{
-  return RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
-}
-
-NS_IMETHODIMP 
-nsEventListenerManager::GetListenerManager(PRBool aCreateIfNotFound,
-                                           nsIEventListenerManager** aResult)
-{
-  NS_ENSURE_ARG_POINTER(aResult);
-  NS_ADDREF(*aResult = this);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsEventListenerManager::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
-{
-  return GetSystemEventGroupLM(aGroup);
-}
-
 nsresult
 nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext,
                                             nsISupports* aCurrentTarget,
                                             nsEvent* aEvent,
                                             nsIDOMEvent** aDOMEvent)
 {
   nsIPresShell* shell = aPresContext ? aPresContext->GetPresShell() : nsnull;
   if (!shell) {
--- a/content/events/src/nsEventListenerManager.h
+++ b/content/events/src/nsEventListenerManager.h
@@ -37,17 +37,17 @@
 
 #ifndef nsEventListenerManager_h__
 #define nsEventListenerManager_h__
 
 #include "nsIEventListenerManager.h"
 #include "jsapi.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsHashtable.h"
 #include "nsIScriptContext.h"
 #include "nsCycleCollectionParticipant.h"
 
 class nsIDOMEvent;
 class nsVoidArray;
 class nsIAtom;
@@ -63,17 +63,17 @@ typedef struct {
   const EventTypeData*          mTypeData;
 } nsListenerStruct;
 
 /*
  * Event listener manager
  */
 
 class nsEventListenerManager : public nsIEventListenerManager,
-                               public nsIDOMEventReceiver,
+                               public nsIDOMEventTarget,
                                public nsIDOM3EventTarget
 {
 
 public:
   nsEventListenerManager();
   virtual ~nsEventListenerManager();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@@ -134,25 +134,16 @@ public:
   static PRUint32 GetIdentifierForEvent(nsIAtom* aEvent);
 
   // nsIDOMEventTarget
   NS_DECL_NSIDOMEVENTTARGET
 
   // nsIDOM3EventTarget
   NS_DECL_NSIDOM3EVENTTARGET
 
-  // nsIDOMEventReceiver interface
-  NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
-                                   const nsIID& aIID);
-  NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
-                                      const nsIID& aIID);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
-  NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
-
   static void Shutdown();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsEventListenerManager,
                                            nsIEventListenerManager)
 
 protected:
   nsresult HandleEventSubType(nsListenerStruct* aListenerStruct,
                               nsIDOMEventListener* aListener,
--- a/content/events/src/nsXMLEventsManager.cpp
+++ b/content/events/src/nsXMLEventsManager.cpp
@@ -36,17 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMMutationEvent.h"
 #include "nsXMLEventsManager.h"
 #include "nsGkAtoms.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsNetUtil.h"
 #include "nsIURL.h"
 #include "nsIDOMEventListener.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
 
 PRBool nsXMLEventsListener::InitXMLEventsListener(nsIDocument * aDocument,
                                                   nsXMLEventsManager * aManager,
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -45,17 +45,16 @@
 #include "nsICSSLoader.h"
 #include "nsICSSStyleRule.h"
 #include "nsCSSStruct.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIDOMHTMLBodyElement.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMAttr.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIDOMNSHTMLDocument.h"
 #include "nsIDOMNSHTMLElement.h"
 #include "nsIDOMElementCSSInlineStyle.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIEventListenerManager.h"
 #include "nsMappedAttributes.h"
@@ -1372,20 +1371,20 @@ nsGenericHTMLElement::GetEventListenerMa
     // If we have a document, and it has a window, add the event
     // listener on the window (the inner window). If not, proceed as
     // normal.
     // XXXbz sXBL/XBL2 issue: should we instead use GetCurrentDoc() here,
     // override BindToTree for those classes and munge event listeners there?
     nsIDocument *document = GetOwnerDoc();
     nsresult rv = NS_OK;
     if (document && (win = document->GetInnerWindow())) {
-      nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(win));
-      NS_ENSURE_TRUE(receiver, NS_ERROR_FAILURE);
-
-      rv = receiver->GetListenerManager(PR_TRUE, aManager);
+      nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(win));
+      NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
+
+      rv = piTarget->GetListenerManager(PR_TRUE, aManager);
 
       if (NS_SUCCEEDED(rv)) {
         NS_ADDREF(*aTarget = win);
       }
       *aDefer = PR_FALSE;
     } else {
       *aManager = nsnull;
       *aTarget = nsnull;
--- a/content/html/content/src/nsHTMLAnchorElement.cpp
+++ b/content/html/content/src/nsHTMLAnchorElement.cpp
@@ -36,17 +36,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMNSHTMLAnchorElement2.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIHTMLDocument.h"
 #include "nsGenericHTMLElement.h"
 #include "nsILink.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIEventStateManager.h"
 #include "nsIURL.h"
--- a/content/html/content/src/nsHTMLAreaElement.cpp
+++ b/content/html/content/src/nsHTMLAreaElement.cpp
@@ -32,17 +32,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMNSHTMLAreaElement2.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsILink.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIEventStateManager.h"
 #include "nsIURL.h"
--- a/content/html/content/src/nsHTMLBRElement.cpp
+++ b/content/html/content/src/nsHTMLBRElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLBRElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
 class nsHTMLBRElement : public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLBodyElement.cpp
+++ b/content/html/content/src/nsHTMLBodyElement.cpp
@@ -33,17 +33,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nscore.h"
 #include "nsCOMPtr.h"
 #include "nsIDOMHTMLBodyElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsIDocument.h"
 #include "nsIHTMLDocument.h"
 #include "nsHTMLStyleSheet.h"
--- a/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/content/html/content/src/nsHTMLButtonElement.cpp
@@ -32,17 +32,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLButtonElement.h"
 #include "nsIDOMNSHTMLButtonElement.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFormSubmission.h"
--- a/content/html/content/src/nsHTMLDelElement.cpp
+++ b/content/html/content/src/nsHTMLDelElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLModElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 
 
 class nsHTMLModElement : public nsGenericHTMLElement,
                          public nsIDOMHTMLModElement
--- a/content/html/content/src/nsHTMLDivElement.cpp
+++ b/content/html/content/src/nsHTMLDivElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLDivElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 
 class nsHTMLDivElement : public nsGenericHTMLElement,
                          public nsIDOMHTMLDivElement
--- a/content/html/content/src/nsHTMLFieldSetElement.cpp
+++ b/content/html/content/src/nsHTMLFieldSetElement.cpp
@@ -31,17 +31,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLFieldSetElement.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIForm.h"
 #include "nsIFormControl.h"
 
 
 class nsHTMLFieldSetElement : public nsGenericHTMLFormElement,
--- a/content/html/content/src/nsHTMLFontElement.cpp
+++ b/content/html/content/src/nsHTMLFontElement.cpp
@@ -31,17 +31,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsIDOMHTMLFontElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsIDeviceContext.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsCSSStruct.h"
 #include "nsRuleData.h"
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -37,17 +37,17 @@
 #include "nsCOMPtr.h"
 #include "nsIForm.h"
 #include "nsIFormControl.h"
 #include "nsIFormSubmission.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMNSHTMLFormElement.h"
 #include "nsIHTMLDocument.h"
 #include "nsIDOMNSHTMLFormControlList.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsEventStateManager.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsIFrame.h"
--- a/content/html/content/src/nsHTMLFrameSetElement.cpp
+++ b/content/html/content/src/nsHTMLFrameSetElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLFrameSetElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIFrameSetElement.h"
 #include "nsIHTMLDocument.h"
 #include "nsIDocument.h"
 
--- a/content/html/content/src/nsHTMLHRElement.cpp
+++ b/content/html/content/src/nsHTMLHRElement.cpp
@@ -31,17 +31,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLHRElement.h"
 #include "nsIDOMNSHTMLHRElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
 class nsHTMLHRElement : public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLHeadElement.cpp
+++ b/content/html/content/src/nsHTMLHeadElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLHeadElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 
 
 class nsHTMLHeadElement : public nsGenericHTMLElement,
                           public nsIDOMHTMLHeadElement
--- a/content/html/content/src/nsHTMLHeadingElement.cpp
+++ b/content/html/content/src/nsHTMLHeadingElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLHeadingElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
 class nsHTMLHeadingElement : public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLHtmlElement.cpp
+++ b/content/html/content/src/nsHTMLHtmlElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLHtmlElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 
 
 class nsHTMLHtmlElement : public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLImageElement.cpp
+++ b/content/html/content/src/nsHTMLImageElement.cpp
@@ -31,17 +31,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIDOMNSHTMLImageElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsImageLoadingContent.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsMappedAttributes.h"
 #include "nsIJSNativeInitializer.h"
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -46,17 +46,17 @@
 #include "nsIPhonetic.h"
 
 #include "nsIControllers.h"
 #include "nsIFocusController.h"
 #include "nsPIDOMWindow.h"
 #include "nsContentCID.h"
 #include "nsIComponentManager.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFormSubmission.h"
@@ -83,17 +83,17 @@
 #include "nsICheckboxControlFrame.h"
 #include "nsLinebreakConverter.h" //to strip out carriage returns
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsEventDispatcher.h"
 #include "nsLayoutUtils.h"
 
 #include "nsIDOMMutationEvent.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsMutationEvent.h"
 #include "nsIEventListenerManager.h"
 
 #include "nsRuleData.h"
 
 // input type=radio
 #include "nsIRadioControlFrame.h"
 #include "nsIRadioGroupContainer.h"
--- a/content/html/content/src/nsHTMLLIElement.cpp
+++ b/content/html/content/src/nsHTMLLIElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLLIElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
 class nsHTMLLIElement : public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLLabelElement.cpp
+++ b/content/html/content/src/nsHTMLLabelElement.cpp
@@ -32,17 +32,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsIDOMHTMLLabelElement.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMXULDocument.h"
--- a/content/html/content/src/nsHTMLLegendElement.cpp
+++ b/content/html/content/src/nsHTMLLegendElement.cpp
@@ -32,17 +32,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLLegendElement.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIForm.h"
 #include "nsIFormControl.h"
 #include "nsIEventStateManager.h"
 #include "nsIFocusController.h"
--- a/content/html/content/src/nsHTMLLinkElement.cpp
+++ b/content/html/content/src/nsHTMLLinkElement.cpp
@@ -31,17 +31,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLLinkElement.h"
 #include "nsIDOMLinkStyle.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsILink.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIDOMStyleSheet.h"
 #include "nsIStyleSheet.h"
 #include "nsIStyleSheetLinkingElement.h"
--- a/content/html/content/src/nsHTMLMapElement.cpp
+++ b/content/html/content/src/nsHTMLMapElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLMapElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsContentList.h"
 #include "nsIDocument.h"
 #include "nsIHTMLDocument.h"
 #include "nsCOMPtr.h"
--- a/content/html/content/src/nsHTMLMetaElement.cpp
+++ b/content/html/content/src/nsHTMLMetaElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLMetaElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 
 
 class nsHTMLMetaElement : public nsGenericHTMLElement,
                           public nsIDOMHTMLMetaElement
--- a/content/html/content/src/nsHTMLOListElement.cpp
+++ b/content/html/content/src/nsHTMLOListElement.cpp
@@ -32,17 +32,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLOListElement.h"
 #include "nsIDOMHTMLDListElement.h"
 #include "nsIDOMHTMLUListElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
 class nsHTMLSharedListElement : public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLOptGroupElement.cpp
+++ b/content/html/content/src/nsHTMLOptGroupElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLOptGroupElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIFrame.h"
 #include "nsIFormControlFrame.h"
 #include "nsIEventStateManager.h"
 #include "nsIDocument.h"
--- a/content/html/content/src/nsHTMLOptionElement.cpp
+++ b/content/html/content/src/nsHTMLOptionElement.cpp
@@ -36,17 +36,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLOptionElement.h"
 #include "nsIDOMNSHTMLOptionElement.h"
 #include "nsIOptionElement.h"
 #include "nsIDOMHTMLOptGroupElement.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIDOMText.h"
 #include "nsIDOMNode.h"
--- a/content/html/content/src/nsHTMLParagraphElement.cpp
+++ b/content/html/content/src/nsHTMLParagraphElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLParagraphElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
 // XXX missing nav attributes
--- a/content/html/content/src/nsHTMLPreElement.cpp
+++ b/content/html/content/src/nsHTMLPreElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLPreElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 #include "nsCSSStruct.h"
 
--- a/content/html/content/src/nsHTMLScriptElement.cpp
+++ b/content/html/content/src/nsHTMLScriptElement.cpp
@@ -31,17 +31,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLScriptElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsIDocument.h"
 #include "nsScriptElement.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -37,17 +37,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsIDOMHTMLSelectElement.h"
 #include "nsIDOMNSHTMLSelectElement.h"
 #include "nsIDOMNSXBLFormControl.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsLayoutUtils.h"
 #include "nsMappedAttributes.h"
 #include "nsIForm.h"
--- a/content/html/content/src/nsHTMLSpanElement.cpp
+++ b/content/html/content/src/nsHTMLSpanElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIAtom.h"
 #include "nsRuleData.h"
 
 class nsHTMLSpanElement : public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLStyleElement.cpp
+++ b/content/html/content/src/nsHTMLStyleElement.cpp
@@ -32,17 +32,17 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLStyleElement.h"
 #include "nsIDOMLinkStyle.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIDOMStyleSheet.h"
 #include "nsIStyleSheet.h"
 #include "nsStyleLinkElement.h"
 #include "nsNetUtil.h"
--- a/content/html/content/src/nsHTMLTableCaptionElement.cpp
+++ b/content/html/content/src/nsHTMLTableCaptionElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLTableCaptionElem.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 
 class nsHTMLTableCaptionElement :  public nsGenericHTMLElement,
--- a/content/html/content/src/nsHTMLTableCellElement.cpp
+++ b/content/html/content/src/nsHTMLTableCellElement.cpp
@@ -32,17 +32,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLTableCellElement.h"
 #include "nsIDOMHTMLTableRowElement.h"
 #include "nsIDOMHTMLCollection.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsMappedAttributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsRuleData.h"
 #include "nsIDocument.h"
 
--- a/content/html/content/src/nsHTMLTableColElement.cpp
+++ b/content/html/content/src/nsHTMLTableColElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLTableColElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsMappedAttributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsRuleData.h"
 
 // use the same protection as ancient code did 
--- a/content/html/content/src/nsHTMLTableElement.cpp
+++ b/content/html/content/src/nsHTMLTableElement.cpp
@@ -33,17 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLTableElement.h"
 #include "nsIDOMHTMLTableCaptionElem.h"
 #include "nsIDOMHTMLTableSectionElem.h"
 #include "nsCOMPtr.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsDOMError.h"
 #include "nsContentList.h"
 #include "nsMappedAttributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsHTMLParts.h"
--- a/content/html/content/src/nsHTMLTableRowElement.cpp
+++ b/content/html/content/src/nsHTMLTableRowElement.cpp
@@ -33,17 +33,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLTableRowElement.h"
 #include "nsIDOMHTMLTableElement.h"
 #include "nsIDOMHTMLTableSectionElem.h"
 #include "nsIDOMHTMLTableCellElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsDOMError.h"
 #include "nsMappedAttributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsContentList.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsHTMLParts.h"
--- a/content/html/content/src/nsHTMLTableSectionElement.cpp
+++ b/content/html/content/src/nsHTMLTableSectionElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLTableSectionElem.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsMappedAttributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsContentList.h"
 #include "nsRuleData.h"
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -45,17 +45,17 @@
 #include "nsPIDOMWindow.h"
 #include "nsContentCID.h"
 #include "nsCOMPtr.h"
 #include "nsIComponentManager.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFormSubmission.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsIFormControlFrame.h"
 #include "nsITextControlFrame.h"
 #include "nsIEventStateManager.h"
--- a/content/html/content/src/nsHTMLTitleElement.cpp
+++ b/content/html/content/src/nsHTMLTitleElement.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsIDOMHTMLTitleElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIDOMText.h"
 #include "nsIDocument.h"
 #include "nsIDOMHTMLDocument.h"
 
 
--- a/content/svg/content/src/nsSVGElement.cpp
+++ b/content/svg/content/src/nsSVGElement.cpp
@@ -36,17 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsSVGElement.h"
 #include "nsSVGSVGElement.h"
 #include "nsIDocument.h"
 #include "nsRange.h"
 #include "nsIDOMAttr.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsMutationEvent.h"
 #include "nsBindingManager.h"
 #include "nsXBLBinding.h"
 #include "nsStyleConsts.h"
 #include "nsDOMError.h"
 #include "nsIPresShell.h"
 #include "nsIDOMViewCSS.h"
--- a/content/xbl/public/nsIXBLService.h
+++ b/content/xbl/public/nsIXBLService.h
@@ -44,26 +44,26 @@
 
 #ifndef nsIXBLService_h__
 #define nsIXBLService_h__
 
 #include "nsISupports.h"
 
 class nsIContent;
 class nsIDocument;
-class nsIDOMEventReceiver;
+class nsPIDOMEventTarget;
 class nsIDOMNodeList;
 class nsXBLBinding;
 class nsIXBLDocumentInfo;
 class nsIURI;
 class nsIAtom;
 
 #define NS_IXBLSERVICE_IID      \
-  { 0x7157b300, 0xf49b, 0x4e7d, \
-    { 0xac, 0x3a, 0xef, 0x8f, 0x20, 0x69, 0x6e, 0xb1 } }
+  { 0xefda61b3, 0x5d04, 0x43b0, \
+    { 0x98, 0x0c, 0x32, 0x62, 0x72, 0xc8, 0x5c, 0x68 } }
 
 class nsIXBLService : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXBLSERVICE_IID)
 
   // This function loads a particular XBL file and installs all of the bindings
   // onto the element.
@@ -77,15 +77,15 @@ public:
   NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
 
   // This method checks the hashtable and then calls FetchBindingDocument on a miss.
   NS_IMETHOD LoadBindingDocumentInfo(nsIContent* aBoundElement, nsIDocument* aBoundDocument,
                                      nsIURI* aBindingURI,
                                      PRBool aForceSyncLoad, nsIXBLDocumentInfo** aResult) = 0;
 
   // Hooks up the global key event handlers to the document root.
-  NS_IMETHOD AttachGlobalKeyHandler(nsIDOMEventReceiver* aElement)=0;
+  NS_IMETHOD AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget)=0;
   
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIXBLService, NS_IXBLSERVICE_IID)
 
 #endif // nsIXBLService_h__
--- a/content/xbl/src/nsXBLBinding.cpp
+++ b/content/xbl/src/nsXBLBinding.cpp
@@ -40,17 +40,17 @@
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsIXBLDocumentInfo.h"
 #include "nsIInputStream.h"
 #include "nsINameSpaceManager.h"
 #include "nsHashtable.h"
 #include "nsIURI.h"
 #include "nsIURL.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIChannel.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsIParser.h"
 #include "nsParserCIID.h"
 #include "nsNetUtil.h"
 #include "plstr.h"
 #include "nsIContent.h"
@@ -810,18 +810,18 @@ nsXBLBinding::ExecuteDetachedHandler()
 }
 
 void
 nsXBLBinding::UnhookEventHandlers()
 {
   nsXBLPrototypeHandler* handlerChain = mPrototypeBinding->GetPrototypeHandlers();
 
   if (handlerChain) {
-    nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(mBoundElement);
-    nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(receiver);
+    nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(mBoundElement);
+    nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(piTarget);
     nsCOMPtr<nsIDOMEventGroup> systemEventGroup;
 
     nsXBLPrototypeHandler* curr;
     for (curr = handlerChain; curr; curr = curr->GetNextHandler()) {
       nsXBLEventHandler* handler = curr->GetCachedEventHandler();
       if (handler) {
         nsCOMPtr<nsIAtom> eventAtom = curr->GetEventName();
         if (!eventAtom ||
@@ -839,17 +839,17 @@ nsXBLBinding::UnhookEventHandlers()
         // If this is a command, remove it from the system event group, otherwise 
         // remove it from the standard event group.
 
         // This is a weak ref. systemEventGroup above is already a
         // strong ref, so we are guaranteed it will not go away.
         nsIDOMEventGroup* eventGroup = nsnull;
         if (curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) {
           if (!systemEventGroup)
-            receiver->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
+            piTarget->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
           eventGroup = systemEventGroup;
         }
 
         target->RemoveGroupedEventListener(type, handler, useCapture,
                                            eventGroup);
       }
     }
 
@@ -868,17 +868,17 @@ nsXBLBinding::UnhookEventHandlers()
       // If this is a command, remove it from the system event group, otherwise 
       // remove it from the standard event group.
 
       // This is a weak ref. systemEventGroup above is already a
       // strong ref, so we are guaranteed it will not go away.
       nsIDOMEventGroup* eventGroup = nsnull;
       if (handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) {
         if (!systemEventGroup)
-          receiver->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
+          piTarget->GetSystemEventGroup(getter_AddRefs(systemEventGroup));
         eventGroup = systemEventGroup;
       }
 
       target->RemoveGroupedEventListener(type, handler, useCapture,
                                          eventGroup);
     }
   }
 }
--- a/content/xbl/src/nsXBLEventHandler.cpp
+++ b/content/xbl/src/nsXBLEventHandler.cpp
@@ -35,17 +35,18 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsIContent.h"
 #include "nsIDOMEventGroup.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventListener.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMText.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsGkAtoms.h"
 #include "nsXBLPrototypeHandler.h"
 #include "nsIDOMNSEvent.h"
 #include "nsContentUtils.h"
@@ -75,19 +76,19 @@ nsXBLEventHandler::HandleEvent(nsIDOMEve
       return NS_OK;
   }
 
   if (!EventMatched(aEvent))
     return NS_OK;
 
   nsCOMPtr<nsIDOMEventTarget> target;
   aEvent->GetCurrentTarget(getter_AddRefs(target));
-  nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(target);
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(target);
 
-  mProtoHandler->ExecuteHandler(receiver, aEvent);
+  mProtoHandler->ExecuteHandler(piTarget, aEvent);
 
   return NS_OK;
 }
 
 nsXBLMouseEventHandler::nsXBLMouseEventHandler(nsXBLPrototypeHandler* aHandler)
   : nsXBLEventHandler(aHandler)
 {
 }
@@ -129,17 +130,17 @@ nsXBLKeyEventHandler::HandleEvent(nsIDOM
     PRUint16 eventPhase;
     aEvent->GetEventPhase(&eventPhase);
     if (eventPhase != nsIDOMEvent::AT_TARGET)
       return NS_OK;
   }
 
   nsCOMPtr<nsIDOMEventTarget> target;
   aEvent->GetCurrentTarget(getter_AddRefs(target));
-  nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(target);
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(target);
 
   nsCOMPtr<nsIDOMKeyEvent> key(do_QueryInterface(aEvent));
 
   nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aEvent);
   PRBool trustedEvent = PR_FALSE;
   if (domNSEvent) {
     domNSEvent->GetIsTrusted(&trustedEvent);
   }
@@ -148,17 +149,17 @@ nsXBLKeyEventHandler::HandleEvent(nsIDOM
   for (i = 0; i < count; ++i) {
     nsXBLPrototypeHandler* handler = NS_STATIC_CAST(nsXBLPrototypeHandler*,
                                                     mProtoHandlers[i]);
     PRBool hasAllowUntrustedAttr = handler->HasAllowUntrustedAttr();
     if ((trustedEvent ||
         (hasAllowUntrustedAttr && handler->AllowUntrustedEvents()) ||
         (!hasAllowUntrustedAttr && !mIsBoundToChrome)) &&
         handler->KeyEventMatched(key)) {
-      handler->ExecuteHandler(receiver, aEvent);
+      handler->ExecuteHandler(piTarget, aEvent);
     }
   }
 
   return NS_OK;
 }
 
 ///////////////////////////////////////////////////////////////////////////////////
 
--- a/content/xbl/src/nsXBLEventHandler.h
+++ b/content/xbl/src/nsXBLEventHandler.h
@@ -41,17 +41,17 @@
 
 #include "nsCOMPtr.h"
 #include "nsIDOMEventListener.h"
 #include "nsVoidArray.h"
 
 class nsIAtom;
 class nsIContent;
 class nsIDOM3EventTarget;
-class nsIDOMEventReceiver;
+class nsPIDOMEventTarget;
 class nsXBLPrototypeHandler;
 
 class nsXBLEventHandler : public nsIDOMEventListener
 {
 public:
   nsXBLEventHandler(nsXBLPrototypeHandler* aHandler);
   virtual ~nsXBLEventHandler();
 
--- a/content/xbl/src/nsXBLPrototypeBinding.cpp
+++ b/content/xbl/src/nsXBLPrototypeBinding.cpp
@@ -38,17 +38,17 @@
 
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsIXBLDocumentInfo.h"
 #include "nsIInputStream.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
 #include "nsIURL.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIChannel.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsIParser.h"
 #include "nsParserCIID.h"
 #include "nsNetUtil.h"
 #include "plstr.h"
 #include "nsContentCreatorFunctions.h"
--- a/content/xbl/src/nsXBLPrototypeHandler.cpp
+++ b/content/xbl/src/nsXBLPrototypeHandler.cpp
@@ -55,17 +55,17 @@
 #include "nsIDOMXULElement.h"
 #include "nsIDOMNSUIEvent.h"
 #include "nsIURI.h"
 #include "nsIDOMNSHTMLTextAreaElement.h"
 #include "nsIDOMNSHTMLInputElement.h"
 #include "nsIDOMText.h"
 #include "nsIFocusController.h"
 #include "nsIEventListenerManager.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMEventListener.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsIServiceManager.h"
 #include "nsContentUtils.h"
@@ -207,17 +207,17 @@ nsXBLPrototypeHandler::InitAccessKeys()
 
   // Get the menu access key value from prefs, overriding the default:
   kMenuAccessKey =
     nsContentUtils::GetIntPref("ui.key.menuAccessKey", kMenuAccessKey);
   kAccelKey = nsContentUtils::GetIntPref("ui.key.accelKey", kAccelKey);
 }
 
 nsresult
-nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver,
+nsXBLPrototypeHandler::ExecuteHandler(nsPIDOMEventTarget* aTarget,
                                       nsIDOMEvent* aEvent)
 {
   nsresult rv = NS_ERROR_FAILURE;
 
   // Prevent default action?
   if (mType & NS_HANDLER_TYPE_PREVENTDEFAULT) {
     aEvent->PreventDefault();
     // If we prevent default, then it's okay for
@@ -268,51 +268,51 @@ nsXBLPrototypeHandler::ExecuteHandler(ns
         return NS_OK;
     }
 
     // Instead of executing JS, let's get the controller for the bound
     // element and call doCommand on it.
     nsCOMPtr<nsIController> controller;
     nsCOMPtr<nsIFocusController> focusController;
 
-    nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(aReceiver));
+    nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(aTarget));
     if (windowRoot) {
       windowRoot->GetFocusController(getter_AddRefs(focusController));
     }
     else {
-      nsCOMPtr<nsPIDOMWindow> privateWindow(do_QueryInterface(aReceiver));
+      nsCOMPtr<nsPIDOMWindow> privateWindow(do_QueryInterface(aTarget));
       if (!privateWindow) {
-        nsCOMPtr<nsIContent> elt(do_QueryInterface(aReceiver));
+        nsCOMPtr<nsIContent> elt(do_QueryInterface(aTarget));
         nsCOMPtr<nsIDocument> doc;
         // XXXbz sXBL/XBL2 issue -- this should be the "scope doc" or
         // something... whatever we use when wrapping DOM nodes
         // normally.  It's not clear that the owner doc is the right
         // thing.
         if (elt)
           doc = elt->GetOwnerDoc();
 
         if (!doc)
-          doc = do_QueryInterface(aReceiver);
+          doc = do_QueryInterface(aTarget);
 
         if (!doc)
           return NS_ERROR_FAILURE;
 
         privateWindow = do_QueryInterface(doc->GetScriptGlobalObject());
         if (!privateWindow)
           return NS_ERROR_FAILURE;
       }
 
       focusController = privateWindow->GetRootFocusController();
     }
 
     NS_LossyConvertUTF16toASCII command(mHandlerText);
     if (focusController)
       focusController->GetControllerForCommand(command.get(), getter_AddRefs(controller));
     else
-      controller = GetController(aReceiver); // We're attached to the receiver possibly.
+      controller = GetController(aTarget); // We're attached to the receiver possibly.
 
     nsAutoString type;
     mEventName->ToString(type);
 
     if (type.EqualsLiteral("keypress") &&
         mDetail == nsIDOMKeyEvent::DOM_VK_SPACE &&
         mMisc == 1) {
       // get the focused element so that we can pageDown only at
@@ -413,17 +413,17 @@ nsXBLPrototypeHandler::ExecuteHandler(ns
   onEvent += str;
   nsCOMPtr<nsIAtom> onEventAtom = do_GetAtom(onEvent);
 
   // Compile the event handler.
   PRUint32 stID = nsIProgrammingLanguage::JAVASCRIPT;
 
   // Compile the handler and bind it to the element.
   nsCOMPtr<nsIScriptGlobalObject> boundGlobal;
-  nsCOMPtr<nsPIWindowRoot> winRoot(do_QueryInterface(aReceiver));
+  nsCOMPtr<nsPIWindowRoot> winRoot(do_QueryInterface(aTarget));
   nsCOMPtr<nsIDOMWindowInternal> focusedWin;
 
   if (winRoot) {
     nsCOMPtr<nsIFocusController> focusController;
     winRoot->GetFocusController(getter_AddRefs(focusController));
     focusController->GetFocusedWindow(getter_AddRefs(focusedWin));
   }
 
@@ -436,23 +436,23 @@ nsXBLPrototypeHandler::ExecuteHandler(ns
 
     if (piWin) {
       piWin = piWin->GetCurrentInnerWindow();
       NS_ENSURE_TRUE(piWin, NS_ERROR_UNEXPECTED);
     }
 
     boundGlobal = do_QueryInterface(piWin->GetPrivateRoot());
   }
-  else boundGlobal = do_QueryInterface(aReceiver);
+  else boundGlobal = do_QueryInterface(aTarget);
 
   if (!boundGlobal) {
-    nsCOMPtr<nsIDocument> boundDocument(do_QueryInterface(aReceiver));
+    nsCOMPtr<nsIDocument> boundDocument(do_QueryInterface(aTarget));
     if (!boundDocument) {
       // We must be an element.
-      nsCOMPtr<nsIContent> content(do_QueryInterface(aReceiver));
+      nsCOMPtr<nsIContent> content(do_QueryInterface(aTarget));
       if (!content)
         return NS_OK;
       boundDocument = content->GetOwnerDoc();
       if (!boundDocument)
         return NS_OK;
     }
 
     boundGlobal = boundDocument->GetScriptGlobalObject();
@@ -467,17 +467,17 @@ nsXBLPrototypeHandler::ExecuteHandler(ns
   if (!boundContext) return NS_OK;
 
   nsScriptObjectHolder handler(boundContext);
   nsISupports *scriptTarget;
 
   if (winRoot) {
     scriptTarget = boundGlobal;
   } else {
-    scriptTarget = aReceiver;
+    scriptTarget = aTarget;
   }
   // XXX - apparently we should not be using the global as the scope - what
   // should we use?  See bug 339649, which is trying to find out!
   void *scope = boundGlobal->GetScriptGlobal(stID);
 
   PRUint32 argCount;
   const char **argNames;
   nsContentUtils::GetEventArgNames(kNameSpaceID_XBL, onEventAtom, &argCount,
@@ -517,40 +517,40 @@ already_AddRefed<nsIAtom>
 nsXBLPrototypeHandler::GetEventName()
 {
   nsIAtom* eventName = mEventName;
   NS_IF_ADDREF(eventName);
   return eventName;
 }
 
 already_AddRefed<nsIController>
-nsXBLPrototypeHandler::GetController(nsIDOMEventReceiver* aReceiver)
+nsXBLPrototypeHandler::GetController(nsPIDOMEventTarget* aTarget)
 {
   // XXX Fix this so there's a generic interface that describes controllers, 
   // This code should have no special knowledge of what objects might have controllers.
   nsCOMPtr<nsIControllers> controllers;
 
-  nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aReceiver));
+  nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aTarget));
   if (xulElement)
     xulElement->GetControllers(getter_AddRefs(controllers));
 
   if (!controllers) {
-    nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea(do_QueryInterface(aReceiver));
+    nsCOMPtr<nsIDOMNSHTMLTextAreaElement> htmlTextArea(do_QueryInterface(aTarget));
     if (htmlTextArea)
       htmlTextArea->GetControllers(getter_AddRefs(controllers));
   }
 
   if (!controllers) {
-    nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement(do_QueryInterface(aReceiver));
+    nsCOMPtr<nsIDOMNSHTMLInputElement> htmlInputElement(do_QueryInterface(aTarget));
     if (htmlInputElement)
       htmlInputElement->GetControllers(getter_AddRefs(controllers));
   }
 
   if (!controllers) {
-    nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(aReceiver));
+    nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(aTarget));
     if (domWindow)
       domWindow->GetControllers(getter_AddRefs(controllers));
   }
 
   // Return the first controller.
   // XXX This code should be checking the command name and using supportscommand and
   // iscommandenabled.
   nsIController* controller;
--- a/content/xbl/src/nsXBLPrototypeHandler.h
+++ b/content/xbl/src/nsXBLPrototypeHandler.h
@@ -47,17 +47,17 @@
 #include "nsXBLEventHandler.h"
 #include "nsIWeakReference.h"
 
 class nsIDOMEvent;
 class nsIContent;
 class nsIDOMUIEvent;
 class nsIDOMKeyEvent;
 class nsIDOMMouseEvent;
-class nsIDOMEventReceiver;
+class nsPIDOMEventTarget;
 class nsIDOM3EventTarget;
 class nsXBLPrototypeBinding;
 
 #define NS_HANDLER_TYPE_XBL_JS              (1 << 0)
 #define NS_HANDLER_TYPE_XBL_COMMAND         (1 << 1)
 #define NS_HANDLER_TYPE_XUL                 (1 << 2)
 #define NS_HANDLER_HAS_ALLOW_UNTRUSTED_ATTR (1 << 4)
 #define NS_HANDLER_ALLOW_UNTRUSTED          (1 << 5)
@@ -116,17 +116,17 @@ public:
   }
 
   PRUint8 GetPhase() { return mPhase; }
   PRUint8 GetType() { return mType; }
 
   nsXBLPrototypeHandler* GetNextHandler() { return mNextHandler; }
   void SetNextHandler(nsXBLPrototypeHandler* aHandler) { mNextHandler = aHandler; }
 
-  nsresult ExecuteHandler(nsIDOMEventReceiver* aReceiver, nsIDOMEvent* aEvent);
+  nsresult ExecuteHandler(nsPIDOMEventTarget* aTarget, nsIDOMEvent* aEvent);
 
   already_AddRefed<nsIAtom> GetEventName();
   void SetEventName(nsIAtom* aName) { mEventName = aName; }
 
   nsXBLEventHandler* GetEventHandler()
   {
     if (!mHandler) {
       NS_NewXBLEventHandler(this, mEventName, getter_AddRefs(mHandler));
@@ -152,17 +152,17 @@ public:
   {
     return (mType & NS_HANDLER_ALLOW_UNTRUSTED) != 0;
   }
 
 public:
   static PRUint32 gRefCnt;
   
 protected:
-  already_AddRefed<nsIController> GetController(nsIDOMEventReceiver* aReceiver);
+  already_AddRefed<nsIController> GetController(nsPIDOMEventTarget* aTarget);
   
   inline PRInt32 GetMatchingKeyCode(const nsAString& aKeyName);
   void ConstructPrototype(nsIContent* aKeyElement, 
                           const PRUnichar* aEvent=nsnull, const PRUnichar* aPhase=nsnull,
                           const PRUnichar* aAction=nsnull, const PRUnichar* aCommand=nsnull,
                           const PRUnichar* aKeyCode=nsnull, const PRUnichar* aCharCode=nsnull,
                           const PRUnichar* aModifiers=nsnull, const PRUnichar* aButton=nsnull,
                           const PRUnichar* aClickCount=nsnull, const PRUnichar* aGroup=nsnull,
--- a/content/xbl/src/nsXBLService.cpp
+++ b/content/xbl/src/nsXBLService.cpp
@@ -424,18 +424,18 @@ nsXBLStreamListener::Load(nsIDOMEvent* a
     }
   }
   
   for (i = 0; i < count; i++) {
     nsXBLBindingRequest* req = (nsXBLBindingRequest*)mBindingRequests.ElementAt(i);
     nsXBLBindingRequest::Destroy(mXBLService->mPool, req);
   }
 
-  nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(mBindingDocument));
-  rec->RemoveEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)this, PR_FALSE);
+  nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mBindingDocument));
+  target->RemoveEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)this, PR_FALSE);
 
   mBindingRequests.Clear();
   mDocument = nsnull;
   mBindingDocument = nsnull;
 
   return rv;
 }
 
@@ -702,44 +702,44 @@ nsXBLService::GetXBLDocumentInfo(nsIURI*
 //
 // AttachGlobalKeyHandler
 //
 // Creates a new key handler and prepares to listen to key events on the given
 // event receiver (either a document or an content node). If the receiver is content,
 // then extra work needs to be done to hook it up to the document (XXX WHY??)
 //
 NS_IMETHODIMP
-nsXBLService::AttachGlobalKeyHandler(nsIDOMEventReceiver* aReceiver)
+nsXBLService::AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget)
 {
   // check if the receiver is a content node (not a document), and hook
   // it to the document if that is the case.
-  nsCOMPtr<nsIDOMEventReceiver> rec = aReceiver;
-  nsCOMPtr<nsIContent> contentNode(do_QueryInterface(aReceiver));
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = aTarget;
+  nsCOMPtr<nsIContent> contentNode(do_QueryInterface(aTarget));
   if (contentNode) {
     // Only attach if we're really in a document
     nsCOMPtr<nsIDocument> doc = contentNode->GetCurrentDoc();
     if (doc)
-      rec = do_QueryInterface(doc); // We're a XUL keyset. Attach to our document.
+      piTarget = do_QueryInterface(doc); // We're a XUL keyset. Attach to our document.
   }
     
-  if (!rec)
+  if (!piTarget)
     return NS_ERROR_FAILURE;
     
   nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(contentNode));
 
   // Create the key handler
   nsXBLWindowKeyHandler* handler;
-  NS_NewXBLWindowKeyHandler(elt, rec, &handler); // This addRef's
+  NS_NewXBLWindowKeyHandler(elt, piTarget, &handler); // This addRef's
   if (!handler)
     return NS_ERROR_FAILURE;
 
   // listen to these events
   nsCOMPtr<nsIDOMEventGroup> systemGroup;
-  rec->GetSystemEventGroup(getter_AddRefs(systemGroup));
-  nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(rec);
+  piTarget->GetSystemEventGroup(getter_AddRefs(systemGroup));
+  nsCOMPtr<nsIDOM3EventTarget> target = do_QueryInterface(piTarget);
 
   target->AddGroupedEventListener(NS_LITERAL_STRING("keydown"), handler,
                                   PR_FALSE, systemGroup);
   target->AddGroupedEventListener(NS_LITERAL_STRING("keyup"), handler, 
                                   PR_FALSE, systemGroup);
   target->AddGroupedEventListener(NS_LITERAL_STRING("keypress"), handler, 
                                   PR_FALSE, systemGroup);
 
@@ -1141,18 +1141,20 @@ nsXBLService::FetchBindingDocument(nsICo
                               xblSink);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aForceSyncLoad) {
     // We can be asynchronous
     nsXBLStreamListener* xblListener = new nsXBLStreamListener(this, listener, aBoundDocument, doc);
     NS_ENSURE_TRUE(xblListener,NS_ERROR_OUT_OF_MEMORY);
 
-    nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(doc));
-    rec->AddEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)xblListener, PR_FALSE);
+    nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(doc));
+    target->AddEventListener(NS_LITERAL_STRING("load"),
+                             NS_STATIC_CAST(nsIDOMLoadListener*, xblListener),
+                             PR_FALSE);
 
     // Add ourselves to the list of loading docs.
     nsBindingManager *bindingManager;
     if (aBoundDocument)
       bindingManager = aBoundDocument->BindingManager();
     else
       bindingManager = nsnull;
 
--- a/content/xbl/src/nsXBLService.h
+++ b/content/xbl/src/nsXBLService.h
@@ -76,17 +76,17 @@ class nsXBLService : public nsIXBLServic
   NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
 
   // This method checks the hashtable and then calls FetchBindingDocument on a miss.
   NS_IMETHOD LoadBindingDocumentInfo(nsIContent* aBoundElement, nsIDocument* aBoundDocument,
                                      nsIURI* aBindingURI,
                                      PRBool aForceSyncLoad, nsIXBLDocumentInfo** aResult);
 
   // Used by XUL key bindings and for window XBL.
-  NS_IMETHOD AttachGlobalKeyHandler(nsIDOMEventReceiver* aElement);
+  NS_IMETHOD AttachGlobalKeyHandler(nsPIDOMEventTarget* aTarget);
 
   NS_DECL_NSIOBSERVER
 
 public:
   nsXBLService();
   virtual ~nsXBLService();
 
 protected:
--- a/content/xbl/src/nsXBLWindowKeyHandler.cpp
+++ b/content/xbl/src/nsXBLWindowKeyHandler.cpp
@@ -39,17 +39,17 @@
 
 #include "nsCOMPtr.h"
 #include "nsXBLPrototypeHandler.h"
 #include "nsXBLWindowKeyHandler.h"
 #include "nsIContent.h"
 #include "nsIAtom.h"
 #include "nsIDOMNSUIEvent.h"
 #include "nsIDOMKeyEvent.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMNSEvent.h"
 #include "nsXBLService.h"
 #include "nsIServiceManager.h"
 #include "nsGkAtoms.h"
 #include "nsIXBLDocumentInfo.h"
 #include "nsIDOMElement.h"
 #include "nsINativeKeyBindings.h"
 #include "nsIController.h"
@@ -170,18 +170,19 @@ nsXBLSpecialDocInfo::GetAllHandlers(cons
     GetHandlers(mHTMLBindings, nsDependentCString(aType), aHandler);
   }
 }
 
 // Init statics
 nsXBLSpecialDocInfo* nsXBLWindowKeyHandler::sXBLSpecialDocInfo = nsnull;
 PRUint32 nsXBLWindowKeyHandler::sRefCnt = 0;
 
-nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver)
-  : mReceiver(aReceiver),
+nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement,
+                                             nsPIDOMEventTarget* aTarget)
+  : mTarget(aTarget),
     mHandler(nsnull),
     mUserHandler(nsnull)
 {
   mWeakPtrForElement = do_GetWeakReference(aElement);
   ++sRefCnt;
 }
 
 nsXBLWindowKeyHandler::~nsXBLWindowKeyHandler()
@@ -350,17 +351,17 @@ nsXBLWindowKeyHandler::WalkHandlers(nsID
     keyEvent->GetKeyCode(&nativeEvent.keyCode);
     keyEvent->GetAltKey(&nativeEvent.altKey);
     keyEvent->GetCtrlKey(&nativeEvent.ctrlKey);
     keyEvent->GetShiftKey(&nativeEvent.shiftKey);
     keyEvent->GetMetaKey(&nativeEvent.metaKey);
 
     // get the DOM window we're attached to
     nsCOMPtr<nsIControllers> controllers;
-    nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(mReceiver);
+    nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(mTarget);
     if (root) {
       nsCOMPtr<nsIFocusController> fc;
       root->GetFocusController(getter_AddRefs(fc));
       if (fc) {
         fc->GetControllers(getter_AddRefs(controllers));
       }
     }
 
@@ -426,17 +427,17 @@ nsXBLWindowKeyHandler::ShutDown()
 //
 // IsEditor
 //
 // Determine if the document we're working with is Editor or Browser
 //
 PRBool
 nsXBLWindowKeyHandler::IsEditor()
 {
-  nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(mReceiver));
+  nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(mTarget));
   NS_ENSURE_TRUE(windowRoot, PR_FALSE);
   nsCOMPtr<nsIFocusController> focusController;
   windowRoot->GetFocusController(getter_AddRefs(focusController));
   if (!focusController) {
     NS_WARNING("********* Something went wrong! No focus controller on the root!!!\n");
     return PR_FALSE;
   }
 
@@ -529,25 +530,25 @@ nsXBLWindowKeyHandler::WalkHandlersInter
 
       // Check that there is an oncommand handler
       commandElt->GetAttribute(NS_LITERAL_STRING("oncommand"), value);
       if (value.IsEmpty()) {
         continue;  // nothing to do
       }
     }
 
-    nsCOMPtr<nsIDOMEventReceiver> rec;
+    nsCOMPtr<nsPIDOMEventTarget> piTarget;
     nsCOMPtr<nsIDOMElement> element = GetElement();
     if (element) {
-      rec = do_QueryInterface(commandElt);
+      piTarget = do_QueryInterface(commandElt);
     } else {
-      rec = mReceiver;
+      piTarget = mTarget;
     }
 
-    rv = currHandler->ExecuteHandler(rec, aEvent);
+    rv = currHandler->ExecuteHandler(piTarget, aEvent);
     if (NS_SUCCEEDED(rv)) {
       return NS_OK;
     }
   }
 
   return NS_OK;
 }
 
@@ -558,16 +559,17 @@ nsXBLWindowKeyHandler::GetElement()
   nsIDOMElement* el = nsnull;
   element.swap(el);
   return el;
 }
 
 ///////////////////////////////////////////////////////////////////////////////////
 
 nsresult
-NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver, nsXBLWindowKeyHandler** aResult)
+NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement, nsPIDOMEventTarget* aTarget,
+                          nsXBLWindowKeyHandler** aResult)
 {
-  *aResult = new nsXBLWindowKeyHandler(aElement, aReceiver);
+  *aResult = new nsXBLWindowKeyHandler(aElement, aTarget);
   if (!*aResult)
     return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(*aResult);
   return NS_OK;
 }
--- a/content/xbl/src/nsXBLWindowKeyHandler.h
+++ b/content/xbl/src/nsXBLWindowKeyHandler.h
@@ -40,25 +40,26 @@
 #ifndef nsXBLWindowKeyHandler_h__
 #define nsXBLWindowKeyHandler_h__
 
 #include "nsWeakPtr.h"
 #include "nsIDOMKeyListener.h"
 
 class nsIAtom;
 class nsIDOMElement;
-class nsIDOMEventReceiver;
+class nsIDOMEventTarget;
+class nsPIDOMEventTarget;
 class nsIXBLDocumentInfo;
 class nsXBLSpecialDocInfo;
 class nsXBLPrototypeHandler;
 
 class nsXBLWindowKeyHandler : public nsIDOMKeyListener
 {
 public:
-  nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver);
+  nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsPIDOMEventTarget* aTarget);
   virtual ~nsXBLWindowKeyHandler();
   
   // nsIDOMetc.
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent)
   {
     return NS_OK;
   }
 
@@ -90,26 +91,26 @@ protected:
   // are we working with editor or browser?
   PRBool IsEditor() ;
 
   // Returns the element which was passed as a parameter to the constructor,
   // unless the element has been removed from the document.
   already_AddRefed<nsIDOMElement> GetElement();
   // Using weak pointer to the DOM Element.
   nsWeakPtr              mWeakPtrForElement;
-  nsIDOMEventReceiver*   mReceiver; // weak ref
+  nsPIDOMEventTarget*    mTarget; // weak ref
 
   // these are not owning references; the prototype handlers are owned
   // by the prototype bindings which are owned by the docinfo.
   nsXBLPrototypeHandler* mHandler;     // platform bindings
   nsXBLPrototypeHandler* mUserHandler; // user-specific bindings
 
   // holds document info about bindings
   static nsXBLSpecialDocInfo* sXBLSpecialDocInfo;
   static PRUint32 sRefCnt;
 };
 
 nsresult
 NS_NewXBLWindowKeyHandler(nsIDOMElement* aElement,
-                          nsIDOMEventReceiver* aReceiver,
+                          nsPIDOMEventTarget* aTarget,
                           nsXBLWindowKeyHandler** aResult);
 
 #endif
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -72,17 +72,17 @@
 #include "nsIDOMLoadListener.h"
 #include "nsIDOMFocusListener.h"
 #include "nsIDOMKeyListener.h"
 #include "nsIDOMFormListener.h"
 #include "nsIDOMXULListener.h"
 #include "nsIDOMContextMenuListener.h"
 #include "nsIDOMDragListener.h"
 #include "nsIDOMEventListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMElementCSSInlineStyle.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDocument.h"
 #include "nsIEventListenerManager.h"
 #include "nsIEventStateManager.h"
@@ -518,21 +518,21 @@ nsXULElement::GetEventListenerManagerFor
     nsIDocument* doc = GetOwnerDoc();
     if (!doc)
         return NS_ERROR_UNEXPECTED; // XXX
 
     nsIContent *root = doc->GetRootContent();
     if ((!root || root == this) && !mNodeInfo->Equals(nsGkAtoms::overlay)) {
         nsPIDOMWindow *window = doc->GetInnerWindow();
 
-        nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(window);
-        if (!receiver)
+        nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(window);
+        if (!piTarget)
             return NS_ERROR_UNEXPECTED;
 
-        nsresult rv = receiver->GetListenerManager(PR_TRUE, aManager);
+        nsresult rv = piTarget->GetListenerManager(PR_TRUE, aManager);
         if (NS_SUCCEEDED(rv)) {
             NS_ADDREF(*aTarget = window);
         }
         *aDefer = PR_FALSE;
         return rv;
     }
 
     return nsGenericElement::GetEventListenerManagerForAttr(aManager,
--- a/content/xul/content/src/nsXULElement.h
+++ b/content/xul/content/src/nsXULElement.h
@@ -52,17 +52,17 @@
 // XXX because nsIEventListenerManager has broken includes
 #include "nsIDOMEvent.h"
 #include "nsIServiceManager.h"
 #include "nsIAtom.h"
 #include "nsINodeInfo.h"
 #include "nsIControllers.h"
 #include "nsICSSParser.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #include "nsIEventListenerManager.h"
 #include "nsIRDFCompositeDataSource.h"
 #include "nsIRDFResource.h"
 #include "nsIScriptObjectOwner.h"
 #include "nsBindingManager.h"
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -1681,18 +1681,18 @@ nsXULDocument::AddElementToDocumentPre(n
 nsresult
 nsXULDocument::AddElementToDocumentPost(nsIContent* aElement)
 {
     // We need to pay special attention to the keyset tag to set up a listener
     if (aElement->NodeInfo()->Equals(nsGkAtoms::keyset, kNameSpaceID_XUL)) {
         // Create our XUL key listener and hook it up.
         nsCOMPtr<nsIXBLService> xblService(do_GetService("@mozilla.org/xbl;1"));
         if (xblService) {
-            nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(aElement));
-            xblService->AttachGlobalKeyHandler(rec);
+            nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(aElement));
+            xblService->AttachGlobalKeyHandler(piTarget);
         }
     }
 
     // See if we need to attach a XUL template to this node
     PRBool needsHookup;
     nsresult rv = CheckTemplateBuilderHookup(aElement, &needsHookup);
     if (NS_FAILED(rv))
         return rv;
--- a/content/xul/document/src/nsXULDocument.h
+++ b/content/xul/document/src/nsXULDocument.h
@@ -44,17 +44,17 @@
 #include "nsXULPrototypeDocument.h"
 #include "nsXULPrototypeCache.h"
 #include "nsTArray.h"
 
 #include "nsXMLDocument.h"
 #include "nsElementMap.h"
 #include "nsForwardReference.h"
 #include "nsIContent.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMXULDocument.h"
 #include "nsISupportsArray.h"
 #include "nsCOMArray.h"
 #include "nsIURI.h"
 #include "nsIXULDocument.h"
 #include "nsScriptLoader.h"
 #include "nsIStreamListener.h"
--- a/dom/public/coreEvents/Makefile.in
+++ b/dom/public/coreEvents/Makefile.in
@@ -40,17 +40,16 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= dom
 
 EXPORTS =				\
-	nsIDOMEventReceiver.h		\
 	nsIDOMFocusListener.h		\
 	nsIDOMFormListener.h		\
 	nsIDOMKeyListener.h		\
 	nsIDOMLoadListener.h		\
 	nsIDOMMouseListener.h		\
 	nsIDOMMouseMotionListener.h	\
 	nsIDOMDragListener.h		\
 	nsIDOMTextListener.h		\
deleted file mode 100644
--- a/dom/public/coreEvents/nsIDOMEventReceiver.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsIDOMEventReceiver_h__
-#define nsIDOMEventReceiver_h__
-
-#include "nsIDOMEventTarget.h"
-
-class nsIDOMEventListener;
-class nsIEventListenerManager;
-class nsIDOMEvent;
-class nsIDOMEventGroup;
-
-/*
- * DOM event source class.  Object that allow event registration and
- * distribution from themselves implement this interface.
- */
- 
-/* 025957f3-7b19-452b-89a1-9be652d8d6db */
-#define NS_IDOMEVENTRECEIVER_IID \
-{ 0x025957f3, 0x7b19, 0x452b, \
-  { 0x89, 0xa1, 0x9b, 0xe6, 0x52, 0xd8, 0xd6, 0xdb } }
-
-class nsIDOMEventReceiver : public nsIDOMEventTarget
-{
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMEVENTRECEIVER_IID)
-
-  NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
-                                   const nsIID& aIID) = 0;
-  NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
-                                      const nsIID& aIID) = 0;
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult) = 0;
-  NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMEventReceiver, NS_IDOMEVENTRECEIVER_IID)
-
-#endif // nsIDOMEventReceiver_h__
--- a/dom/src/base/nsDOMClassInfo.cpp
+++ b/dom/src/base/nsDOMClassInfo.cpp
@@ -163,17 +163,17 @@
 #include "nsIDOMNSHTMLOptionCollectn.h"
 #include "nsIDOMHTMLOptionsCollection.h"
 
 // ContentList includes
 #include "nsContentList.h"
 
 // Event related includes
 #include "nsIEventListenerManager.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMNSEventTarget.h"
 
 // CSS related includes
 #include "nsIDOMStyleSheet.h"
 #include "nsIDOMStyleSheetList.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsIDOMCSSRule.h"
 #include "nsIDOMCSSRuleList.h"
@@ -6701,44 +6701,41 @@ nsEventReceiverSH::RegisterCompileHandle
 
   if (ObjectIsNativeWrapper(cx, obj)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   nsIScriptContext *script_cx = nsJSUtils::GetStaticScriptContext(cx, obj);
   NS_ENSURE_TRUE(script_cx, NS_ERROR_UNEXPECTED);
 
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryWrappedNative(wrapper));
-  if (!receiver) {
+  nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryWrappedNative(wrapper));
+  if (!piTarget) {
     // Doesn't do events
-#ifdef DEBUG
-    nsCOMPtr<nsIAttribute> attr = do_QueryWrappedNative(wrapper);
-    NS_WARN_IF_FALSE(attr, "Non-attr doesn't QI to nsIDOMEventReceiver?");
-#endif
+    NS_WARNING("Doesn't QI to nsPIDOMEventTarget?");
     return NS_OK;
   }
   
   nsCOMPtr<nsIEventListenerManager> manager;
-  receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
+  piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
   NS_ENSURE_TRUE(manager, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIAtom> atom(do_GetAtom(nsDependentJSString(id)));
   NS_ENSURE_TRUE(atom, NS_ERROR_OUT_OF_MEMORY);
 
   nsresult rv;
 
   JSObject *scope = GetGlobalJSObject(cx, obj);
 
   if (compile) {
-    rv = manager->CompileScriptEventListener(script_cx, scope, receiver, atom,
+    rv = manager->CompileScriptEventListener(script_cx, scope, piTarget, atom,
                                              did_define);
   } else if (remove) {
     rv = manager->RemoveScriptEventListener(atom);
   } else {
-    rv = manager->RegisterScriptEventListener(script_cx, scope, receiver,
+    rv = manager->RegisterScriptEventListener(script_cx, scope, piTarget,
                                               atom);
   }
 
   return NS_FAILED(rv) ? rv : NS_SUCCESS_I_DID_SOMETHING;
 }
 
 NS_IMETHODIMP
 nsEventReceiverSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
--- a/dom/src/base/nsGlobalWindow.cpp
+++ b/dom/src/base/nsGlobalWindow.cpp
@@ -693,17 +693,16 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   // Make sure this matches the cast in nsGlobalWindow::FromWrapper()
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsIDOMWindowInternal)
   NS_INTERFACE_MAP_ENTRY(nsIDOMWindow)
   NS_INTERFACE_MAP_ENTRY(nsIDOMWindow2)
   NS_INTERFACE_MAP_ENTRY(nsIDOMJSWindow)
   NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
   NS_INTERFACE_MAP_ENTRY(nsIDOMViewCSS)
   NS_INTERFACE_MAP_ENTRY(nsIDOMAbstractView)
   NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
@@ -1288,19 +1287,19 @@ nsGlobalWindow::SetNewDocument(nsIDocume
     // Get our private root. If it is equal to us, then we need to
     // attach our global key bindings that handles browser scrolling
     // and other browser commands.
     nsIDOMWindowInternal *internal = nsGlobalWindow::GetPrivateRoot();
 
     if (internal == NS_STATIC_CAST(nsIDOMWindowInternal *, this)) {
       nsCOMPtr<nsIXBLService> xblService = do_GetService("@mozilla.org/xbl;1");
       if (xblService) {
-        nsCOMPtr<nsIDOMEventReceiver> rec =
+        nsCOMPtr<nsPIDOMEventTarget> piTarget =
           do_QueryInterface(mChromeEventHandler);
-        xblService->AttachGlobalKeyHandler(rec);
+        xblService->AttachGlobalKeyHandler(piTarget);
       }
     }
   }
 
   /* No mDocShell means we're either an inner window or we're already
      been partially closed down.  When that happens, setting status
      isn't a big requirement, so don't. (Doesn't happen under normal
      circumstances, but bug 49615 describes a case.) */
@@ -5562,50 +5561,45 @@ nsGlobalWindow::AddEventListener(const n
 
   if (aWantsUntrusted) {
     flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
   }
 
   return manager->AddEventListenerByType(aListener, aType, flags, nsnull);
 }
 
-
-//*****************************************************************************
-// nsGlobalWindow::nsIDOMEventReceiver
-//*****************************************************************************
-
-NS_IMETHODIMP
+nsresult
 nsGlobalWindow::AddEventListenerByIID(nsIDOMEventListener* aListener,
                                       const nsIID& aIID)
 {
   nsCOMPtr<nsIEventListenerManager> manager;
 
   if (NS_SUCCEEDED(GetListenerManager(PR_TRUE, getter_AddRefs(manager)))) {
     manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP
+nsresult
 nsGlobalWindow::RemoveEventListenerByIID(nsIDOMEventListener* aListener,
                                          const nsIID& aIID)
 {
   FORWARD_TO_INNER(RemoveEventListenerByIID, (aListener, aIID),
                    NS_ERROR_NOT_INITIALIZED);
 
   if (mListenerManager) {
     mListenerManager->RemoveEventListenerByIID(aListener, aIID,
                                                NS_EVENT_FLAG_BUBBLE);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP
+nsresult
 nsGlobalWindow::GetListenerManager(PRBool aCreateIfNotFound,
                                    nsIEventListenerManager** aResult)
 {
   FORWARD_TO_INNER_CREATE(GetListenerManager, (aCreateIfNotFound, aResult));
 
   if (!mListenerManager) {
     if (!aCreateIfNotFound) {
       *aResult = nsnull;
@@ -5614,25 +5608,25 @@ nsGlobalWindow::GetListenerManager(PRBoo
 
     static NS_DEFINE_CID(kEventListenerManagerCID,
                          NS_EVENTLISTENERMANAGER_CID);
     nsresult rv;
 
     mListenerManager = do_CreateInstance(kEventListenerManagerCID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     mListenerManager->SetListenerTarget(
-      NS_STATIC_CAST(nsIDOMEventReceiver*, this));
+      NS_STATIC_CAST(nsPIDOMEventTarget*, this));
   }
 
   NS_ADDREF(*aResult = mListenerManager);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsGlobalWindow::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
 {
   nsCOMPtr<nsIEventListenerManager> manager;
   if (NS_SUCCEEDED(GetListenerManager(PR_TRUE, getter_AddRefs(manager))) &&
       manager) {
     return manager->GetSystemEventGroupLM(aGroup);
   }
   return NS_ERROR_FAILURE;
--- a/dom/src/base/nsGlobalWindow.h
+++ b/dom/src/base/nsGlobalWindow.h
@@ -56,17 +56,17 @@
 #include "nsDOMWindowList.h"
 #include "nsIBaseWindow.h"
 #include "nsIBrowserDOMWindow.h"
 #include "nsIControllers.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDOMClientInformation.h"
 #include "nsIDOMViewCSS.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsIDOMNSEventTarget.h"
 #include "nsIDOMNavigator.h"
 #include "nsIDOMNSLocation.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIDOMJSWindow.h"
@@ -211,17 +211,17 @@ private:
 // object's lists also contain its outer and all other inner windows
 // belonging to the same outer window, but that's an unimportant
 // side effect of inheriting PRCList).
 
 class nsGlobalWindow : public nsPIDOMWindow,
                        public nsIScriptGlobalObject,
                        public nsIDOMJSWindow,
                        public nsIScriptObjectPrincipal,
-                       public nsIDOMEventReceiver,
+                       public nsIDOMEventTarget,
                        public nsPIDOMEventTarget,
                        public nsIDOM3EventTarget,
                        public nsIDOMNSEventTarget,
                        public nsIDOMViewCSS,
                        public nsIDOMStorageWindow,
                        public nsSupportsWeakReference,
                        public nsIInterfaceRequestor,
                        public PRCListStr
@@ -273,25 +273,16 @@ public:
   NS_DECL_NSIDOMEVENTTARGET
 
   // nsIDOM3EventTarget
   NS_DECL_NSIDOM3EVENTTARGET
 
   // nsIDOMNSEventTarget
   NS_DECL_NSIDOMNSEVENTTARGET
 
-  // nsIDOMEventReceiver
-  NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
-                                   const nsIID& aIID);
-  NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
-                                      const nsIID& aIID);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
-  NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
-
   // nsPIDOMWindow
   virtual NS_HIDDEN_(nsPIDOMWindow*) GetPrivateRoot();
   virtual NS_HIDDEN_(nsresult) Activate();
   virtual NS_HIDDEN_(nsresult) Deactivate();
   virtual NS_HIDDEN_(nsIFocusController*) GetRootFocusController();
 
   virtual NS_HIDDEN_(void) SetOpenerScriptPrincipal(nsIPrincipal* aPrincipal);
   virtual NS_HIDDEN_(nsIPrincipal*) GetOpenerScriptPrincipal();
@@ -316,16 +307,23 @@ public:
     return NS_STATIC_CAST(nsPIDOMEventTarget*, GetCurrentInnerWindowInternal());
   }
   virtual NS_HIDDEN_(nsresult) PreHandleEvent(nsEventChainPreVisitor& aVisitor);
   virtual NS_HIDDEN_(nsresult) PostHandleEvent(nsEventChainPostVisitor& aVisitor);
   virtual NS_HIDDEN_(nsresult) DispatchDOMEvent(nsEvent* aEvent,
                                                 nsIDOMEvent* aDOMEvent,
                                                 nsPresContext* aPresContext,
                                                 nsEventStatus* aEventStatus);
+  virtual NS_HIDDEN_(nsresult) GetListenerManager(PRBool aCreateIfNotFound,
+                                                  nsIEventListenerManager** aResult);
+  virtual NS_HIDDEN_(nsresult) AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                                     const nsIID& aIID);
+  virtual NS_HIDDEN_(nsresult) RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                                        const nsIID& aIID);
+  virtual NS_HIDDEN_(nsresult) GetSystemEventGroup(nsIDOMEventGroup** aGroup);
 
   virtual NS_HIDDEN_(void) SetDocShell(nsIDocShell* aDocShell);
   virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
                                   nsISupports *aState,
                                   PRBool aClearScopeHint);
   virtual NS_HIDDEN_(void) SetOpenerWindow(nsIDOMWindowInternal *aOpener,
                                            PRBool aOriginalOpener);
   virtual NS_HIDDEN_(void) EnsureSizeUpToDate();
--- a/dom/src/base/nsWindowRoot.cpp
+++ b/dom/src/base/nsWindowRoot.cpp
@@ -62,34 +62,33 @@ static NS_DEFINE_CID(kEventListenerManag
 nsWindowRoot::nsWindowRoot(nsIDOMWindow* aWindow)
 {
   mWindow = aWindow;
 
   // Create and init our focus controller.
   nsFocusController::Create(getter_AddRefs(mFocusController));
 
   nsCOMPtr<nsIDOMFocusListener> focusListener(do_QueryInterface(mFocusController));
-  mRefCnt.incr(NS_STATIC_CAST(nsIDOMEventReceiver*, this));
+  mRefCnt.incr(NS_STATIC_CAST(nsIDOMEventTarget*, this));
   AddEventListener(NS_LITERAL_STRING("focus"), focusListener, PR_TRUE);
   AddEventListener(NS_LITERAL_STRING("blur"), focusListener, PR_TRUE);
-  mRefCnt.decr(NS_STATIC_CAST(nsIDOMEventReceiver*, this));
+  mRefCnt.decr(NS_STATIC_CAST(nsIDOMEventTarget*, this));
 }
 
 nsWindowRoot::~nsWindowRoot()
 {
   if (mListenerManager) {
     mListenerManager->Disconnect();
   }
 }
 
 NS_IMPL_CYCLE_COLLECTION_2(nsWindowRoot, mListenerManager, mFocusController)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsWindowRoot)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventReceiver)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsPIWindowRoot)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsWindowRoot, nsIDOMEventReceiver)
@@ -179,62 +178,62 @@ nsWindowRoot::AddEventListener(const nsA
 
   if (aWantsUntrusted) {
     flags |= NS_PRIV_EVENT_UNTRUSTED_PERMITTED;
   }
 
   return manager->AddEventListenerByType(aListener, aType, flags, nsnull);
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindowRoot::AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
 {
   nsCOMPtr<nsIEventListenerManager> manager;
   GetListenerManager(PR_TRUE, getter_AddRefs(manager));
   if (manager) {
     manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
   
-NS_IMETHODIMP
+nsresult
 nsWindowRoot::RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID)
 {
   nsCOMPtr<nsIEventListenerManager> manager;
   GetListenerManager(PR_TRUE, getter_AddRefs(manager));
   if (manager) {
     manager->RemoveEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindowRoot::GetListenerManager(PRBool aCreateIfNotFound,
                                  nsIEventListenerManager** aResult)
 {
   if (!mListenerManager) {
     if (!aCreateIfNotFound) {
       *aResult = nsnull;
       return NS_OK;
     }
     nsresult rv;
     mListenerManager = do_CreateInstance(kEventListenerManagerCID, &rv);
     if (NS_FAILED(rv)) return rv;
     mListenerManager->SetListenerTarget(
-      NS_STATIC_CAST(nsIDOMEventReceiver*, this));
+      NS_STATIC_CAST(nsPIDOMEventTarget*, this));
   }
 
   *aResult = mListenerManager;
   NS_ADDREF(*aResult);
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsWindowRoot::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
 {
   nsCOMPtr<nsIEventListenerManager> manager;
   if (NS_SUCCEEDED(GetListenerManager(PR_TRUE, getter_AddRefs(manager))) &&
     manager) {
     return manager->GetSystemEventGroupLM(aGroup);
   }
   return NS_ERROR_FAILURE;
--- a/dom/src/base/nsWindowRoot.h
+++ b/dom/src/base/nsWindowRoot.h
@@ -42,26 +42,26 @@
 
 class nsIDOMWindow;
 class nsIDOMEventListener;
 class nsIEventListenerManager;
 class nsIDOMEvent;
 class nsEventChainPreVisitor;
 class nsEventChainPostVisitor;
 
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsIDOMNSEventTarget.h"
 #include "nsIEventListenerManager.h"
 #include "nsPIWindowRoot.h"
 #include "nsIFocusController.h"
 #include "nsIDOMEventTarget.h"
 #include "nsCycleCollectionParticipant.h"
 
-class nsWindowRoot : public nsIDOMEventReceiver,
+class nsWindowRoot : public nsIDOMEventTarget,
                      public nsIDOM3EventTarget,
                      public nsIDOMNSEventTarget,
                      public nsPIWindowRoot
 {
 public:
   nsWindowRoot(nsIDOMWindow* aWindow);
   virtual ~nsWindowRoot();
 
@@ -71,28 +71,28 @@ public:
   NS_DECL_NSIDOMNSEVENTTARGET
 
   virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
   virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
   virtual nsresult DispatchDOMEvent(nsEvent* aEvent,
                                     nsIDOMEvent* aDOMEvent,
                                     nsPresContext* aPresContext,
                                     nsEventStatus* aEventStatus);
-
-  // nsIDOMEventReceiver
-  NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
-  NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
-  NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
-                                nsIEventListenerManager** aResult);
-  NS_IMETHOD GetSystemEventGroup(nsIDOMEventGroup** aGroup);
+  virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
+                                      nsIEventListenerManager** aResult);
+  virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener,
+                                         const nsIID& aIID);
+  virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener,
+                                            const nsIID& aIID);
+  virtual nsresult GetSystemEventGroup(nsIDOMEventGroup** aGroup);
 
   // nsPIWindowRoot
   NS_IMETHOD GetFocusController(nsIFocusController** aResult);
 
-  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowRoot, nsIDOMEventReceiver)
+  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowRoot, nsIDOMEventTarget)
 
 protected:
   // Members
   nsIDOMWindow* mWindow; // [Weak]. The window will hold on to us and let go when it dies.
   nsCOMPtr<nsIEventListenerManager> mListenerManager; // [Strong]. We own the manager, which owns event listeners attached
                                                       // to us.
   nsCOMPtr<nsIFocusController> mFocusController; // The focus controller for the root.
 };
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -38,17 +38,18 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "pratom.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMNSHTMLElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
+#include "nsPIDOMEventTarget.h"
 #include "nsIEventListenerManager.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsUnicharUtils.h"
 #include "nsReadableUtils.h"
 
 #include "nsIDOMText.h"
 #include "nsIDOMElement.h"
@@ -316,56 +317,56 @@ nsEditor::PostCreate()
 nsresult
 nsEditor::InstallEventListeners()
 {
   NS_ENSURE_TRUE(mDocWeak && mPresShellWeak && mKeyListenerP &&
                  mMouseListenerP && mFocusListenerP && mTextListenerP &&
                  mCompositionListenerP && mDragListenerP,
                  NS_ERROR_NOT_INITIALIZED);
 
-  nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
-
-  if (!erP) {
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
+
+  if (!piTarget) {
     RemoveEventListeners();
     return NS_ERROR_FAILURE;
   }
 
   nsresult rv = NS_OK;
 
   // register the event listeners with the listener manager
   nsCOMPtr<nsIDOMEventGroup> sysGroup;
-  erP->GetSystemEventGroup(getter_AddRefs(sysGroup));
+  piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup));
   nsCOMPtr<nsIEventListenerManager> elmP;
-  erP->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
+  piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
 
   if (sysGroup && elmP)
   {
     rv = elmP->AddEventListenerByType(mKeyListenerP,
                                       NS_LITERAL_STRING("keypress"),
                                       NS_EVENT_FLAG_BUBBLE |
                                       NS_PRIV_EVENT_UNTRUSTED_PERMITTED,
                                       sysGroup);
     NS_ASSERTION(NS_SUCCEEDED(rv),
                  "failed to register key listener in system group");
   }
 
-  rv |= erP->AddEventListenerByIID(mMouseListenerP,
-                                   NS_GET_IID(nsIDOMMouseListener));
-
-  rv |= erP->AddEventListenerByIID(mFocusListenerP,
-                                   NS_GET_IID(nsIDOMFocusListener));
-
-  rv |= erP->AddEventListenerByIID(mTextListenerP,
-                                   NS_GET_IID(nsIDOMTextListener));
-
-  rv |= erP->AddEventListenerByIID(mCompositionListenerP,
-                                   NS_GET_IID(nsIDOMCompositionListener));
-
-  rv |= erP->AddEventListenerByIID(mDragListenerP,
-                                   NS_GET_IID(nsIDOMDragListener));
+  rv |= piTarget->AddEventListenerByIID(mMouseListenerP,
+                                        NS_GET_IID(nsIDOMMouseListener));
+
+  rv |= piTarget->AddEventListenerByIID(mFocusListenerP,
+                                        NS_GET_IID(nsIDOMFocusListener));
+
+  rv |= piTarget->AddEventListenerByIID(mTextListenerP,
+                                        NS_GET_IID(nsIDOMTextListener));
+
+  rv |= piTarget->AddEventListenerByIID(mCompositionListenerP,
+                                        NS_GET_IID(nsIDOMCompositionListener));
+
+  rv |= piTarget->AddEventListenerByIID(mDragListenerP,
+                                        NS_GET_IID(nsIDOMDragListener));
 
   if (NS_FAILED(rv))
   {
     NS_ERROR("failed to register some event listeners");
 
     RemoveEventListeners();
   }
 
@@ -375,66 +376,66 @@ nsEditor::InstallEventListeners()
 void
 nsEditor::RemoveEventListeners()
 {
   if (!mDocWeak)
   {
     return;
   }
 
-  nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
-
-  if (erP)
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
+
+  if (piTarget)
   {
     // unregister the event listeners with the DOM event reveiver
 
     if (mKeyListenerP)
     {
       nsCOMPtr<nsIDOMEventGroup> sysGroup;
-      erP->GetSystemEventGroup(getter_AddRefs(sysGroup));
+      piTarget->GetSystemEventGroup(getter_AddRefs(sysGroup));
       nsCOMPtr<nsIEventListenerManager> elmP;
-      erP->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
+      piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(elmP));
       if (sysGroup && elmP)
       {
         elmP->RemoveEventListenerByType(mKeyListenerP,
                                         NS_LITERAL_STRING("keypress"),
                                         NS_EVENT_FLAG_BUBBLE |
                                         NS_PRIV_EVENT_UNTRUSTED_PERMITTED,
                                         sysGroup);
       }
     }
 
     if (mMouseListenerP)
     {
-      erP->RemoveEventListenerByIID(mMouseListenerP,
-                                    NS_GET_IID(nsIDOMMouseListener));
+      piTarget->RemoveEventListenerByIID(mMouseListenerP,
+                                         NS_GET_IID(nsIDOMMouseListener));
     }
 
     if (mFocusListenerP)
     {
-      erP->RemoveEventListenerByIID(mFocusListenerP,
-                                    NS_GET_IID(nsIDOMFocusListener));
+      piTarget->RemoveEventListenerByIID(mFocusListenerP,
+                                         NS_GET_IID(nsIDOMFocusListener));
     }
 
     if (mTextListenerP)
     {
-      erP->RemoveEventListenerByIID(mTextListenerP,
-                                    NS_GET_IID(nsIDOMTextListener));
+      piTarget->RemoveEventListenerByIID(mTextListenerP,
+                                         NS_GET_IID(nsIDOMTextListener));
     }
 
     if (mCompositionListenerP)
     {
-      erP->RemoveEventListenerByIID(mCompositionListenerP,
-                                    NS_GET_IID(nsIDOMCompositionListener));
+      piTarget->RemoveEventListenerByIID(mCompositionListenerP,
+                                         NS_GET_IID(nsIDOMCompositionListener));
     }
 
     if (mDragListenerP)
     {
-      erP->RemoveEventListenerByIID(mDragListenerP,
-                                    NS_GET_IID(nsIDOMDragListener));
+      piTarget->RemoveEventListenerByIID(mDragListenerP,
+                                         NS_GET_IID(nsIDOMDragListener));
     }
   }
 }
 
 PRBool
 nsEditor::GetDesiredSpellCheckState()
 {
   // Check user override on this element
@@ -5203,55 +5204,55 @@ nsEditor::HandleInlineSpellCheck(PRInt32
                                                        previousSelectedNode,
                                                        previousSelectedOffset,
                                                        aStartNode,
                                                        aStartOffset,
                                                        aEndNode,
                                                        aEndOffset) : NS_OK;
 }
 
-already_AddRefed<nsIDOMEventReceiver>
-nsEditor::GetDOMEventReceiver()
+already_AddRefed<nsPIDOMEventTarget>
+nsEditor::GetPIDOMEventTarget()
 {
-  nsIDOMEventReceiver *erp = mDOMEventReceiver;
-  if (erp)
+  nsPIDOMEventTarget* piTarget = mEventTarget;
+  if (piTarget)
   {
-    NS_ADDREF(erp);
-    return erp;
+    NS_ADDREF(piTarget);
+    return piTarget;
   }
 
   nsIDOMElement *rootElement = GetRoot();
 
   // Now hack to make sure we are not anonymous content.
   // If we are grab the parent of root element for our observer.
 
   nsCOMPtr<nsIContent> content = do_QueryInterface(rootElement);
 
   if (content && content->IsNativeAnonymous())
   {
-    mDOMEventReceiver = do_QueryInterface(content->GetParent());
-    erp = mDOMEventReceiver;
-    NS_IF_ADDREF(erp);
+    mEventTarget = do_QueryInterface(content->GetParent());
+    piTarget = mEventTarget;
+    NS_IF_ADDREF(piTarget);
   }
   else
   {
     // Don't use getDocument here, because we have no way of knowing
     // if Init() was ever called.  So we need to get the document
     // ourselves, if it exists.
     if (mDocWeak)
     {
-      CallQueryReferent(mDocWeak.get(), &erp);
+      CallQueryReferent(mDocWeak.get(), &piTarget);
     }
     else
     {
       NS_ERROR("not initialized yet");
     }
   }
 
-  return erp;
+  return piTarget;
 }
 
 nsIDOMElement *
 nsEditor::GetRoot()
 {
   if (!mRootElement)
   {
     nsCOMPtr<nsIDOMElement> root;
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -58,16 +58,17 @@
 #include "nsIEditActionListener.h"
 #include "nsIEditorObserver.h"
 #include "nsIDocumentStateListener.h"
 #include "nsICSSStyleSheet.h"
 #include "nsIDOMElement.h"
 #include "nsSelectionState.h"
 #include "nsIEditorSpellCheck.h"
 #include "nsIInlineSpellChecker.h"
+#include "nsPIDOMEventTarget.h"
 
 class nsIDOMCharacterData;
 class nsIDOMRange;
 class nsIPresShell;
 class nsIViewManager;
 class ChangeAttributeTxn;
 class CreateElementTxn;
 class InsertElementTxn;
@@ -78,17 +79,17 @@ class SplitElementTxn;
 class JoinElementTxn;
 class EditAggregateTxn;
 class nsILocale;
 class IMETextTxn;
 class AddStyleSheetTxn;
 class RemoveStyleSheetTxn;
 class nsIFile;
 class nsISelectionController;
-class nsIDOMEventReceiver;
+class nsIDOMEventTarget;
 
 #define kMOZEditorBogusNodeAttr NS_LITERAL_STRING("_moz_editor_bogus_node")
 #define kMOZEditorBogusNodeValue NS_LITERAL_STRING("TRUE")
 
 /** implementation of an editor object.  it will be the controller/focal point 
  *  for the main editor services. i.e. the GUIManager, publishing, transaction 
  *  manager, event interfaces. the idea for the event interfaces is to have them 
  *  delegate the actual commands to the editor independent of the XPFE implementation.
@@ -569,17 +570,17 @@ public:
                                     nsISelection *aSelection,
                                     nsIDOMNode *previousSelectedNode,
                                     PRInt32 previousSelectedOffset,
                                     nsIDOMNode *aStartNode,
                                     PRInt32 aStartOffset,
                                     nsIDOMNode *aEndNode,
                                     PRInt32 aEndOffset);
 
-  already_AddRefed<nsIDOMEventReceiver> GetDOMEventReceiver();
+  already_AddRefed<nsPIDOMEventTarget> GetPIDOMEventTarget();
 
   // Fast non-refcounting editor root element accessor
   nsIDOMElement *GetRoot();
 
 public:
   // Argh!  These transaction names are used by PlaceholderTxn and
   // nsPlaintextEditor.  They should be localized to those classes.
   static nsIAtom *gTypingTxnName;
@@ -629,17 +630,17 @@ protected:
    // various listeners
   nsCOMArray<nsIEditActionListener> mActionListeners;  // listens to all low level actions on the doc
   nsCOMArray<nsIEditorObserver> mEditorObservers;  // just notify once per high level change
   nsCOMArray<nsIDocumentStateListener> mDocStateListeners;// listen to overall doc state (dirty or not, just created, etc)
 
   PRInt8                        mDocDirtyState;		// -1 = not initialized
   nsWeakPtr        mDocWeak;  // weak reference to the nsIDOMDocument
   // The form field as an event receiver
-  nsCOMPtr<nsIDOMEventReceiver> mDOMEventReceiver;
+  nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
 
   nsString* mPhonetic;
 
   nsCOMPtr<nsIDOMEventListener> mKeyListenerP;
   nsCOMPtr<nsIDOMEventListener> mMouseListenerP;
   nsCOMPtr<nsIDOMEventListener> mTextListenerP;
   nsCOMPtr<nsIDOMEventListener> mCompositionListenerP;
   nsCOMPtr<nsIDOMEventListener> mDragListenerP;
--- a/editor/libeditor/html/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp
@@ -52,17 +52,16 @@
 #include "nsTextEditRules.h"
 #include "nsIHTMLEditRules.h"
 
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMNSHTMLElement.h"
 #include "nsIDOMNodeList.h"
 
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMEventReceiver.h"
 
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 
 #include "nsIDOMCSSValue.h"
 #include "nsIDOMCSSPrimitiveValue.h"
 #include "nsIDOMRGBColor.h"
@@ -398,21 +397,21 @@ nsresult
 nsHTMLEditor::GrabberClicked()
 {
   // add a mouse move listener to the editor
   nsresult res = NS_OK;
   if (!mMouseMotionListenerP) {
     mMouseMotionListenerP = new ResizerMouseMotionListener(this);
     if (!mMouseMotionListenerP) {return NS_ERROR_NULL_POINTER;}
 
-    nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
-    NS_ENSURE_TRUE(erP, NS_ERROR_FAILURE);
+    nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
+    NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
 
-    res = erP->AddEventListenerByIID(mMouseMotionListenerP,
-                                     NS_GET_IID(nsIDOMMouseMotionListener));
+    res = piTarget->AddEventListenerByIID(mMouseMotionListenerP,
+                                          NS_GET_IID(nsIDOMMouseMotionListener));
     NS_ASSERTION(NS_SUCCEEDED(res),
                  "failed to register mouse motion listener");
   }
   mGrabberClicked = PR_TRUE;
   return res;
 }
 
 nsresult
@@ -427,23 +426,24 @@ nsHTMLEditor::EndMoving()
     nsIDOMElement *rootElement = GetRoot();
 
     nsCOMPtr<nsIContent> rootContent( do_QueryInterface(rootElement) );
     if (!rootContent) return NS_ERROR_FAILURE;
 
     DeleteRefToAnonymousNode(mPositioningShadow, rootContent, ps);
     mPositioningShadow = nsnull;
   }
-  nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
 
-  if (erP && mMouseMotionListenerP) {
+  if (piTarget && mMouseMotionListenerP) {
 #ifdef DEBUG
     nsresult res =
 #endif
-    erP->RemoveEventListenerByIID(mMouseMotionListenerP, NS_GET_IID(nsIDOMMouseMotionListener));
+    piTarget->RemoveEventListenerByIID(mMouseMotionListenerP,
+                                       NS_GET_IID(nsIDOMMouseMotionListener));
     NS_ASSERTION(NS_SUCCEEDED(res), "failed to remove mouse motion listener");
   }
   mMouseMotionListenerP = nsnull;
 
   return NS_OK;
 }
 nsresult
 nsHTMLEditor::SetFinalPosition(PRInt32 aX, PRInt32 aY)
--- a/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -46,17 +46,17 @@
 
 #include "nsEditorEventListeners.h"
 
 #include "nsIDOMText.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMAttr.h"
 #include "nsIDocument.h"
-#include "nsIDOMEventReceiver.h" 
+#include "nsIDOMEventTarget.h" 
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMKeyListener.h" 
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMComment.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -53,17 +53,17 @@
 
 #include "nsHTMLURIRefObject.h"
 
 #include "nsIDOMText.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMAttr.h"
 #include "nsIDocument.h"
-#include "nsIDOMEventReceiver.h" 
+#include "nsIDOMEventTarget.h" 
 #include "nsIDOM3EventTarget.h" 
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMKeyListener.h" 
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsIDOMHTMLAnchorElement.h"
@@ -364,42 +364,43 @@ nsHTMLEditor::CreateEventListeners()
 void
 nsHTMLEditor::RemoveEventListeners()
 {
   if (!mDocWeak)
   {
     return;
   }
 
-  nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
-
-  if (erP)
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
+  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(piTarget);
+
+  if (piTarget && target)
   {
     // Both mMouseMotionListenerP and mResizeEventListenerP can be
     // registerd with other targets than the DOM event receiver that
     // we can reach from here. But nonetheless, unregister the event
     // listeners with the DOM event reveiver (if it's registerd with
     // other targets, it'll get unregisterd once the target goes
     // away).
 
     if (mMouseMotionListenerP)
     {
       // mMouseMotionListenerP might be registerd either by IID or
       // name, unregister by both.
-      erP->RemoveEventListenerByIID(mMouseMotionListenerP,
-                                    NS_GET_IID(nsIDOMMouseMotionListener));
-
-      erP->RemoveEventListener(NS_LITERAL_STRING("mousemove"),
-                               mMouseMotionListenerP, PR_TRUE);
+      piTarget->RemoveEventListenerByIID(mMouseMotionListenerP,
+                                         NS_GET_IID(nsIDOMMouseMotionListener));
+
+      target->RemoveEventListener(NS_LITERAL_STRING("mousemove"),
+                                  mMouseMotionListenerP, PR_TRUE);
     }
 
     if (mResizeEventListenerP)
     {
-      erP->RemoveEventListener(NS_LITERAL_STRING("resize"),
-                               mResizeEventListenerP, PR_FALSE);
+      target->RemoveEventListener(NS_LITERAL_STRING("resize"),
+                                  mResizeEventListenerP, PR_FALSE);
     }
   }
 
   mMouseMotionListenerP = nsnull;
   mResizeEventListenerP = nsnull;
 
   nsPlaintextEditor::RemoveEventListeners();
 }
--- a/editor/libeditor/html/nsHTMLObjectResizer.cpp
+++ b/editor/libeditor/html/nsHTMLObjectResizer.cpp
@@ -35,17 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsHTMLObjectResizer.h"
 
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMNSHTMLElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsPIDOMEventTarget.h"
 #include "nsIDOMText.h"
 
 #include "nsIDOMCSSValue.h"
 #include "nsIDOMCSSPrimitiveValue.h"
 
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIDocumentObserver.h"
@@ -474,31 +474,33 @@ nsHTMLEditor::HideResizers(void)
   mResizingShadow = nsnull;
 
   RemoveListenerAndDeleteRef(mousedown, mMouseListenerP, PR_TRUE,
                              mResizingInfo, bodyContent, ps);
   mResizingInfo = nsnull;
 
   // don't forget to remove the listeners !
 
-  nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
+  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(piTarget);
   nsresult res;
 
-  if (erP && mMouseMotionListenerP)
+  if (target && mMouseMotionListenerP)
   {
-    res = erP->RemoveEventListener(NS_LITERAL_STRING("mousemove"), mMouseMotionListenerP, PR_TRUE);
+    res = target->RemoveEventListener(NS_LITERAL_STRING("mousemove"),
+                                      mMouseMotionListenerP, PR_TRUE);
     NS_ASSERTION(NS_SUCCEEDED(res), "failed to remove mouse motion listener");
   }
   mMouseMotionListenerP = nsnull;
 
   nsCOMPtr<nsIDOMDocument> domDoc;
   GetDocument(getter_AddRefs(domDoc));
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
   if (!doc) { return NS_ERROR_NULL_POINTER; }
-  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(doc->GetWindow());
+  target = do_QueryInterface(doc->GetWindow());
   if (!target) { return NS_ERROR_NULL_POINTER; }
 
   if (mResizeEventListenerP) {
     res = target->RemoveEventListener(NS_LITERAL_STRING("resize"), mResizeEventListenerP, PR_FALSE);
     NS_ASSERTION(NS_SUCCEEDED(res), "failed to remove resize event listener");
   }
   mResizeEventListenerP = nsnull;
 
@@ -607,21 +609,22 @@ nsHTMLEditor::StartResizing(nsIDOMElemen
 
   // add a mouse move listener to the editor
   if (!mMouseMotionListenerP) {
     mMouseMotionListenerP = new ResizerMouseMotionListener(this);
     if (!mMouseMotionListenerP) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
-    nsCOMPtr<nsIDOMEventReceiver> erP = GetDOMEventReceiver();
-    NS_ENSURE_TRUE(erP, NS_ERROR_FAILURE);
+    nsCOMPtr<nsPIDOMEventTarget> piTarget = GetPIDOMEventTarget();
+    nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(piTarget);
+    NS_ENSURE_TRUE(target, NS_ERROR_FAILURE);
 
-    result = erP->AddEventListener(NS_LITERAL_STRING("mousemove"),
-                                   mMouseMotionListenerP, PR_TRUE);
+    result = target->AddEventListener(NS_LITERAL_STRING("mousemove"),
+                                      mMouseMotionListenerP, PR_TRUE);
     NS_ASSERTION(NS_SUCCEEDED(result),
                  "failed to register mouse motion listener");
   }
   return result;
 }
 
 
 NS_IMETHODIMP 
--- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp
+++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp
@@ -37,17 +37,17 @@
 
 
 #include "nsPlaintextEditor.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIFormControl.h"
-#include "nsIDOMEventReceiver.h" 
+#include "nsIDOMEventTarget.h" 
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsISelection.h"
 #include "nsCRT.h"
 #include "nsServiceManagerUtils.h"
 
 #include "nsIDOMRange.h"
 #include "nsIDOMNSRange.h"
--- a/editor/libeditor/text/nsPlaintextEditor.cpp
+++ b/editor/libeditor/text/nsPlaintextEditor.cpp
@@ -42,17 +42,17 @@
 #include "nsICaret.h"
 #include "nsTextEditUtils.h"
 #include "nsTextEditRules.h"
 #include "nsEditorEventListeners.h"
 #include "nsIEditActionListener.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMDocument.h"
 #include "nsIDocument.h"
-#include "nsIDOMEventReceiver.h" 
+#include "nsIDOMEventTarget.h" 
 #include "nsIDOM3EventTarget.h" 
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseListener.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsISelectionController.h"
 #include "nsGUIEvent.h"
 #include "nsIDOMEventGroup.h"
--- a/embedding/browser/gtk/src/EmbedPrivate.cpp
+++ b/embedding/browser/gtk/src/EmbedPrivate.cpp
@@ -642,18 +642,18 @@ EmbedPrivate::Destroy(void)
 
   // Now that we have removed the listener, release our progress
   // object
   mProgressGuard = nsnull;
   mProgress = nsnull;
 
   // detach our event listeners and release the event receiver
   DetachListeners();
-  if (mEventReceiver)
-    mEventReceiver = nsnull;
+  if (mEventTarget)
+    mEventTarget = nsnull;
 
   // destroy our child window
   mWindow->ReleaseChildren();
 
   // release navigation
   mNavigation = nsnull;
 
   // release session history
@@ -988,17 +988,17 @@ EmbedPrivate::ContentStateChange(void)
 {
 
   // we don't attach listeners to chrome
   if (mListenersAttached && !mIsChrome)
     return;
 
   GetListener();
 
-  if (!mEventReceiver)
+  if (!mEventTarget)
     return;
 
   AttachListeners();
 
 #ifdef MOZ_GTKPASSWORD_INTERFACE
   EmbedPasswordMgr *passwordManager = EmbedPasswordMgr::GetInstance();
   if (passwordManager)
     passwordManager->mFormAttachCount = PR_FALSE;
@@ -1113,132 +1113,144 @@ EmbedPrivate::ChildFocusOut(void)
   webBrowserFocus->Deactivate();
 }
 
 // Get the event listener for the chrome event handler.
 
 void
 EmbedPrivate::GetListener(void)
 {
-  if (mEventReceiver)
+  if (mEventTarget)
     return;
 
   nsCOMPtr<nsPIDOMWindow> piWin;
   GetPIDOMWindow(getter_AddRefs(piWin));
 
   if (!piWin)
     return;
 
-  mEventReceiver = do_QueryInterface(piWin->GetChromeEventHandler());
+  mEventTarget = do_QueryInterface(piWin->GetChromeEventHandler());
 }
 
 // attach key and mouse event listeners
 
 void
 EmbedPrivate::AttachListeners(void)
 {
-  if (!mEventReceiver || mListenersAttached)
+  if (!mEventTarget || mListenersAttached)
     return;
 
   nsIDOMEventListener *eventListener =
     NS_STATIC_CAST(nsIDOMEventListener *,
        NS_STATIC_CAST(nsIDOMKeyListener *, mEventListener));
 
   // add the key listener
   nsresult rv;
-  rv = mEventReceiver->AddEventListenerByIID(
+  rv = mEventTarget->AddEventListenerByIID(
          eventListener,
          NS_GET_IID(nsIDOMKeyListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to add key listener\n");
     return;
   }
 
-  rv = mEventReceiver->AddEventListenerByIID(
+  rv = mEventTarget->AddEventListenerByIID(
         eventListener,
         NS_GET_IID(nsIDOMMouseListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to add mouse listener\n");
     return;
   }
 
-  rv = mEventReceiver->AddEventListenerByIID(
+  rv = mEventTarget->AddEventListenerByIID(
          eventListener,
          NS_GET_IID(nsIDOMUIListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to add UI listener\n");
     return;
   }
 
-  rv = mEventReceiver->AddEventListenerByIID(
+  rv = mEventTarget->AddEventListenerByIID(
          eventListener,
          NS_GET_IID(nsIDOMMouseMotionListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to add Mouse Motion listener\n");
     return;
   }
-  rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
-  rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
-  rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
-  rv = mEventReceiver->AddEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
+  
+  nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mEventTarget));
+  if (!target) {
+    return;
+  }
+  
+  rv = target->AddEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
+  rv = target->AddEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
+  rv = target->AddEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
+  rv = target->AddEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to add Mouse Motion listener\n");
     return;
   }
   // ok, all set.
   mListenersAttached = PR_TRUE;
 }
 
 void
 EmbedPrivate::DetachListeners(void)
 {
-  if (!mListenersAttached || !mEventReceiver)
+  if (!mListenersAttached || !mEventTarget)
     return;
 
   nsIDOMEventListener *eventListener =
     NS_STATIC_CAST(nsIDOMEventListener *,
        NS_STATIC_CAST(nsIDOMKeyListener *, mEventListener));
 
   nsresult rv;
-  rv = mEventReceiver->RemoveEventListenerByIID(
+  rv = mEventTarget->RemoveEventListenerByIID(
          eventListener,
          NS_GET_IID(nsIDOMKeyListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to remove key listener\n");
     return;
   }
 
   rv =
-    mEventReceiver->RemoveEventListenerByIID(
+    mEventTarget->RemoveEventListenerByIID(
       eventListener,
       NS_GET_IID(nsIDOMMouseListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to remove mouse listener\n");
     return;
   }
 
-  rv = mEventReceiver->RemoveEventListenerByIID(
+  rv = mEventTarget->RemoveEventListenerByIID(
          eventListener,
          NS_GET_IID(nsIDOMUIListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to remove UI listener\n");
     return;
   }
 
-  rv = mEventReceiver->RemoveEventListenerByIID(
+  rv = mEventTarget->RemoveEventListenerByIID(
          eventListener,
          NS_GET_IID(nsIDOMMouseMotionListener));
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to remove Mouse Motion listener\n");
     return;
   }
-  rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
-  rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
-  rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
-  rv = mEventReceiver->RemoveEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
+  
+  nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mEventTarget));
+  if (!target) {
+    return;
+  }
+
+  rv = target->RemoveEventListener(NS_LITERAL_STRING("focus"), eventListener, PR_TRUE);
+  rv = target->RemoveEventListener(NS_LITERAL_STRING("blur"), eventListener, PR_TRUE);
+  rv = target->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), eventListener, PR_TRUE);
+  rv = target->RemoveEventListener(NS_LITERAL_STRING("load"), eventListener, PR_TRUE);
   mListenersAttached = PR_FALSE;
 }
 
 nsresult
 EmbedPrivate::GetFocusController(nsIFocusController * *controller)
 {
   nsresult rv;
   if (!controller) {
--- a/embedding/browser/gtk/src/EmbedPrivate.h
+++ b/embedding/browser/gtk/src/EmbedPrivate.h
@@ -49,17 +49,17 @@
 #include "nsServiceManagerUtils.h"
 #endif
 #include "nsIWebNavigation.h"
 #include "nsISHistory.h"
 // for our one function that gets the EmbedPrivate via the chrome
 // object.
 #include "nsIWebBrowserChrome.h"
 #include "nsIAppShell.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsPIDOMEventTarget.h"
 #include "nsVoidArray.h"
 
 // app component registration
 #include "nsIGenericFactory.h"
 #include "nsIComponentRegistrar.h"
 
 #include "nsIDocCharset.h"
 #include "nsIMarkupDocumentViewer.h"
@@ -185,18 +185,17 @@ class EmbedPrivate {
   EmbedContentListener          *mContentListener;
   nsCOMPtr<nsISupports>          mContentListenerGuard;
   EmbedEventListener            *mEventListener;
   nsCOMPtr<nsISupports>          mEventListenerGuard;
 
   nsCOMPtr<nsIWebNavigation>     mNavigation;
   nsCOMPtr<nsISHistory>          mSessionHistory;
 
-  // our event receiver
-  nsCOMPtr<nsIDOMEventReceiver>  mEventReceiver;
+  nsCOMPtr<nsPIDOMEventTarget>   mEventTarget;
 
   // the currently loaded uri
   nsString                       mURI;
   nsCString                      mPrePath;
 
   // the number of widgets that have been created
   static PRUint32                sWidgetCount;
   // the path to the GRE
--- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
@@ -66,17 +66,17 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentType.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMNSUIEvent.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMNamedNodeMap.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsIDOMHTMLHtmlElement.h"
 #include "nsIDOMHTMLAppletElement.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIDOMHTMLEmbedElement.h"
 #include "nsIDOMHTMLDocument.h"
@@ -93,39 +93,40 @@
 #include "nsRect.h"
 #include "nsIWebBrowserChromeFocus.h"
 #include "nsIContent.h"
 #include "imgIContainer.h"
 #include "nsContextMenuInfo.h"
 #include "nsPresContext.h"
 #include "nsIViewManager.h"
 #include "nsIView.h"
+#include "nsPIDOMEventTarget.h"
 
 //
 // GetEventReceiver
 //
 // A helper routine that navigates the tricky path from a |nsWebBrowser| to
-// a |nsIDOMEventReceiver| via the window root and chrome event handler.
+// a |nsPIDOMEventTarget| via the window root and chrome event handler.
 //
 static nsresult
-GetEventReceiver ( nsWebBrowser* inBrowser, nsIDOMEventReceiver** outEventRcvr )
+GetPIDOMEventTarget( nsWebBrowser* inBrowser, nsPIDOMEventTarget** aTarget)
 {
   nsCOMPtr<nsIDOMWindow> domWindow;
   inBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
   NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
   NS_ENSURE_TRUE(domWindowPrivate, NS_ERROR_FAILURE);
   nsPIDOMWindow *rootWindow = domWindowPrivate->GetPrivateRoot();
   NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE);
-  nsCOMPtr<nsIDOMEventReceiver> rcvr =
+  nsCOMPtr<nsPIDOMEventTarget> piTarget =
     do_QueryInterface(rootWindow->GetChromeEventHandler());
-  NS_ENSURE_TRUE(rcvr, NS_ERROR_FAILURE);
-  *outEventRcvr = rcvr;
-  NS_IF_ADDREF(*outEventRcvr);
+  NS_ENSURE_TRUE(piTarget, NS_ERROR_FAILURE);
+  *aTarget = piTarget;
+  NS_IF_ADDREF(*aTarget);
   
   return NS_OK;
 }
 
 
 //*****************************************************************************
 //***    nsDocShellTreeOwner: Object Management
 //*****************************************************************************
@@ -900,20 +901,20 @@ nsDocShellTreeOwner::AddChromeListeners(
     }
   }
    
   // install the external dragDrop handler
   if ( !mChromeDragHandler ) {
     mChromeDragHandler = do_CreateInstance("@mozilla.org:/content/content-area-dragdrop;1", &rv);
     NS_ASSERTION(mChromeDragHandler, "Couldn't create the chrome drag handler");
     if ( mChromeDragHandler ) {
-      nsCOMPtr<nsIDOMEventReceiver> rcvr;
-      GetEventReceiver(mWebBrowser, getter_AddRefs(rcvr));
-      nsCOMPtr<nsIDOMEventTarget> rcvrTarget(do_QueryInterface(rcvr));
-      mChromeDragHandler->HookupTo(rcvrTarget, NS_STATIC_CAST(nsIWebNavigation*, mWebBrowser));
+      nsCOMPtr<nsPIDOMEventTarget> piTarget;
+      GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(piTarget));
+      nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(piTarget));
+      mChromeDragHandler->HookupTo(target, NS_STATIC_CAST(nsIWebNavigation*, mWebBrowser));
     }
   }
 
   return rv;
   
 } // AddChromeListeners
 
 
@@ -1110,18 +1111,18 @@ ChromeTooltipListener::~ChromeTooltipLis
 // AddChromeListeners
 //
 // Hook up things to the chrome like context menus and tooltips, if the chrome
 // has implemented the right interfaces.
 //
 NS_IMETHODIMP
 ChromeTooltipListener::AddChromeListeners()
 {  
-  if ( !mEventReceiver )
-    GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
+  if (!mEventTarget)
+    GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget));
   
   // Register the appropriate events for tooltips, but only if
   // the embedding chrome cares.
   nsresult rv = NS_OK;
   nsCOMPtr<nsITooltipListener> tooltipListener ( do_QueryInterface(mWebBrowserChrome) );
   if ( tooltipListener && !mTooltipListenerInstalled ) {
     rv = AddTooltipListener();
     if ( NS_FAILED(rv) )
@@ -1138,21 +1139,21 @@ ChromeTooltipListener::AddChromeListener
 //
 // Subscribe to the events that will allow us to track tooltips. We need "mouse" for mouseExit,
 // "mouse motion" for mouseMove, and "key" for keyDown. As we add the listeners, keep track
 // of how many succeed so we can clean up correctly in Release().
 //
 NS_IMETHODIMP
 ChromeTooltipListener::AddTooltipListener()
 {
-  if (mEventReceiver) {
+  if (mEventTarget) {
     nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
-    nsresult rv = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
-    nsresult rv2 = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
-    nsresult rv3 = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
+    nsresult rv = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
+    nsresult rv2 = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
+    nsresult rv3 = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
     
     // if all 3 succeed, we're a go!
     if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2) && NS_SUCCEEDED(rv3)) 
       mTooltipListenerInstalled = PR_TRUE;
   }
 
   return NS_OK;
 }
@@ -1166,38 +1167,38 @@ ChromeTooltipListener::AddTooltipListene
 NS_IMETHODIMP
 ChromeTooltipListener::RemoveChromeListeners ( )
 {
   HideTooltip();
 
   if ( mTooltipListenerInstalled )
     RemoveTooltipListener();
   
-  mEventReceiver = nsnull;
+  mEventTarget = nsnull;
   
   // it really doesn't matter if these fail...
   return NS_OK;
   
 } // RemoveChromeTooltipListeners
 
 
 
 //
 // RemoveTooltipListener
 //
 // Unsubscribe from all the various tooltip events that we were listening to
 //
 NS_IMETHODIMP 
 ChromeTooltipListener::RemoveTooltipListener()
 {
-  if (mEventReceiver) {
+  if (mEventTarget) {
     nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
-    nsresult rv = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
-    nsresult rv2 = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
-    nsresult rv3 = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
+    nsresult rv = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseListener));
+    nsresult rv2 = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMMouseMotionListener));
+    nsresult rv3 = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMKeyListener));
     if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(rv2) && NS_SUCCEEDED(rv3))
       mTooltipListenerInstalled = PR_FALSE;
   }
 
   return NS_OK;
 }
 
 
@@ -1563,38 +1564,38 @@ ChromeContextMenuListener::~ChromeContex
 // AddContextMenuListener
 //
 // Subscribe to the events that will allow us to track context menus. Bascially, this
 // is just the context-menu DOM event.
 //
 NS_IMETHODIMP
 ChromeContextMenuListener::AddContextMenuListener()
 {
-  if (mEventReceiver) {
+  if (mEventTarget) {
     nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
-    nsresult rv = mEventReceiver->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
+    nsresult rv = mEventTarget->AddEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
     if (NS_SUCCEEDED(rv))
       mContextMenuListenerInstalled = PR_TRUE;
   }
 
   return NS_OK;
 }
 
 
 //
 // RemoveContextMenuListener
 //
 // Unsubscribe from all the various context menu events that we were listening to. 
 //
 NS_IMETHODIMP 
 ChromeContextMenuListener::RemoveContextMenuListener()
 {
-  if (mEventReceiver) {
+  if (mEventTarget) {
     nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
-    nsresult rv = mEventReceiver->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
+    nsresult rv = mEventTarget->RemoveEventListenerByIID(pListener, NS_GET_IID(nsIDOMContextMenuListener));
     if (NS_SUCCEEDED(rv))
       mContextMenuListenerInstalled = PR_FALSE;
   }
 
   return NS_OK;
 }
 
 
@@ -1602,18 +1603,18 @@ ChromeContextMenuListener::RemoveContext
 // AddChromeListeners
 //
 // Hook up things to the chrome like context menus and tooltips, if the chrome
 // has implemented the right interfaces.
 //
 NS_IMETHODIMP
 ChromeContextMenuListener::AddChromeListeners()
 {  
-  if ( !mEventReceiver )
-    GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
+  if (!mEventTarget)
+    GetPIDOMEventTarget(mWebBrowser, getter_AddRefs(mEventTarget));
   
   // Register the appropriate events for context menus, but only if
   // the embedding chrome cares.
   nsresult rv = NS_OK;
 
   nsCOMPtr<nsIContextMenuListener2> contextListener2 ( do_QueryInterface(mWebBrowserChrome) );
   nsCOMPtr<nsIContextMenuListener> contextListener ( do_QueryInterface(mWebBrowserChrome) );
   if ( (contextListener || contextListener2) && !mContextMenuListenerInstalled )
@@ -1630,17 +1631,17 @@ ChromeContextMenuListener::AddChromeList
 // Unsubscribe from the various things we've hooked up to the window root.
 //
 NS_IMETHODIMP
 ChromeContextMenuListener::RemoveChromeListeners()
 {
   if ( mContextMenuListenerInstalled )
     RemoveContextMenuListener();
   
-  mEventReceiver = nsnull;
+  mEventTarget = nsnull;
   
   // it really doesn't matter if these fail...
   return NS_OK;
   
 } // RemoveChromeTooltipListeners
 
 
 
--- a/embedding/browser/webBrowser/nsDocShellTreeOwner.h
+++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.h
@@ -47,31 +47,31 @@
 // Interfaces Needed
 #include "nsIBaseWindow.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIEmbeddingSiteWindow.h"
 #include "nsIWebProgressListener.h"
 #include "nsWeakReference.h"
 #include "nsIDOMKeyListener.h"
 #include "nsIDOMMouseMotionListener.h"
 #include "nsIDOMContextMenuListener.h"
 #include "nsITimer.h"
 #include "nsIPrompt.h"
 #include "nsIAuthPrompt.h"
 #include "nsITooltipListener.h"
 #include "nsITooltipTextProvider.h"
 #include "nsCTooltipTextProvider.h"
 #include "nsIDragDropHandler.h"
-
+#include "nsPIDOMEventTarget.h"
 #include "nsCommandHandler.h"
 
 class nsWebBrowser;
 class ChromeTooltipListener;
 class ChromeContextMenuListener;
 
 // {6D10C180-6888-11d4-952B-0020183BF181}
 #define NS_ICDOCSHELLTREEOWNER_IID \
@@ -223,17 +223,17 @@ private:
 
   NS_IMETHOD AddTooltipListener();
   NS_IMETHOD RemoveTooltipListener();
 
   NS_IMETHOD ShowTooltip ( PRInt32 inXCoords, PRInt32 inYCoords, const nsAString & inTipText ) ;
   NS_IMETHOD HideTooltip ( ) ;
 
   nsWebBrowser* mWebBrowser;
-  nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
+  nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
   nsCOMPtr<nsITooltipTextProvider> mTooltipTextProvider;
   
     // This must be a strong ref in order to make sure we can hide the tooltip
     // if the window goes away while we're displaying one. If we don't hold
     // a strong ref, the chrome might have been disposed of before we get a chance
     // to tell it, and no one would ever tell us of that fact.
   nsCOMPtr<nsIWebBrowserChrome> mWebBrowserChrome;
 
@@ -290,17 +290,17 @@ public:
 private:
 
   NS_IMETHOD AddContextMenuListener();
   NS_IMETHOD RemoveContextMenuListener();
 
   PRPackedBool mContextMenuListenerInstalled;
 
   nsWebBrowser* mWebBrowser;
-  nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
+  nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
   nsCOMPtr<nsIWebBrowserChrome> mWebBrowserChrome;
 
 }; // class ChromeContextMenuListener
 
 
 
 #endif /* nsDocShellTreeOwner_h__ */
 
--- a/extensions/python/dom/src/nsPyDOMModule.cpp
+++ b/extensions/python/dom/src/nsPyDOMModule.cpp
@@ -44,17 +44,17 @@
 
 #include "nsPyContext.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIAtomService.h"
 #include "nsIEventListenerManager.h"
 #include "nsIScriptTimeoutHandler.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsPIDOMEventTarget.h"
 #include "nsIArray.h"
 #include "jscntxt.h"
 #include "nsPIDOMWindow.h"
 #include "nsDOMScriptObjectHolder.h"
 
 // just for constants...
 #include "nsIScriptContext.h"
 #include "nsIScriptGlobalObject.h"
@@ -298,21 +298,21 @@ static PyObject *PyAddScriptEventListene
                 PR_FALSE, PR_FALSE))
         return NULL;
 
     nsAutoString body;
     if (!PyObject_AsNSString(obBody, body))
         return NULL;
 
     // The receiver, to get the manager.
-    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(target));
-    if (!receiver) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
+    nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(target));
+    if (!piTarget) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIEventListenerManager> manager;
-    receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
+    piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
     if (!manager) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
 
     // avoid do_GetAtom - its not part of the XPCOM glue.
     nsresult rv;
     nsCOMPtr<nsIAtomService> atomService =
                   do_GetService(NS_ATOMSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv))
         return PyXPCOM_BuildPyException(rv);
@@ -369,21 +369,21 @@ static PyObject *PyRegisterScriptEventLi
 
     // sob - I don't quite understand this, but things get upset when
     // an outer window gets the event.
     nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(target));
     if (win != nsnull && win->IsOuterWindow()) {
         target = win->GetCurrentInnerWindow();
     }
     // The receiver, to get the manager.
-    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(target));
-    if (!receiver) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
+    nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(target));
+    if (!piTarget) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIEventListenerManager> manager;
-    receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
+    piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
     if (!manager) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
 
     nsresult rv;
     nsCOMPtr<nsIAtomService> atomService =
                   do_GetService(NS_ATOMSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv))
         return PyXPCOM_BuildPyException(rv);
 
@@ -440,21 +440,21 @@ static PyObject *PyCompileScriptEventLis
 
     // sob - I don't quite understand this, but things get upset when
     // an outer window gets the event.
     nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(target));
     if (win != nsnull && win->IsOuterWindow()) {
         target = win->GetCurrentInnerWindow();
     }
     // The receiver, to get the manager.
-    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(target));
-    if (!receiver) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
+    nsCOMPtr<nsPIDOMEventTarget> piTarget(do_QueryInterface(target));
+    if (!piTarget) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIEventListenerManager> manager;
-    receiver->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
+    piTarget->GetListenerManager(PR_TRUE, getter_AddRefs(manager));
     if (!manager) return PyXPCOM_BuildPyException(NS_ERROR_UNEXPECTED);
 
     nsresult rv;
     nsCOMPtr<nsIAtomService> atomService =
                   do_GetService(NS_ATOMSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv))
         return PyXPCOM_BuildPyException(rv);
 
--- a/extensions/python/dom/src/nsPyRuntime.cpp
+++ b/extensions/python/dom/src/nsPyRuntime.cpp
@@ -33,17 +33,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsPyRuntime.h"
 #include "nsPyContext.h"
 #include "nsICategoryManager.h"
 #include "nsIScriptContext.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 
 extern void init_nsdom();
 
 static PRBool initialized = PR_FALSE;
 
 // QueryInterface implementation for nsPythonRuntime
 NS_INTERFACE_MAP_BEGIN(nsPythonRuntime)
   NS_INTERFACE_MAP_ENTRY(nsIScriptRuntime)
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -68,17 +68,18 @@
 #include "mozInlineSpellWordUtil.h"
 #include "mozISpellI18NManager.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentRange.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
+#include "nsPIDOMEventTarget.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMNSRange.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMText.h"
 #include "nsIPlaintextEditor.h"
 #include "nsIPrefBranch.h"
@@ -617,21 +618,23 @@ mozInlineSpellChecker::RegisterEventList
   NS_ENSURE_TRUE(editor, NS_ERROR_NULL_POINTER);
 
   editor->AddEditActionListener(this);
 
   nsCOMPtr<nsIDOMDocument> doc;
   nsresult rv = editor->GetDocument(getter_AddRefs(doc));
   NS_ENSURE_SUCCESS(rv, rv); 
 
-  nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(doc, &rv);
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(doc, &rv);
   NS_ENSURE_SUCCESS(rv, rv); 
 
-  eventReceiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this), NS_GET_IID(nsIDOMMouseListener));
-  eventReceiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this), NS_GET_IID(nsIDOMKeyListener));
+  piTarget->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this),
+                                  NS_GET_IID(nsIDOMMouseListener));
+  piTarget->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this),
+                                  NS_GET_IID(nsIDOMKeyListener));
 
   return NS_OK;
 }
 
 // mozInlineSpellChecker::UnregisterEventListeners
 
 nsresult
 mozInlineSpellChecker::UnregisterEventListeners()
@@ -640,21 +643,23 @@ mozInlineSpellChecker::UnregisterEventLi
   NS_ENSURE_TRUE(editor, NS_ERROR_NULL_POINTER);
 
   editor->RemoveEditActionListener(this);
 
   nsCOMPtr<nsIDOMDocument> doc;
   editor->GetDocument(getter_AddRefs(doc));
   NS_ENSURE_TRUE(doc, NS_ERROR_NULL_POINTER);
   
-  nsCOMPtr<nsIDOMEventReceiver> eventReceiver = do_QueryInterface(doc);
-  NS_ENSURE_TRUE(eventReceiver, NS_ERROR_NULL_POINTER);
+  nsCOMPtr<nsPIDOMEventTarget> piTarget = do_QueryInterface(doc);
+  NS_ENSURE_TRUE(piTarget, NS_ERROR_NULL_POINTER);
 
-  eventReceiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this), NS_GET_IID(nsIDOMMouseListener));
-  eventReceiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this), NS_GET_IID(nsIDOMKeyListener));
+  piTarget->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*, this),
+                                     NS_GET_IID(nsIDOMMouseListener));
+  piTarget->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*, this),
+                                     NS_GET_IID(nsIDOMKeyListener));
   
   return NS_OK;
 }
 
 // mozInlineSpellChecker::GetEnableRealTimeSpell
 
 NS_IMETHODIMP
 mozInlineSpellChecker::GetEnableRealTimeSpell(PRBool* aEnabled)
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -170,17 +170,17 @@ static const char sPrintOptionsContractI
 #include "nsPagePrintTimer.h"
 
 #endif // NS_PRINTING
 
 // FrameSet
 #include "nsIDocument.h"
 
 //focus
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMFocusListener.h"
 #include "nsISelectionController.h"
 
 #include "nsBidiUtils.h"
 #include "nsISHEntry.h"
 #include "nsISHistory.h"
 #include "nsISHistoryInternal.h"
 #include "nsIWebNavigation.h"
@@ -745,27 +745,23 @@ DocumentViewerImpl::InitPresentationStuf
   NS_NEWXPCOM(focusListener, nsDocViewerFocusListener);
   NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);
 
   focusListener->Init(this);
 
   // mFocusListener is a strong reference
   mFocusListener = focusListener;
 
-  // get the DOM event receiver
-  nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
-  NS_ASSERTION(erP, "No event receiver in document!");
-
-  if (erP) {
-    rv = erP->AddEventListenerByIID(mFocusListener,
-                                    NS_GET_IID(nsIDOMFocusListener));
+  if (mDocument) {
+    rv = mDocument->AddEventListenerByIID(mFocusListener,
+                                          NS_GET_IID(nsIDOMFocusListener));
     NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register focus listener");
     if (mOldFocusListener) {
-      rv = erP->RemoveEventListenerByIID(mOldFocusListener,
-                                      NS_GET_IID(nsIDOMFocusListener));
+      rv = mDocument->RemoveEventListenerByIID(mOldFocusListener,
+                                               NS_GET_IID(nsIDOMFocusListener));
       NS_ASSERTION(NS_SUCCEEDED(rv), "failed to remove focus listener");
     }
   }
 
   return NS_OK;
 }
 
 //-----------------------------------------------
@@ -1348,25 +1344,19 @@ DocumentViewerImpl::Open(nsISupports *aS
   PRInt32 itemIndex = 0;
   while (NS_SUCCEEDED(aSHEntry->ChildShellAt(itemIndex++,
                                              getter_AddRefs(item))) && item) {
     AttachContainerRecurse(nsCOMPtr<nsIDocShell>(do_QueryInterface(item)));
   }
   
   SyncParentSubDocMap();
 
-  if (mFocusListener) {
-    // get the DOM event receiver
-    nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
-    NS_ASSERTION(erP, "No event receiver in document!");
-
-    if (erP) {
-      erP->AddEventListenerByIID(mFocusListener,
-                                 NS_GET_IID(nsIDOMFocusListener));
-    }
+  if (mFocusListener && mDocument) {
+    mDocument->AddEventListenerByIID(mFocusListener,
+                                     NS_GET_IID(nsIDOMFocusListener));
   }
 
   // XXX re-enable image animations once that works correctly
 
   PrepareToStartLoad();
   return NS_OK;
 }
 
@@ -1410,25 +1400,19 @@ DocumentViewerImpl::Close(nsISHEntry *aS
     {
       // out of band cleanup of webshell
       mDocument->SetScriptGlobalObject(nsnull);
 
       if (!mSHEntry)
         mDocument->Destroy();
     }
 
-  if (mFocusListener) {
-    // get the DOM event receiver
-    nsCOMPtr<nsIDOMEventReceiver> erP(do_QueryInterface(mDocument));
-    NS_ASSERTION(erP, "No event receiver in document!");
-
-    if (erP) {
-      erP->RemoveEventListenerByIID(mFocusListener,
-                                    NS_GET_IID(nsIDOMFocusListener));
-    }
+  if (mFocusListener && mDocument) {
+    mDocument->RemoveEventListenerByIID(mFocusListener,
+                                        NS_GET_IID(nsIDOMFocusListener));
   }
 
   return NS_OK;
 }
 
 static void
 DetachContainerRecurse(nsIDocShell *aShell)
 {
@@ -1752,23 +1736,19 @@ DocumentViewerImpl::SetDOMDocument(nsIDO
 
     // We're done creating the style set
     styleSet->EndUpdate();
 
     // The pres shell owns the style set now.
     mPresShell->BeginObservingDocument();
 
     // Register the focus listener on the new document
-
-    nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(mDocument, &rv);
-    NS_ASSERTION(erP, "No event receiver in document!");
-
-    if (erP) {
-      rv = erP->AddEventListenerByIID(mFocusListener,
-                                      NS_GET_IID(nsIDOMFocusListener));
+    if (mDocument) {
+      rv = mDocument->AddEventListenerByIID(mFocusListener,
+                                            NS_GET_IID(nsIDOMFocusListener));
       NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register focus listener");
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -34,17 +34,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsComboboxControlFrame.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsFrameManager.h"
 #include "nsFormControlFrame.h"
 #include "nsGfxButtonControlFrame.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsHTMLParts.h"
 #include "nsIFormControl.h"
 #include "nsINameSpaceManager.h"
@@ -1030,24 +1030,21 @@ nsComboboxControlFrame::CreateAnonymousC
 
   // create button which drops the list down
   NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo);
   if (!mButtonContent)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // make someone to listen to the button. If its pressed by someone like Accessibility
   // then open or close the combo box.
-  nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mButtonContent));
-  if (eventReceiver) {
-    mButtonListener = new nsComboButtonListener(this);
-    if (!mButtonListener)
-      return NS_ERROR_OUT_OF_MEMORY;
-    eventReceiver->AddEventListenerByIID(mButtonListener,
-                                         NS_GET_IID(nsIDOMMouseListener));
-  }
+  mButtonListener = new nsComboButtonListener(this);
+  if (!mButtonListener)
+    return NS_ERROR_OUT_OF_MEMORY;
+  mButtonContent->AddEventListenerByIID(mButtonListener,
+                                        NS_GET_IID(nsIDOMMouseListener));
 
   mButtonContent->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                           NS_LITERAL_STRING("button"), PR_FALSE);
   // Set tabindex="-1" so that the button is not tabbable
   mButtonContent->SetAttr(kNameSpaceID_None, nsGkAtoms::tabindex,
                           NS_LITERAL_STRING("-1"), PR_FALSE);
 
   if (!aElements.AppendElement(mButtonContent))
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -58,17 +58,17 @@
 #include "nsIDOMHTMLInputElement.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIComponentManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIFilePicker.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsINodeInfo.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsILocalFile.h"
 #include "nsIFileControlElement.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 #include "nsDisplayList.h"
 
 #define SYNC_TEXT 0x1
@@ -111,25 +111,23 @@ nsFileControlFrame::Init(nsIContent* aCo
 }
 
 void
 nsFileControlFrame::Destroy()
 {
   mTextFrame = nsnull;
   // remove mMouseListener as a mouse event listener (bug 40533, bug 355931)
   if (mBrowse) {
-    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mBrowse));
-    receiver->RemoveEventListenerByIID(mMouseListener,
+    mBrowse->RemoveEventListenerByIID(mMouseListener,
                                        NS_GET_IID(nsIDOMMouseListener));
     nsContentUtils::DestroyAnonymousContent(&mBrowse);
   }
   if (mTextContent) {
-    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mTextContent));
-    receiver->RemoveEventListenerByIID(mMouseListener,
-                                       NS_GET_IID(nsIDOMMouseListener));
+    mTextContent->RemoveEventListenerByIID(mMouseListener,
+                                           NS_GET_IID(nsIDOMMouseListener));
     nsContentUtils::DestroyAnonymousContent(&mTextContent);
   }
 
   mMouseListener->ForgetFrame();
   nsAreaFrame::Destroy();
 }
 
 nsresult
@@ -166,19 +164,18 @@ nsFileControlFrame::CreateAnonymousConte
     textControl->SetDisabled(PR_TRUE);
     textControl->SetReadOnly(PR_TRUE);
   }
 
   if (!aElements.AppendElement(mTextContent))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // register as an event listener of the textbox to open file dialog on mouse click
-  nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(mTextContent);
-  receiver->AddEventListenerByIID(mMouseListener,
-                                  NS_GET_IID(nsIDOMMouseListener));
+  mTextContent->AddEventListenerByIID(mMouseListener,
+                                      NS_GET_IID(nsIDOMMouseListener));
 
   // Create the browse button
   NS_NewHTMLElement(getter_AddRefs(mBrowse), nodeInfo);
   if (!mBrowse)
     return NS_ERROR_OUT_OF_MEMORY;
 
   mBrowse->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                    NS_LITERAL_STRING("button"), PR_FALSE);
@@ -193,19 +190,18 @@ nsFileControlFrame::CreateAnonymousConte
     fileContent->GetTabIndex(&tabIndex);
     browseControl->SetTabIndex(tabIndex);
   }
 
   if (!aElements.AppendElement(mBrowse))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // register as an event listener of the button to open file dialog on mouse click
-  receiver = do_QueryInterface(mBrowse);
-  receiver->AddEventListenerByIID(mMouseListener,
-                                  NS_GET_IID(nsIDOMMouseListener));
+  mBrowse->AddEventListenerByIID(mMouseListener,
+                                 NS_GET_IID(nsIDOMMouseListener));
 
   SyncAttr(kNameSpaceID_None, nsGkAtoms::size,     SYNC_TEXT);
   SyncAttr(kNameSpaceID_None, nsGkAtoms::disabled, SYNC_BOTH);
 
   return NS_OK;
 }
 
 // Frames are not refcounted, no need to AddRef
--- a/layout/forms/nsIsIndexFrame.cpp
+++ b/layout/forms/nsIsIndexFrame.cpp
@@ -66,17 +66,17 @@
 #include "nsReadableUtils.h"
 #include "nsNetUtil.h"
 #include "nsICharsetConverterManager.h"
 #include "nsEscape.h"
 #include "nsIDOMKeyListener.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIFormControlFrame.h"
 #include "nsINodeInfo.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsContentCID.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
 
 nsIFrame*
 NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
@@ -93,18 +93,17 @@ nsIsIndexFrame::~nsIsIndexFrame()
 {
 }
 
 void
 nsIsIndexFrame::Destroy()
 {
   // remove ourself as a listener of the text control (bug 40533)
   if (mInputContent) {
-    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mInputContent));
-    receiver->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMKeyListener));
+    mInputContent->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMKeyListener));
     nsContentUtils::DestroyAnonymousContent(&mInputContent);
   }
   nsContentUtils::DestroyAnonymousContent(&mTextContent);
   nsContentUtils::DestroyAnonymousContent(&mPreHr);
   nsContentUtils::DestroyAnonymousContent(&mPostHr);
   nsAreaFrame::Destroy();
 }
 
@@ -220,18 +219,17 @@ nsIsIndexFrame::CreateAnonymousContent(n
 
   mInputContent->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
                          NS_LITERAL_STRING("text"), PR_FALSE);
 
   if (!aElements.AppendElement(mInputContent))
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Register as an event listener to submit on Enter press
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mInputContent));
-  receiver->AddEventListenerByIID(this, NS_GET_IID(nsIDOMKeyListener));
+  mInputContent->AddEventListenerByIID(this, NS_GET_IID(nsIDOMKeyListener));
 
   // Create an hr
   NS_NewHTMLElement(getter_AddRefs(mPostHr), hrInfo);
   if (!mPostHr || !aElements.AppendElement(mPostHr))
     return NS_ERROR_OUT_OF_MEMORY;
 
   return NS_OK;
 }
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -55,17 +55,17 @@
 #include "nsIDOMHTMLOptionElement.h" 
 #include "nsComboboxControlFrame.h"
 #include "nsIViewManager.h"
 #include "nsIScrollableView.h"
 #include "nsIDOMHTMLOptGroupElement.h"
 #include "nsWidgetsCID.h"
 #include "nsIPresShell.h"
 #include "nsHTMLParts.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsEventDispatcher.h"
 #include "nsIEventStateManager.h"
 #include "nsIEventListenerManager.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
@@ -189,32 +189,32 @@ nsListControlFrame::~nsListControlFrame(
   mComboboxFrame = nsnull;
 }
 
 // for Bug 47302 (remove this comment later)
 void
 nsListControlFrame::Destroy()
 {
   // get the receiver interface from the browser button's content node
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mContent));
+  ENSURE_TRUE(mContent);
 
   // Clear the frame pointer on our event listener, just in case the
   // event listener can outlive the frame.
 
   mEventListener->SetFrame(nsnull);
 
-  receiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,
+  mContent->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,
                                                     mEventListener),
                                      NS_GET_IID(nsIDOMMouseListener));
 
-  receiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,
+  mContent->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,
                                                     mEventListener),
                                      NS_GET_IID(nsIDOMMouseMotionListener));
 
-  receiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*,
+  mContent->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*,
                                                     mEventListener),
                                      NS_GET_IID(nsIDOMKeyListener));
 
   nsFormControlFrame::RegUnRegAccessKey(NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
   nsHTMLScrollFrame::Destroy();
 }
 
 NS_IMETHODIMP
@@ -1108,35 +1108,35 @@ nsListControlFrame::GetSizeAttribute(PRI
 NS_IMETHODIMP  
 nsListControlFrame::Init(nsIContent*     aContent,
                          nsIFrame*       aParent,
                          nsIFrame*       aPrevInFlow)
 {
   nsresult result = nsHTMLScrollFrame::Init(aContent, aParent, aPrevInFlow);
 
   // get the receiver interface from the browser button's content node
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mContent));
+  NS_ENSURE_STATE(mContent);
 
   // we shouldn't have to unregister this listener because when
   // our frame goes away all these content node go away as well
   // because our frame is the only one who references them.
   // we need to hook up our listeners before the editor is initialized
   mEventListener = new nsListEventListener(this);
   if (!mEventListener) 
     return NS_ERROR_OUT_OF_MEMORY;
 
-  receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,
+  mContent->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,
                                                  mEventListener),
                                   NS_GET_IID(nsIDOMMouseListener));
 
-  receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,
+  mContent->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,
                                                  mEventListener),
                                   NS_GET_IID(nsIDOMMouseMotionListener));
 
-  receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*,
+  mContent->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMKeyListener*,
                                                  mEventListener),
                                   NS_GET_IID(nsIDOMKeyListener));
 
   mStartSelectionIndex = kNothingSelected;
   mEndSelectionIndex = kNothingSelected;
 
   return result;
 }
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -79,17 +79,17 @@
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIPresShell.h"
 #include "nsIComponentManager.h"
 
 #include "nsBoxLayoutState.h"
 //for keylistener for "return" check
 #include "nsIPrivateDOMEvent.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDocument.h" //observe documents to send onchangenotifications
 #include "nsIStyleSheet.h"//observe documents to send onchangenotifications
 #include "nsIStyleRule.h"//observe documents to send onchangenotifications
 #include "nsIDOMEventListener.h"//observe documents to send onchangenotifications
 #include "nsGUIEvent.h"
 #include "nsIDOMEventGroup.h"
 #include "nsIDOM3EventTarget.h"
 #include "nsIDOMNSEvent.h"
@@ -1129,24 +1129,23 @@ nsTextControlFrame::PreDestroy()
     mFrameSel = nsnull;
   }
 
 //unregister self from content
   mTextListener->SetFrame(nsnull);
   nsFormControlFrame::RegUnRegAccessKey(NS_STATIC_CAST(nsIFrame*, this), PR_FALSE);
   if (mTextListener)
   {
-    nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(mContent);
-    if (erP)
+    if (mContent)
     {
-      erP->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener  *,mTextListener), NS_GET_IID(nsIDOMFocusListener));
+      mContent->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener  *,mTextListener), NS_GET_IID(nsIDOMFocusListener));
     }
 
     nsCOMPtr<nsIDOMEventGroup> systemGroup;
-    erP->GetSystemEventGroup(getter_AddRefs(systemGroup));
+    mContent->GetSystemEventGroup(getter_AddRefs(systemGroup));
     nsCOMPtr<nsIDOM3EventTarget> dom3Targ = do_QueryInterface(mContent);
     if (dom3Targ) {
       // cast because of ambiguous base
       nsIDOMEventListener *listener = NS_STATIC_CAST(nsIDOMKeyListener*,
                                                      mTextListener);
 
       dom3Targ->RemoveGroupedEventListener(NS_LITERAL_STRING("keydown"),
                                            listener, PR_FALSE, systemGroup);
@@ -2727,28 +2726,28 @@ nsTextControlFrame::SetInitialChildList(
   // nsGfxScrollFrameInner::CreateAnonymousContent handles this
   if (IsSingleLineTextControl()) 
   {
     if (scrollableFrame)
       scrollableFrame->SetScrollbarVisibility(PR_FALSE, PR_FALSE);
   }
 
   //register focus and key listeners
-  nsCOMPtr<nsIDOMEventReceiver> erP = do_QueryInterface(mContent);
-  if (erP) {
+  if (mContent) {
     // register the event listeners with the DOM event receiver
-    rv = erP->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *,mTextListener), NS_GET_IID(nsIDOMFocusListener));
+    rv = mContent->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMFocusListener *,mTextListener),
+                                         NS_GET_IID(nsIDOMFocusListener));
     NS_ASSERTION(NS_SUCCEEDED(rv), "failed to register focus listener");
     // XXXbryner do we need to check for a null presshell here?
     if (!PresContext()->GetPresShell())
       return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIDOMEventGroup> systemGroup;
-  erP->GetSystemEventGroup(getter_AddRefs(systemGroup));
+  mContent->GetSystemEventGroup(getter_AddRefs(systemGroup));
   nsCOMPtr<nsIDOM3EventTarget> dom3Targ = do_QueryInterface(mContent);
   if (dom3Targ) {
     // cast because of ambiguous base
     nsIDOMEventListener *listener = NS_STATIC_CAST(nsIDOMKeyListener*,
                                                    mTextListener);
 
     dom3Targ->AddGroupedEventListener(NS_LITERAL_STRING("keydown"),
                                       listener, PR_FALSE, systemGroup);
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -52,17 +52,17 @@
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMHTMLMapElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDocument.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIPresShell.h"
 #include "nsIFrame.h"
 #include "nsFrameManager.h"
 #include "nsCoord.h"
 #include "nsIImageMap.h"
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
 #include "nsIStringBundle.h"
@@ -748,20 +748,17 @@ nsImageMap::FreeAreas()
   PRInt32 i, n = mAreas.Count();
   for (i = 0; i < n; i++) {
     Area* area = (Area*) mAreas.ElementAt(i);
     frameManager->RemoveAsPrimaryFrame(area->mArea, mImageFrame);
 
     nsCOMPtr<nsIContent> areaContent;
     area->GetArea(getter_AddRefs(areaContent));
     if (areaContent) {
-      nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(areaContent));
-      if (rec) {
-        rec->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
-      }
+      areaContent->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
     }
     delete area;
   }
   mAreas.Clear();
 }
 
 nsresult
 nsImageMap::Init(nsIPresShell* aPresShell, nsIFrame* aImageFrame, nsIDOMHTMLMapElement* aMap)
@@ -873,20 +870,17 @@ nsImageMap::AddArea(nsIContent* aArea)
     default:
       // Unknown area type; bail
       return NS_OK;
   }
   if (!area)
     return NS_ERROR_OUT_OF_MEMORY;
 
   //Add focus listener to track area focus changes
-  nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(aArea));
-  if (rec) {
-    rec->AddEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
-  }
+  aArea->AddEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
 
   mPresShell->FrameManager()->SetPrimaryFrameFor(aArea, mImageFrame);
   aArea->SetMayHaveFrame(PR_TRUE);
   NS_ASSERTION(aArea->MayHaveFrame(), "SetMayHaveFrame failed?");
 
   area->ParseCoords(coords);
   mAreas.AppendElement(area);
   return NS_OK;
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -85,17 +85,17 @@
 #include "nsIDOMHTMLAppletElement.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMMouseMotionListener.h"
 #include "nsIDOMFocusListener.h"
 #include "nsIDOMContextMenuListener.h"
 #include "nsIDOMDragListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDocumentEncoder.h"
 #include "nsXPIDLString.h"
 #include "nsIDOMRange.h"
 #include "nsIPluginWidget.h"
 #include "nsGUIEvent.h"
 #include "nsIRenderingContext.h"
@@ -3098,42 +3098,42 @@ nsPluginInstanceOwner::Destroy()
   CancelTimer();
 
   // unregister context menu listener
   if (mCXMenuListener) {
     mCXMenuListener->Destroy(mContent);
     NS_RELEASE(mCXMenuListener);
   }
 
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mContent));
-  if (receiver) {
+  nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mContent));
+  if (target) {
 
     nsCOMPtr<nsIDOMEventListener> listener;
     QueryInterface(NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener));
 
     // Unregister focus event listener
-    receiver->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener));
+    mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener));
 
     // Unregister mouse event listener
-    receiver->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener));
+    mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener));
 
     // now for the mouse motion listener
-    receiver->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener));
+    mContent->RemoveEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener));
 
     // Unregister key event listener;
-    receiver->RemoveEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE);
-    receiver->RemoveEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE);
-    receiver->RemoveEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE);
 
     // Unregister drag event listener;
-    receiver->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE);
-    receiver->RemoveEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE);
-    receiver->RemoveEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE);
-    receiver->RemoveEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE);
-    receiver->RemoveEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE);
+    target->RemoveEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE);
   }
 
   // Unregister scroll position listener
   nsIFrame* parentWithView = mOwner->GetAncestorWithView();
   nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
   while (curView) {
     nsIScrollableView* scrollingView = curView->ToScrollableView();
     if (scrollingView)
@@ -3285,42 +3285,42 @@ nsresult nsPluginInstanceOwner::Init(nsP
 
   // register context menu listener
   mCXMenuListener = new nsPluginDOMContextMenuListener();
   if (mCXMenuListener) {    
     NS_ADDREF(mCXMenuListener);    
     mCXMenuListener->Init(aContent);
   }
 
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mContent));
-  if (receiver) {
+  nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mContent));
+  if (target) {
 
     nsCOMPtr<nsIDOMEventListener> listener;
     QueryInterface(NS_GET_IID(nsIDOMEventListener), getter_AddRefs(listener));
 
     // Register focus listener
-    receiver->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener));
+    mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMFocusListener));
 
     // Register mouse listener
-    receiver->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener));
+    mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseListener));
 
     // now do the mouse motion listener
-    receiver->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener));
+    mContent->AddEventListenerByIID(listener, NS_GET_IID(nsIDOMMouseMotionListener));
 
     // Register key listener
-    receiver->AddEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE);
-    receiver->AddEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE);
-    receiver->AddEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("keypress"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("keydown"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("keyup"), listener, PR_TRUE);
 
     // Register drag listener
-    receiver->AddEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE);
-    receiver->AddEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE);
-    receiver->AddEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE);
-    receiver->AddEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE);
-    receiver->AddEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("dragdrop"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("dragover"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("dragexit"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("dragenter"), listener, PR_TRUE);
+    target->AddEventListener(NS_LITERAL_STRING("draggesture"), listener, PR_TRUE);
   }
   
   // Register scroll position listener
   // We need to register a scroll pos listener on every scrollable
   // view up to the top
   nsIFrame* parentWithView = mOwner->GetAncestorWithView();
   nsIView* curView = parentWithView ? parentWithView->GetView() : nsnull;
   while (curView) {
--- a/layout/mathml/base/src/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmactionFrame.cpp
@@ -51,17 +51,17 @@
 
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIDOMElement.h"
 
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMMouseListener.h"
 
 #include "nsMathMLmactionFrame.h"
 #include "nsAutoPtr.h"
 #include "nsStyleSet.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
 
@@ -83,19 +83,18 @@ nsIFrame*
 NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsMathMLmactionFrame(aContext);
 }
 
 nsMathMLmactionFrame::~nsMathMLmactionFrame()
 {
   // unregister us as a mouse event listener ...
-//  printf("maction:%p unregistering as mouse event listener ...\n", this);
-  nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mContent));
-  receiver->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMMouseListener));
+  //  printf("maction:%p unregistering as mouse event listener ...\n", this);
+  mContent->RemoveEventListenerByIID(this, NS_GET_IID(nsIDOMMouseListener));
 }
 
 NS_IMETHODIMP
 nsMathMLmactionFrame::Init(nsIContent*      aContent,
                            nsIFrame*        aParent,
                            nsIFrame*        aPrevInFlow)
 {
   nsAutoString value, prefix;
@@ -234,18 +233,17 @@ nsMathMLmactionFrame::SetInitialChildLis
   // This very first call to GetSelectedFrame() will cause us to be marked as an
   // embellished operator if the selected child is an embellished operator
   if (!GetSelectedFrame()) {
     mActionType = NS_MATHML_ACTION_TYPE_NONE;
   }
   else {
     // register us as a mouse event listener ...
     // printf("maction:%p registering as mouse event listener ...\n", this);
-    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mContent));
-    receiver->AddEventListenerByIID(this, NS_GET_IID(nsIDOMMouseListener));
+    mContent->AddEventListenerByIID(this, NS_GET_IID(nsIDOMMouseListener));
   }
   return rv;
 }
 
 //  Only paint the selected child...
 NS_IMETHODIMP
 nsMathMLmactionFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                        const nsRect&           aDirtyRect,
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -94,17 +94,17 @@ static const char kPrintingPromptService
 
 // Printing Timer
 #include "nsPagePrintTimer.h"
 
 // FrameSet
 #include "nsIDocument.h"
 
 // Focus
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMFocusListener.h"
 #include "nsISelectionController.h"
 
 // Misc
 #include "nsISupportsUtils.h"
 #include "nsIFrame.h"
 #include "nsIScriptContext.h"
 #include "nsILinkHandler.h"
--- a/layout/xul/base/src/nsListBoxBodyFrame.cpp
+++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp
@@ -44,17 +44,17 @@
 #include "nsCOMPtr.h"
 #include "nsGridRowGroupLayout.h"
 #include "nsISupportsArray.h"
 #include "nsIServiceManager.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDocument.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNodeList.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsIScrollableFrame.h"
 #include "nsIScrollbarFrame.h"
 #include "nsIScrollableView.h"
 #include "nsIView.h"
--- a/layout/xul/base/src/nsMenuBarFrame.cpp
+++ b/layout/xul/base/src/nsMenuBarFrame.cpp
@@ -44,17 +44,17 @@
 #include "nsContentUtils.h"
 #include "prtypes.h"
 #include "nsIAtom.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
 #include "nsCSSRendering.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDocument.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsGkAtoms.h"
 #include "nsMenuFrame.h"
 #include "nsMenuPopupFrame.h"
 #include "nsGUIEvent.h"
 #include "nsUnicharUtils.h"
 #include "nsICaret.h"
 #include "nsIFocusController.h"
 #include "nsIDOMWindowInternal.h"
@@ -134,17 +134,17 @@ nsMenuBarFrame::Init(nsIContent*      aC
   // Create the menu bar listener.
   mMenuBarListener = new nsMenuBarListener(this);
   NS_IF_ADDREF(mMenuBarListener);
   if (! mMenuBarListener)
     return NS_ERROR_OUT_OF_MEMORY;
 
   // Hook up the menu bar as a key listener on the whole document.  It will see every
   // key press that occurs, but after everyone else does.
-  nsCOMPtr<nsIDOMEventReceiver> target = do_QueryInterface(aContent->GetDocument());
+  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aContent->GetDocument());
   
   mTarget = target;
 
   // Also hook up the listener to the window listening for focus events. This is so we can keep proper
   // state as the user alt-tabs through processes.
   
   target->AddEventListener(NS_LITERAL_STRING("keypress"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); 
   target->AddEventListener(NS_LITERAL_STRING("keydown"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE);  
--- a/layout/xul/base/src/nsMenuBarFrame.h
+++ b/layout/xul/base/src/nsMenuBarFrame.h
@@ -151,16 +151,16 @@ protected:
 
   PRBool mIsActive; // Whether or not the menu bar is active (a menu item is highlighted or shown).
   nsIMenuFrame* mCurrentMenu; // The current menu that is active.
 
   // Can contain a menu that was rolled up via nsIMenuDismissalListener::Rollup()
   // if nothing has happened since the last click. Otherwise, contains nsnull.
   nsIMenuFrame* mRecentRollupMenu; 
 
-  nsIDOMEventReceiver* mTarget;
+  nsIDOMEventTarget* mTarget;
 
 private:
   PRBool mCaretWasVisible;
 
 }; // class nsMenuBarFrame
 
 #endif
--- a/layout/xul/base/src/nsMenuBarListener.cpp
+++ b/layout/xul/base/src/nsMenuBarListener.cpp
@@ -36,17 +36,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsMenuBarListener.h"
 #include "nsMenuBarFrame.h"
 #include "nsIDOMKeyListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNSUIEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsGUIEvent.h"
 
 // Drag & Drop, Clipboard
 #include "nsIServiceManager.h"
 #include "nsWidgetsCID.h"
--- a/layout/xul/base/src/nsMenuBarListener.h
+++ b/layout/xul/base/src/nsMenuBarListener.h
@@ -37,17 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsMenuBarListener_h__
 #define nsMenuBarListener_h__
 
 #include "nsIDOMMouseMotionListener.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMKeyListener.h"
 #include "nsIDOMFocusListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 
 class nsMenuBarFrame;
 class nsPresContext;
 class nsIDOMKeyEvent;
 
 /** editor Implementation of the DragListener interface
  */
 class nsMenuBarListener : public nsIDOMKeyListener, public nsIDOMFocusListener, public nsIDOMMouseListener
--- a/layout/xul/base/src/nsMenuDismissalListener.h
+++ b/layout/xul/base/src/nsMenuDismissalListener.h
@@ -37,17 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsMenuDismissalListener_h__
 #define nsMenuDismissalListener_h__
 
 #include "nsIWidget.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIRollupListener.h"
 #include "nsIMenuRollup.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsCOMPtr.h"
 
 class nsIMenuParent;
 
 /**
  * The object responsible for rolling up the open menu popups in cases when
  * it's not done by menu code (for example, when clicking outside a popup
  * on Windows).
--- a/layout/xul/base/src/nsMenuListener.cpp
+++ b/layout/xul/base/src/nsMenuListener.cpp
@@ -36,17 +36,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsMenuListener.h"
 #include "nsMenuBarFrame.h"
 #include "nsIDOMKeyListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNSUIEvent.h"
 #include "nsGUIEvent.h"
 
 // Drag & Drop, Clipboard
 #include "nsIServiceManager.h"
 #include "nsWidgetsCID.h"
 #include "nsCOMPtr.h"
--- a/layout/xul/base/src/nsMenuListener.h
+++ b/layout/xul/base/src/nsMenuListener.h
@@ -36,17 +36,17 @@
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsMenuListener_h__
 #define nsMenuListener_h__
 
 #include "nsIDOMMouseMotionListener.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMKeyListener.h"
 #include "nsIDOMFocusListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 
 class nsIMenuParent;
 class nsPresContext;
 
 /** editor Implementation of the DragListener interface
  */
 class nsMenuListener : public nsIDOMKeyListener, public nsIDOMFocusListener, public nsIDOMMouseListener
 {
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -1781,17 +1781,17 @@ nsMenuPopupFrame::AttachedDismissalListe
 }
 
 NS_IMETHODIMP
 nsMenuPopupFrame::InstallKeyboardNavigator()
 {
   if (mKeyboardNavigator)
     return NS_OK;
 
-  nsCOMPtr<nsIDOMEventReceiver> target = do_QueryInterface(mContent->GetDocument());
+  nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mContent->GetDocument());
   
   mTarget = target;
   mKeyboardNavigator = new nsMenuListener(this);
   NS_IF_ADDREF(mKeyboardNavigator);
 
   target->AddEventListener(NS_LITERAL_STRING("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); 
   target->AddEventListener(NS_LITERAL_STRING("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);  
   target->AddEventListener(NS_LITERAL_STRING("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE);   
--- a/layout/xul/base/src/nsMenuPopupFrame.h
+++ b/layout/xul/base/src/nsMenuPopupFrame.h
@@ -43,17 +43,17 @@
 //
 
 #ifndef nsMenuPopupFrame_h__
 #define nsMenuPopupFrame_h__
 
 #include "prtypes.h"
 #include "nsIAtom.h"
 #include "nsCOMPtr.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsMenuListener.h"
 
 #include "nsBoxFrame.h"
 #include "nsIMenuParent.h"
 #include "nsIWidget.h"
 
 #include "nsITimer.h"
 
@@ -237,17 +237,17 @@ protected:
 
   // Move the popup to the position specified in its |left| and |top| attributes.
   void MoveToAttributePosition();
 
 
   nsIMenuFrame* mCurrentMenu; // The current menu that is active.
 
   nsMenuListener* mKeyboardNavigator; // The listener that tells us about key events.
-  nsIDOMEventReceiver* mTarget;
+  nsIDOMEventTarget* mTarget;
 
   nsIMenuFrame* mTimerMenu; // A menu awaiting closure.
   nsCOMPtr<nsITimer> mCloseTimer; // Close timer.
 
   // Reference to the mediator which wraps this frame.
   nsRefPtr<nsMenuPopupTimerMediator> mTimerMediator;
 
   PRPackedBool mIsContextMenu;  // is this a context menu?
--- a/layout/xul/base/src/nsSliderFrame.cpp
+++ b/layout/xul/base/src/nsSliderFrame.cpp
@@ -49,17 +49,17 @@
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
 #include "nsUnitConversion.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsCSSRendering.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIViewManager.h"
 #include "nsIWidget.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDocument.h"
 #include "nsScrollbarButtonFrame.h"
 #include "nsIScrollbarListener.h"
 #include "nsIScrollbarMediator.h"
 #include "nsIScrollbarFrame.h"
@@ -958,36 +958,32 @@ nsSliderFrame::AddListener()
 {
   if (!mMediator) {
     mMediator = new nsSliderMediator(this);
     NS_ADDREF(mMediator);
   }
 
   nsIFrame* thumbFrame = mFrames.FirstChild();
   if (thumbFrame) {
-    nsCOMPtr<nsIDOMEventReceiver>
-      receiver(do_QueryInterface(thumbFrame->GetContent()));
-
-    receiver->AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
+    thumbFrame->GetContent()->
+      AddEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
   }
 }
 
 void
 nsSliderFrame::RemoveListener()
 {
   NS_ASSERTION(mMediator, "No listener was ever added!!");
 
   nsIFrame* thumbFrame = mFrames.FirstChild();
   if (!thumbFrame)
     return;
 
-  nsCOMPtr<nsIDOMEventReceiver>
-    receiver(do_QueryInterface(thumbFrame->GetContent()));
-
-  receiver->RemoveEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
+  thumbFrame->GetContent()->
+    RemoveEventListenerByIID(mMediator, NS_GET_IID(nsIDOMMouseListener));
 }
 
 NS_IMETHODIMP
 nsSliderFrame::HandlePress(nsPresContext* aPresContext,
                            nsGUIEvent*     aEvent,
                            nsEventStatus*  aEventStatus)
 {
   if (((nsMouseEvent *)aEvent)->isShift)
--- a/layout/xul/base/src/nsSplitterFrame.cpp
+++ b/layout/xul/base/src/nsSplitterFrame.cpp
@@ -50,17 +50,17 @@
 #include "nsIDOMXULElement.h"
 #include "nsIDOMDocument.h"
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 #include "nsINameSpaceManager.h"
 #include "nsScrollbarButtonFrame.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMMouseMotionListener.h"
-#include "nsIDOMEventReceiver.h"
+#include "nsIDOMEventTarget.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
 #include "nsIScrollableView.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIPresShell.h"
 #include "nsFrameNavigator.h"
 #include "nsHTMLParts.h"
 #include "nsILookAndFeel.h"
@@ -613,31 +613,33 @@ nsSplitterFrameInner::MouseDrag(nsPresCo
     */
     mDidDrag = PR_TRUE;
   }
 }
 
 void
 nsSplitterFrameInner::AddListener(nsPresContext* aPresContext)
 {
-  nsCOMPtr<nsIDOMEventReceiver>
-    receiver(do_QueryInterface(mOuter->GetContent()));
-
-  receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this), NS_GET_IID(nsIDOMMouseListener));
-  receiver->AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this), NS_GET_IID(nsIDOMMouseMotionListener));
+  mOuter->GetContent()->
+    AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this),
+                          NS_GET_IID(nsIDOMMouseListener));
+  mOuter->GetContent()->
+    AddEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this),
+                          NS_GET_IID(nsIDOMMouseMotionListener));
 }
 
 void
 nsSplitterFrameInner::RemoveListener()
 {
-  nsCOMPtr<nsIDOMEventReceiver>
-    receiver(do_QueryInterface(mOuter->GetContent()));
-
-  receiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this),NS_GET_IID(nsIDOMMouseListener));
-  receiver->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this),NS_GET_IID(nsIDOMMouseMotionListener));
+  mOuter->GetContent()->
+    RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseListener*,this),
+                             NS_GET_IID(nsIDOMMouseListener));
+  mOuter->GetContent()->
+    RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this),
+                             NS_GET_IID(nsIDOMMouseMotionListener));
 }
 
 /*
 nsresult
 nsSplitterFrameInner :: CaptureMouse(nsPresContext* aPresContext, PRBool aGrabMouseEvents)
 {
   // get its view
   nsIView* view = mOuter->GetView();
--- a/xpfe/appshell/src/nsWebShellWindow.cpp
+++ b/xpfe/appshell/src/nsWebShellWindow.cpp
@@ -51,17 +51,16 @@
 #include "nsNetCID.h"
 #include "nsIStringBundle.h"
 #include "nsIPref.h"
 #include "nsReadableUtils.h"
 
 #include "nsEscape.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMEventTarget.h"
-#include "nsIDOMEventReceiver.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIEventListenerManager.h"
 #include "nsIDOMFocusListener.h"
 #include "nsIWebNavigation.h"
 #include "nsIWindowWatcher.h"
 
 #include "nsIDOMXULElement.h"