aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/EphyBrowser.cpp
diff options
context:
space:
mode:
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;