diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-06 18:38:03 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-06 18:38:03 +0800 |
commit | b64094100a910ba2068d3cb64c1595dc02d795d2 (patch) | |
tree | 572ee8c5c91e353281000b844f637bd8a36f52c3 /embed/mozilla/EphyWrapper.cpp | |
parent | ae767a6174e353acb3b1a850fdefdffebeec9817 (diff) | |
download | gsoc2013-epiphany-b64094100a910ba2068d3cb64c1595dc02d795d2.tar gsoc2013-epiphany-b64094100a910ba2068d3cb64c1595dc02d795d2.tar.gz gsoc2013-epiphany-b64094100a910ba2068d3cb64c1595dc02d795d2.tar.bz2 gsoc2013-epiphany-b64094100a910ba2068d3cb64c1595dc02d795d2.tar.lz gsoc2013-epiphany-b64094100a910ba2068d3cb64c1595dc02d795d2.tar.xz gsoc2013-epiphany-b64094100a910ba2068d3cb64c1595dc02d795d2.tar.zst gsoc2013-epiphany-b64094100a910ba2068d3cb64c1595dc02d795d2.zip |
Make sure event listener is ever attached. Never allow to override
2003-01-06 Marco Pesenti Gritti <marco@it.gnome.org>
* TODO:
* embed/mozilla/EphyWrapper.cpp:
* embed/mozilla/EphyWrapper.h:
* embed/mozilla/mozilla-embed.cpp:
* src/ephy-tab.c: (ephy_tab_init), (ephy_tab_link_message_cb),
(ephy_tab_get_status_message):
Make sure event listener is ever attached.
Never allow to override statusbar messages.
Diffstat (limited to 'embed/mozilla/EphyWrapper.cpp')
-rw-r--r-- | embed/mozilla/EphyWrapper.cpp | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp index 716b5e75c..8473d1a6f 100644 --- a/embed/mozilla/EphyWrapper.cpp +++ b/embed/mozilla/EphyWrapper.cpp @@ -27,7 +27,6 @@ #include <unistd.h> #include "nsIContentViewer.h" -#include "nsIPermissionManager.h" #include "nsIGlobalHistory.h" #include "nsIDocShellHistory.h" #include "nsIWebBrowserFind.h" @@ -41,14 +40,10 @@ #include "nsIPresShell.h" #include "nsIMarkupDocumentViewer.h" #include "nsIComponentManager.h" -#include "nsIDOMElement.h" -#include "nsIDOMNodeList.h" #include "nsIScriptGlobalObject.h" #include "nsIScriptContext.h" #include "nsIDOMWindowInternal.h" -#include "nsICharsetConverterManager.h" -#include "nsICharsetConverterManager2.h" #include "nsIInterfaceRequestor.h" #include "nsIFocusController.h" #include "nsIWebBrowserPersist.h" @@ -73,9 +68,6 @@ #include "nsIDOMHTMLDocument.h" #include "nsIDOMHTMLCollection.h" #include "nsIDOMHTMLElement.h" -#include "nsIDOMHTMLImageElement.h" -#include "nsIDOMHTMLFormElement.h" -#include "nsIDOMHTMLAnchorElement.h" #include "caps/nsIPrincipal.h" #include "nsIDeviceContext.h" #include "nsIPresContext.h" @@ -86,6 +78,8 @@ EphyWrapper::EphyWrapper () { + mEventListener = nsnull; + mEventReceiver = nsnull; } EphyWrapper::~EphyWrapper () @@ -130,10 +124,10 @@ nsresult EphyWrapper::Init (GtkMozEmbed *mozembed) return dsHistory->SetGlobalHistory(inst); } -void +nsresult EphyWrapper::GetListener (void) { - if (mEventReceiver) return; + if (mEventReceiver) return NS_ERROR_FAILURE; nsCOMPtr<nsIDOMWindow> domWindowExternal; mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindowExternal)); @@ -142,38 +136,39 @@ EphyWrapper::GetListener (void) domWindow = do_QueryInterface(domWindowExternal); nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(domWindow)); - if (!piWin) return; + if (!piWin) return NS_ERROR_FAILURE; nsCOMPtr<nsIChromeEventHandler> chromeHandler; piWin->GetChromeEventHandler(getter_AddRefs(chromeHandler)); mEventReceiver = do_QueryInterface(chromeHandler); + if (!mEventReceiver) return NS_ERROR_FAILURE; + + return NS_OK; } -void +nsresult EphyWrapper::AttachListeners(void) { - if (!mEventReceiver || mListenersAttached) - return; + if (!mEventReceiver) return NS_ERROR_FAILURE; nsCOMPtr<nsIDOMEventTarget> target; target = do_QueryInterface (mEventReceiver); - target->AddEventListener(NS_LITERAL_STRING("DOMLinkAdded"), mEventListener, PR_FALSE); - - mListenersAttached = PR_TRUE; + return target->AddEventListener(NS_LITERAL_STRING("DOMLinkAdded"), + mEventListener, PR_FALSE); } -void +nsresult EphyWrapper::DetachListeners(void) { - if (!mListenersAttached || !mEventReceiver) - return; - + if (!mEventReceiver) return NS_ERROR_FAILURE; + nsCOMPtr<nsIDOMEventTarget> target; target = do_QueryInterface (mEventReceiver); - target->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), mEventListener, PR_FALSE); + return target->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), + mEventListener, PR_FALSE); } nsresult EphyWrapper::GetDocShell (nsIDocShell **aDocShell) |