aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--TODO1
-rw-r--r--embed/mozilla/EphyWrapper.cpp39
-rw-r--r--embed/mozilla/EphyWrapper.h7
-rw-r--r--embed/mozilla/mozilla-embed.cpp17
-rw-r--r--src/ephy-tab.c32
6 files changed, 48 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index d918fa0cb..462d4e15f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2003-01-05 Marco Pesenti Gritti <marco@it.gnome.org>
* data/art/Makefile.am:
diff --git a/TODO b/TODO
index 1512f277d..111c759c7 100644
--- a/TODO
+++ b/TODO
@@ -3,6 +3,7 @@ To do:
- implement phoenix like popup blocking / make popups less annoying
- loading feedback on tabs
- create print preview toolbar only when necessary
+- embed dialogs crashes when the window has been closed
Done:
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)
diff --git a/embed/mozilla/EphyWrapper.h b/embed/mozilla/EphyWrapper.h
index 0345ede30..8f6a3672a 100644
--- a/embed/mozilla/EphyWrapper.h
+++ b/embed/mozilla/EphyWrapper.h
@@ -112,11 +112,10 @@ private:
nsCOMPtr<nsIWebProgressListener> mProgress;
nsCOMPtr<nsIDOMEventReceiver> mEventReceiver;
EphyEventListener *mEventListener;
- PRBool mListenersAttached;
- void GetListener (void);
- void AttachListeners (void);
- void DetachListeners (void);
+ nsresult GetListener (void);
+ nsresult AttachListeners (void);
+ nsresult DetachListeners (void);
nsresult SetZoomOnDocshell (float aZoom, nsIDocShell *DocShell);
nsresult GetDocShell (nsIDocShell **aDocShell);
nsresult GetCSSBackground (nsIDOMNode *node, nsAutoString& url);
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 8c39dd460..05408973f 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -382,6 +382,7 @@ static void
mozilla_embed_destroy (GtkObject *object)
{
int i;
+ MozillaEmbed *embed = MOZILLA_EMBED (object);
for (i = 0; signal_connections[i].event != NULL; i++)
{
@@ -390,6 +391,13 @@ mozilla_embed_destroy (GtkObject *object)
(gpointer)signal_connections[i].func,
(void *)object);
}
+
+ if (embed->priv->wrapper)
+ {
+ embed->priv->wrapper->Destroy();
+ delete embed->priv->wrapper;
+ embed->priv->wrapper = NULL;
+ }
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@ -406,14 +414,7 @@ mozilla_embed_finalize (GObject *object)
g_return_if_fail (embed->priv != NULL);
- if (embed->priv->wrapper)
- {
- embed->priv->wrapper->Destroy();
- delete embed->priv->wrapper;
- embed->priv->wrapper = NULL;
- }
-
- delete embed->priv;
+ g_free (embed->priv);
G_OBJECT_CLASS (parent_class)->finalize (object);
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 5ad7090eb..2c50af794 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -52,6 +52,7 @@ struct EphyTabPrivate
gboolean is_active;
TabLoadStatus load_status;
char status_message[255];
+ char link_message[255];
char *title;
char *location;
int load_percent;
@@ -80,10 +81,6 @@ ephy_tab_link_message_cb (EphyEmbed *embed,
const char *message,
EphyTab *tab);
static void
-ephy_tab_js_status_cb (EphyEmbed *embed,
- const char *status,
- EphyTab *tab);
-static void
ephy_tab_location_cb (EphyEmbed *embed, EphyTab *tab);
static void
ephy_tab_title_cb (EphyEmbed *embed, EphyTab *tab);
@@ -201,6 +198,7 @@ ephy_tab_init (EphyTab *tab)
tab->priv->window = NULL;
tab->priv->is_active = FALSE;
*tab->priv->status_message = '\0';
+ *tab->priv->link_message = '\0';
tab->priv->load_status = TAB_LOAD_NONE;
tab->priv->load_percent = 0;
tab->priv->title = NULL;
@@ -226,9 +224,6 @@ ephy_tab_init (EphyTab *tab)
g_signal_connect (embed, "ge_link_message",
GTK_SIGNAL_FUNC (ephy_tab_link_message_cb),
tab);
- g_signal_connect (embed, "ge_js_status",
- GTK_SIGNAL_FUNC (ephy_tab_js_status_cb),
- tab);
g_signal_connect (embed, "ge_location",
GTK_SIGNAL_FUNC (ephy_tab_location_cb),
tab);
@@ -435,25 +430,10 @@ ephy_tab_link_message_cb (EphyEmbed *embed,
{
if (!tab->priv->is_active) return;
- g_strlcpy (tab->priv->status_message,
+ g_strlcpy (tab->priv->link_message,
message, 255);
ephy_window_update_control (tab->priv->window,
- StatusbarMessageControl);
-}
-
-static void
-ephy_tab_js_status_cb (EphyEmbed *embed,
- const char *status,
- EphyTab *tab)
-{
- if (!tab->priv->is_active)
- return;
-
- g_strlcpy (tab->priv->status_message,
- status, 255);
-
- ephy_window_update_control (tab->priv->window,
StatusbarMessageControl);
}
@@ -895,13 +875,13 @@ ephy_tab_get_load_percent (EphyTab *tab)
const char *
ephy_tab_get_status_message (EphyTab *tab)
{
- if (tab->priv->status_message)
+ if (*tab->priv->link_message)
{
- return tab->priv->status_message;
+ return tab->priv->link_message;
}
else
{
- return " ";
+ return tab->priv->status_message;
}
}