diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-07-25 19:12:30 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-07-25 19:12:30 +0800 |
commit | f0f08650983d0b06f7c02f2d7163e026e61ac3ed (patch) | |
tree | 77797aced4cc4244b896e3ca3ef549a9a0322f51 | |
parent | 2fc0f613b6289f4e3293de5737e41c1a016d9a17 (diff) | |
download | gsoc2013-epiphany-f0f08650983d0b06f7c02f2d7163e026e61ac3ed.tar gsoc2013-epiphany-f0f08650983d0b06f7c02f2d7163e026e61ac3ed.tar.gz gsoc2013-epiphany-f0f08650983d0b06f7c02f2d7163e026e61ac3ed.tar.bz2 gsoc2013-epiphany-f0f08650983d0b06f7c02f2d7163e026e61ac3ed.tar.lz gsoc2013-epiphany-f0f08650983d0b06f7c02f2d7163e026e61ac3ed.tar.xz gsoc2013-epiphany-f0f08650983d0b06f7c02f2d7163e026e61ac3ed.tar.zst gsoc2013-epiphany-f0f08650983d0b06f7c02f2d7163e026e61ac3ed.zip |
Pass the single to the header sniffer and weak ref it. Fixes bug #141928,
2004-07-25 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EphyHeaderSniffer.cpp:
* embed/mozilla/EphyHeaderSniffer.h:
* embed/mozilla/mozilla-embed-persist.cpp:
Pass the single to the header sniffer and weak ref it.
Fixes bug #141928, backported from HEAD.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 24 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.h | 6 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-persist.cpp | 5 |
4 files changed, 33 insertions, 11 deletions
@@ -1,5 +1,14 @@ 2004-07-25 Christian Persch <chpe@cvs.gnome.org> + * embed/mozilla/EphyHeaderSniffer.cpp: + * embed/mozilla/EphyHeaderSniffer.h: + * embed/mozilla/mozilla-embed-persist.cpp: + + Pass the single to the header sniffer and weak ref it. + Fixes bug #141928, backported from HEAD. + +2004-07-25 Christian Persch <chpe@cvs.gnome.org> + * embed/mozilla/EphySingle.cpp: * embed/mozilla/mozilla-embed-single.cpp: diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index a8efe449c..07f1f5c14 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -49,8 +49,6 @@ #include "EphyHeaderSniffer.h" #include "netCore.h" -#include "ephy-embed-single.h" -#include "ephy-embed-shell.h" #include "ephy-file-chooser.h" #include "ephy-prefs.h" #include "ephy-gui.h" @@ -76,7 +74,8 @@ #include <libgnomevfs/gnome-vfs-utils.h> EphyHeaderSniffer::EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmbedPersist *aEmbedPersist, - nsIFile* aFile, nsIURI* aURL, nsIDOMDocument* aDocument, nsIInputStream* aPostData) + nsIFile* aFile, nsIURI* aURL, nsIDOMDocument* aDocument, nsIInputStream* aPostData, + EphyEmbedSingle *single) : mPersist(aPersist) , mEmbedPersist(aEmbedPersist) , mTmpFile(aFile) @@ -92,11 +91,21 @@ EphyHeaderSniffer::EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmb if (!watcher) return; watcher->GetNewAuthPrompter (nsnull, getter_AddRefs (mAuthPrompt)); + + mSingle = single; + g_object_add_weak_pointer (G_OBJECT (mSingle), + (gpointer *)&mSingle); } EphyHeaderSniffer::~EphyHeaderSniffer() { LOG ("EphyHeaderSniffer dtor (%p)", this) + + if (mSingle) + { + g_object_remove_weak_pointer (G_OBJECT (mSingle), + (gpointer *)&mSingle); + } } NS_IMPL_ISUPPORTS2(EphyHeaderSniffer, nsIWebProgressListener, nsIAuthPrompt) @@ -104,15 +113,14 @@ NS_IMPL_ISUPPORTS2(EphyHeaderSniffer, nsIWebProgressListener, nsIAuthPrompt) NS_IMETHODIMP EphyHeaderSniffer::HandleContent () { - EphyEmbedSingle *single; gboolean handled = FALSE; nsCString uriSpec; - if (mPostData) return NS_ERROR_FAILURE; + if (mPostData || !mSingle) return NS_ERROR_FAILURE; - mURL->GetSpec (uriSpec); - single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); - g_signal_emit_by_name (single, "handle_content", mContentType.get(), + mURL->GetSpec (uriSpec); + + g_signal_emit_by_name (mSingle, "handle_content", mContentType.get(), uriSpec.get(), &handled); return handled ? NS_OK : NS_ERROR_FAILURE; diff --git a/embed/mozilla/EphyHeaderSniffer.h b/embed/mozilla/EphyHeaderSniffer.h index ba64444df..cf66e2484 100644 --- a/embed/mozilla/EphyHeaderSniffer.h +++ b/embed/mozilla/EphyHeaderSniffer.h @@ -37,6 +37,7 @@ * ***** END LICENSE BLOCK ***** */ #include "mozilla-embed-persist.h" +#include "ephy-embed-single.h" #include "nsString.h" #include "nsIWebProgressListener.h" @@ -53,8 +54,8 @@ class EphyHeaderSniffer : public nsIWebProgressListener, { public: EphyHeaderSniffer (nsIWebBrowserPersist* aPersist, MozillaEmbedPersist *aEmbedPersist, - nsIFile* aFile, nsIURI* aURL, - nsIDOMDocument* aDocument, nsIInputStream* aPostData); + nsIFile* aFile, nsIURI* aURL, nsIDOMDocument* aDocument, + nsIInputStream* aPostData, EphyEmbedSingle *single); virtual ~EphyHeaderSniffer (); NS_DECL_ISUPPORTS @@ -70,6 +71,7 @@ protected: private: nsIWebBrowserPersist* mPersist; /* Weak. It owns us as a listener. */ MozillaEmbedPersist *mEmbedPersist; + EphyEmbedSingle *mSingle; nsCOMPtr<nsIFile> mTmpFile; nsCOMPtr<nsIURI> mURL; nsCOMPtr<nsIURI> mOriginalURI; diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp index cde265aa7..f3b9c6fc9 100644 --- a/embed/mozilla/mozilla-embed-persist.cpp +++ b/embed/mozilla/mozilla-embed-persist.cpp @@ -138,6 +138,9 @@ impl_save (EphyEmbedPersist *persist) long max_size; EphyEmbed *embed; EmbedPersistFlags flags; + EphyEmbedSingle *single; + + single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell)); g_object_ref (persist); @@ -247,7 +250,7 @@ impl_save (EphyEmbedPersist *persist) EphyHeaderSniffer* sniffer = new EphyHeaderSniffer (webPersist, MOZILLA_EMBED_PERSIST (persist), - tmpFile, inURI, DOMDocument, postData); + tmpFile, inURI, DOMDocument, postData, single); if (!sniffer) return FALSE; webPersist->SetProgressListener(sniffer); |