aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyBrowser.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-08-02 05:59:08 +0800
committerChristian Persch <chpe@src.gnome.org>2004-08-02 05:59:08 +0800
commitc66c64145b28c44bd19cb6fa9b7781ddf6c57ff8 (patch)
tree65d9e7d5b6387bdd380a50eb24bb5072c1c63ac8 /embed/mozilla/EphyBrowser.cpp
parentd07304f7633e3b3456686b22d3c55b898b2758c9 (diff)
downloadgsoc2013-epiphany-c66c64145b28c44bd19cb6fa9b7781ddf6c57ff8.tar
gsoc2013-epiphany-c66c64145b28c44bd19cb6fa9b7781ddf6c57ff8.tar.gz
gsoc2013-epiphany-c66c64145b28c44bd19cb6fa9b7781ddf6c57ff8.tar.bz2
gsoc2013-epiphany-c66c64145b28c44bd19cb6fa9b7781ddf6c57ff8.tar.lz
gsoc2013-epiphany-c66c64145b28c44bd19cb6fa9b7781ddf6c57ff8.tar.xz
gsoc2013-epiphany-c66c64145b28c44bd19cb6fa9b7781ddf6c57ff8.tar.zst
gsoc2013-epiphany-c66c64145b28c44bd19cb6fa9b7781ddf6c57ff8.zip
Don't QI the event target to nsIDOMEventReceiver and back to
2004-08-01 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: Don't QI the event target to nsIDOMEventReceiver and back to nsIDOMEventTarget when using it, just store it as-is. Thanks to Crispin for noticing this.
Diffstat (limited to 'embed/mozilla/EphyBrowser.cpp')
-rw-r--r--embed/mozilla/EphyBrowser.cpp48
1 files changed, 17 insertions, 31 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index ecdd3c5f8..690a5e24c 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -70,6 +70,7 @@
#include "nsIChannel.h"
#ifdef ALLOW_PRIVATE_API
+#include "nsIDocShell.h"
#include "nsIMarkupDocumentViewer.h"
#ifdef HAVE_MOZILLA_PSM
/* not sure about this one: */
@@ -261,7 +262,7 @@ nsresult EphyBrowser::Init (GtkMozEmbed *mozembed)
nsresult
EphyBrowser::GetListener (void)
{
- if (mEventReceiver) return NS_ERROR_FAILURE;
+ if (mEventTarget) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMWindow> domWindowExternal;
mWebBrowser->GetContentDOMWindow (getter_AddRefs(domWindowExternal));
@@ -269,11 +270,8 @@ EphyBrowser::GetListener (void)
nsCOMPtr<nsIDOMWindow2> domWindow (do_QueryInterface (domWindowExternal));
NS_ENSURE_TRUE (domWindow, NS_ERROR_FAILURE);
- nsCOMPtr<nsIDOMEventTarget> rootWindow;
- domWindow->GetWindowRoot (getter_AddRefs(rootWindow));
-
- mEventReceiver = do_QueryInterface (rootWindow);
- NS_ENSURE_TRUE (mEventReceiver, NS_ERROR_FAILURE);
+ domWindow->GetWindowRoot (getter_AddRefs(mEventTarget));
+ NS_ENSURE_TRUE (mEventTarget, NS_ERROR_FAILURE);
return NS_OK;
}
@@ -281,19 +279,13 @@ EphyBrowser::GetListener (void)
nsresult
EphyBrowser::AttachListeners(void)
{
- nsresult rv;
-
- NS_ENSURE_TRUE (mEventReceiver, NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIDOMEventTarget> target;
- target = do_QueryInterface (mEventReceiver);
-
- rv = target->AddEventListener(nsEmbedString(DOMLinkAdded),
- mFaviconEventListener, PR_FALSE);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+ NS_ENSURE_TRUE (mEventTarget, NS_ERROR_FAILURE);
- rv = target->AddEventListener(nsEmbedString(DOMPopupBlocked),
- mPopupBlockEventListener, PR_FALSE);
+ nsresult rv;
+ rv = mEventTarget->AddEventListener(nsEmbedString(DOMLinkAdded),
+ mFaviconEventListener, PR_FALSE);
+ rv |= mEventTarget->AddEventListener(nsEmbedString(DOMPopupBlocked),
+ mPopupBlockEventListener, PR_FALSE);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
return NS_OK;
@@ -302,21 +294,15 @@ EphyBrowser::AttachListeners(void)
nsresult
EphyBrowser::DetachListeners(void)
{
- nsresult rv;
-
- if (!mEventReceiver) return NS_OK;
+ if (!mEventTarget) return NS_OK;
- nsCOMPtr<nsIDOMEventTarget> target;
- target = do_QueryInterface (mEventReceiver);
- NS_ENSURE_TRUE (target, NS_ERROR_FAILURE);
-
- rv = target->RemoveEventListener(nsEmbedString(DOMLinkAdded),
- mFaviconEventListener, PR_FALSE);
+ nsresult rv;
+ rv = mEventTarget->RemoveEventListener(nsEmbedString(DOMLinkAdded),
+ mFaviconEventListener, PR_FALSE);
+ rv |= mEventTarget->RemoveEventListener(nsEmbedString(DOMPopupBlocked),
+ mPopupBlockEventListener, PR_FALSE);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
- rv = target->RemoveEventListener(nsEmbedString(DOMPopupBlocked),
- mPopupBlockEventListener, PR_FALSE);
-
return NS_OK;
}
@@ -413,7 +399,7 @@ nsresult EphyBrowser::Destroy ()
mWebBrowser = nsnull;
mDOMWindow = nsnull;
- mEventReceiver = nsnull;
+ mEventTarget = nsnull;
mInitialized = PR_FALSE;