diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-09-01 20:49:06 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-09-01 20:49:06 +0800 |
commit | bb3c17d7b27ab50b41393e466bb87f569ac8b160 (patch) | |
tree | 9ca91b17cf7f9265213ce4512fe8e580ca4e0e42 | |
parent | d2a606d5c6bba56fe66a3bb04dd164442425d740 (diff) | |
download | gsoc2013-epiphany-bb3c17d7b27ab50b41393e466bb87f569ac8b160.tar gsoc2013-epiphany-bb3c17d7b27ab50b41393e466bb87f569ac8b160.tar.gz gsoc2013-epiphany-bb3c17d7b27ab50b41393e466bb87f569ac8b160.tar.bz2 gsoc2013-epiphany-bb3c17d7b27ab50b41393e466bb87f569ac8b160.tar.lz gsoc2013-epiphany-bb3c17d7b27ab50b41393e466bb87f569ac8b160.tar.xz gsoc2013-epiphany-bb3c17d7b27ab50b41393e466bb87f569ac8b160.tar.zst gsoc2013-epiphany-bb3c17d7b27ab50b41393e466bb87f569ac8b160.zip |
Only listen for trusted events.
2005-09-01 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
* embed/mozilla/EphyBrowser.cpp:
Only listen for trusted events.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 67 |
3 files changed, 28 insertions, 52 deletions
@@ -1,3 +1,10 @@ +2005-09-01 Christian Persch <chpe@cvs.gnome.org> + + * configure.ac: + * embed/mozilla/EphyBrowser.cpp: + + Only listen for trusted events. + 2005-08-31 Christian Persch <chpe@cvs.gnome.org> * configure.ac: diff --git a/configure.ac b/configure.ac index 3813ed74f..d9b4e6eb8 100644 --- a/configure.ac +++ b/configure.ac @@ -208,10 +208,10 @@ fi AC_MSG_RESULT([$gecko]) case "$gecko" in -mozilla) min_version=1.7.5 flavour=mozilla ;; +mozilla) min_version=1.7.9 flavour=mozilla ;; seamonkey) min_version=1.0 flavour=mozilla ;; -*firefox) min_version=1.0 flavour=toolkit ;; -*thunderbird) min_version=1.0 flavour=toolkit ;; +*firefox) min_version=1.0.5 flavour=toolkit ;; +*thunderbird) min_version=1.0.5 flavour=toolkit ;; esac MOZILLA=$gecko diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index e7e04f2f7..3812b87d1 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -65,6 +65,7 @@ #include "nsIDOMMouseEvent.h" #include "nsIDOMNSEvent.h" #include "nsIDOMEventTarget.h" +#include "nsIDOMNSEventTarget.h" #include "nsIDOMPopupBlockedEvent.h" #include "nsIDOMNode.h" #include "nsIDOMElement.h" @@ -117,13 +118,6 @@ NS_IMPL_ISUPPORTS1(EphyEventListener, nsIDOMEventListener) NS_IMETHODIMP EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) { - /* make sure the event is trusted */ - nsCOMPtr<nsIDOMNSEvent> nsEvent (do_QueryInterface (aDOMEvent)); - NS_ENSURE_TRUE (nsEvent, NS_ERROR_FAILURE); - PRBool isTrusted = PR_FALSE; - nsEvent->GetIsTrusted (&isTrusted); - if (!isTrusted) return NS_OK; - nsCOMPtr<nsIDOMEventTarget> eventTarget; aDOMEvent->GetTarget(getter_AddRefs(eventTarget)); @@ -283,13 +277,6 @@ EphyDOMContentLoadedEventListener::HandleEvent (nsIDOMEvent* aDOMEvent) { LOG ("DOMContentLoaded event fired up"); - /* make sure the event is trusted */ - nsCOMPtr<nsIDOMNSEvent> nsEvent (do_QueryInterface (aDOMEvent)); - NS_ENSURE_TRUE (nsEvent, NS_ERROR_FAILURE); - PRBool isTrusted = PR_FALSE; - nsEvent->GetIsTrusted (&isTrusted); - if (!isTrusted) return NS_OK; - g_signal_emit_by_name (mOwner->mEmbed, "dom_content_loaded", (gpointer)aDOMEvent); return NS_OK; @@ -320,13 +307,6 @@ EphyDOMLinkEventListener::GetDocURI (nsIDOMElement *aElement, NS_IMETHODIMP EphyPopupBlockEventListener::HandleEvent (nsIDOMEvent * aDOMEvent) { - /* make sure the event is trusted */ - nsCOMPtr<nsIDOMNSEvent> nsEvent (do_QueryInterface (aDOMEvent)); - NS_ENSURE_TRUE (nsEvent, NS_ERROR_FAILURE); - PRBool isTrusted = PR_FALSE; - nsEvent->GetIsTrusted (&isTrusted); - if (!isTrusted) return NS_OK; - nsCOMPtr<nsIDOMPopupBlockedEvent> popupEvent = do_QueryInterface (aDOMEvent); NS_ENSURE_TRUE (popupEvent, NS_ERROR_FAILURE); @@ -361,13 +341,6 @@ EphyModalAlertEventListener::HandleEvent (nsIDOMEvent * aDOMEvent) { NS_ENSURE_TRUE (mOwner, NS_ERROR_FAILURE); - /* make sure the event is trusted */ - nsCOMPtr<nsIDOMNSEvent> nsEvent (do_QueryInterface (aDOMEvent)); - NS_ENSURE_TRUE (nsEvent, NS_ERROR_FAILURE); - PRBool isTrusted = PR_FALSE; - nsEvent->GetIsTrusted (&isTrusted); - if (!isTrusted) return NS_OK; - nsresult rv; nsEmbedString type; rv = aDOMEvent->GetType (type); @@ -401,14 +374,7 @@ EphyModalAlertEventListener::HandleEvent (nsIDOMEvent * aDOMEvent) NS_IMETHODIMP EphyDOMScrollEventListener::HandleEvent (nsIDOMEvent * aEvent) { - /* make sure the event is trusted */ nsresult rv; - nsCOMPtr<nsIDOMNSEvent> nsEvent (do_QueryInterface (aEvent, &rv)); - NS_ENSURE_SUCCESS (rv, rv); - PRBool isTrusted = PR_FALSE; - nsEvent->GetIsTrusted (&isTrusted); - if (!isTrusted) return NS_OK; - nsCOMPtr<nsIDOMMouseEvent> mouseEvent (do_QueryInterface (aEvent, &rv)); NS_ENSURE_SUCCESS (rv, rv); @@ -658,20 +624,23 @@ EphyBrowser::AttachListeners(void) NS_ENSURE_TRUE (mEventTarget, NS_ERROR_FAILURE); nsresult rv; - rv = mEventTarget->AddEventListener(nsEmbedString(kDOMLinkAdded), - mDOMLinkEventListener, PR_FALSE); - rv |= mEventTarget->AddEventListener(nsEmbedString(kDOMContentLoaded), - mDOMContentLoadedEventListener, PR_FALSE); - rv |= mEventTarget->AddEventListener(nsEmbedString(kDOMMouseScroll), - mDOMScrollEventListener, PR_TRUE); /* capture */ - rv |= mEventTarget->AddEventListener(nsEmbedString(kDOMPopupBlocked), - mPopupBlockEventListener, PR_FALSE); - rv |= mEventTarget->AddEventListener(nsEmbedString(kDOMWillOpenModalDialog), - mModalAlertListener, PR_TRUE); - rv |= mEventTarget->AddEventListener(nsEmbedString(kDOMModalDialogClosed), - mModalAlertListener, PR_TRUE); - rv |= mEventTarget->AddEventListener(nsEmbedString(kContextMenu), - mContextMenuListener, PR_TRUE /* capture */); + nsCOMPtr<nsIDOMNSEventTarget> target (do_QueryInterface (mEventTarget, &rv)); + NS_ENSURE_SUCCESS (rv, rv); + + rv = target->AddEventListener(nsEmbedString(kDOMLinkAdded), + mDOMLinkEventListener, PR_FALSE, PR_FALSE); + rv |= target->AddEventListener(nsEmbedString(kDOMContentLoaded), + mDOMContentLoadedEventListener, PR_FALSE, PR_FALSE); + rv |= target->AddEventListener(nsEmbedString(kDOMMouseScroll), + mDOMScrollEventListener, PR_TRUE /* capture */, PR_FALSE); + rv |= target->AddEventListener(nsEmbedString(kDOMPopupBlocked), + mPopupBlockEventListener, PR_FALSE, PR_FALSE); + rv |= target->AddEventListener(nsEmbedString(kDOMWillOpenModalDialog), + mModalAlertListener, PR_TRUE, PR_FALSE); + rv |= target->AddEventListener(nsEmbedString(kDOMModalDialogClosed), + mModalAlertListener, PR_TRUE, PR_FALSE); + rv |= target->AddEventListener(nsEmbedString(kContextMenu), + mContextMenuListener, PR_TRUE /* capture */, PR_FALSE); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); return NS_OK; |