diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 38 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.h | 6 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 23 |
4 files changed, 75 insertions, 1 deletions
@@ -1,3 +1,12 @@ +2004-06-15 Christian Persch <chpe@cvs.gnome.org> + + * embed/mozilla/EphyBrowser.cpp: + * embed/mozilla/EphyBrowser.h: + * embed/mozilla/mozilla-embed.cpp: + + Work around mozilla bug #246392 which goes back to the original urls + when reloading a frameset. Fixes bug #115800. + 2004-06-14 Christian Persch <chpe@cvs.gnome.org> * src/bookmarks/ephy-new-bookmark.c: (duplicate_dialog_construct): diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 2ca36a9bb..eb86d5fd4 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -371,6 +371,44 @@ nsresult EphyBrowser::GoToHistoryIndex (PRInt16 index) return ContentNav->GotoIndex (index); } +/* Workaround for broken reload with frames, see mozilla bug + * http://bugzilla.mozilla.org/show_bug.cgi?id=246392 + */ +nsresult EphyBrowser::Reload (PRUint32 flags) +{ + NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); + + nsCOMPtr<nsISHistory> sessionHistory; + GetSHistory (getter_AddRefs (sessionHistory)); + + nsCOMPtr<nsIWebNavigation> webNavigation; + webNavigation = do_QueryInterface (sessionHistory); + + if (!webNavigation) + { + webNavigation = do_QueryInterface (mWebBrowser); + } + NS_ENSURE_TRUE (webNavigation, NS_ERROR_FAILURE); + + PRUint32 reloadFlags; + switch (flags) + { + case RELOAD_FORCE: + reloadFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE | + nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY; + break; + case RELOAD_ENCODING_CHANGE: + reloadFlags = nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE; + break; + case RELOAD_NORMAL: + default: + reloadFlags = 0; + break; + } + + return webNavigation->Reload (reloadFlags); +} + nsresult EphyBrowser::SetZoom (float aZoom) { NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h index f2f034dd1..07023887c 100644 --- a/embed/mozilla/EphyBrowser.h +++ b/embed/mozilla/EphyBrowser.h @@ -100,6 +100,12 @@ public: nsresult GetSHUrlAtIndex (PRInt32 index, nsACString &url); nsresult GoToHistoryIndex (PRInt16 index); + enum { RELOAD_NORMAL = 0 }; + enum { RELOAD_FORCE = 1 }; + enum { RELOAD_ENCODING_CHANGE = 2 }; + + nsresult Reload (PRUint32 flags); + nsresult ForceEncoding (const char *encoding); nsresult GetEncoding (nsACString &encoding); nsresult GetForcedEncoding (nsACString &encoding); diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 1f4f826c1..5d7e30bc8 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -509,6 +509,12 @@ static void impl_reload (EphyEmbed *embed, gboolean force) { + /* Workaround for broken reload with frames, see mozilla bug + * http://bugzilla.mozilla.org/show_bug.cgi?id=246392 + * Replace #if 0 with appropriate MOZILLA_CHECK_VERSION4 once the bug + * has been fixed + */ +#if 0 guint32 mflags; mflags = GTK_MOZ_EMBED_FLAG_RELOADNORMAL; @@ -517,8 +523,14 @@ impl_reload (EphyEmbed *embed, { mflags = GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE; } - + gtk_moz_embed_reload (GTK_MOZ_EMBED(embed), mflags); +#else + MozillaEmbedPrivate *mpriv = MOZILLA_EMBED (embed)->priv; + + mpriv->browser->Reload (force ? EphyBrowser::RELOAD_FORCE : + EphyBrowser::RELOAD_NORMAL); +#endif } static void @@ -749,8 +761,17 @@ impl_set_encoding (EphyEmbed *embed, if (NS_FAILED (result)) return; } + /* Workaround for broken reload with frames, see mozilla bug + * http://bugzilla.mozilla.org/show_bug.cgi?id=246392 + * Replace #if 0 with appropriate MOZILLA_CHECK_VERSION4 once the bug + * has been fixed + */ +#if 0 gtk_moz_embed_reload (GTK_MOZ_EMBED (embed), GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE); +#else + mpriv->browser->Reload (EphyBrowser::RELOAD_ENCODING_CHANGE); +#endif } static char * |