diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-07-21 02:15:45 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-07-21 02:15:45 +0800 |
commit | a2ac8ca7dd579263c826d87dded5265749900da4 (patch) | |
tree | ca6b9540b399a61d1f930327bdf92f3b8216bec4 /embed | |
parent | 4a28a25c29ecb619138dc03fd80e24eaf899f0dd (diff) | |
download | gsoc2013-epiphany-a2ac8ca7dd579263c826d87dded5265749900da4.tar gsoc2013-epiphany-a2ac8ca7dd579263c826d87dded5265749900da4.tar.gz gsoc2013-epiphany-a2ac8ca7dd579263c826d87dded5265749900da4.tar.bz2 gsoc2013-epiphany-a2ac8ca7dd579263c826d87dded5265749900da4.tar.lz gsoc2013-epiphany-a2ac8ca7dd579263c826d87dded5265749900da4.tar.xz gsoc2013-epiphany-a2ac8ca7dd579263c826d87dded5265749900da4.tar.zst gsoc2013-epiphany-a2ac8ca7dd579263c826d87dded5265749900da4.zip |
Pass single to the sniffer and weak ref it. Fix #141928
2004-07-20 Marco Pesenti Gritti <marco@gnome.org>
* embed/mozilla/EphyHeaderSniffer.cpp:
* embed/mozilla/EphyHeaderSniffer.h:
* embed/mozilla/mozilla-embed-persist.cpp:
Pass single to the sniffer and weak ref it.
Fix #141928
Diffstat (limited to 'embed')
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.cpp | 24 | ||||
-rw-r--r-- | embed/mozilla/EphyHeaderSniffer.h | 6 |
2 files changed, 20 insertions, 10 deletions
diff --git a/embed/mozilla/EphyHeaderSniffer.cpp b/embed/mozilla/EphyHeaderSniffer.cpp index e455f80b9..91ce298c0 100644 --- a/embed/mozilla/EphyHeaderSniffer.cpp +++ b/embed/mozilla/EphyHeaderSniffer.cpp @@ -47,8 +47,6 @@ #include "MozDownload.h" #include "EphyHeaderSniffer.h" -#include "ephy-embed-single.h" -#include "ephy-embed-shell.h" #include "ephy-file-chooser.h" #include "ephy-prefs.h" #include "ephy-gui.h" @@ -70,7 +68,8 @@ #include <nsIWindowWatcher.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) @@ -86,11 +85,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) @@ -98,15 +107,14 @@ NS_IMPL_ISUPPORTS2(EphyHeaderSniffer, nsIWebProgressListener, nsIAuthPrompt) NS_IMETHODIMP EphyHeaderSniffer::HandleContent () { - EphyEmbedSingle *single; gboolean handled = FALSE; nsEmbedCString 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 4aa7d1fa8..f58bebe01 100644 --- a/embed/mozilla/EphyHeaderSniffer.h +++ b/embed/mozilla/EphyHeaderSniffer.h @@ -40,6 +40,7 @@ */ #include "mozilla-embed-persist.h" +#include "ephy-embed-single.h" #include <nsIWebProgressListener.h> #include <nsIWebBrowserPersist.h> @@ -56,8 +57,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 @@ -73,6 +74,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; |