aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2008-04-10 00:53:23 +0800
committerChristian Persch <chpe@src.gnome.org>2008-04-10 00:53:23 +0800
commit5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8 (patch)
tree5161e188ad36e5fc09761b3388a0b0068b4af63d /embed/mozilla
parentd0187a5fa417827891126ecf0d43097cda3df9fb (diff)
downloadgsoc2013-epiphany-5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8.tar
gsoc2013-epiphany-5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8.tar.gz
gsoc2013-epiphany-5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8.tar.bz2
gsoc2013-epiphany-5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8.tar.lz
gsoc2013-epiphany-5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8.tar.xz
gsoc2013-epiphany-5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8.tar.zst
gsoc2013-epiphany-5d7d8f9a3c24ded4e7978ebfcbc17cd01da32bf8.zip
Use nsIURIFixup instead of massaging the URI ourself.
svn path=/branches/gnome-2-22/; revision=8207
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EphyBrowser.cpp24
-rw-r--r--embed/mozilla/EphyBrowser.h2
2 files changed, 15 insertions, 11 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index 7963d5e7b..c83e60d88 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -84,6 +84,7 @@
#include <nsIWebPageDescriptor.h>
#include <nsMemory.h>
#include <nsServiceManagerUtils.h>
+#include <nsCDefaultURIFixup.h>
#ifdef HAVE_MOZILLA_PSM
#include <nsICertificateDialogs.h>
@@ -364,14 +365,13 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent)
&decision);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
if (decision != nsIContentPolicy::ACCEPT) return NS_OK;
-
- /* Hide password part */
- nsCString user;
- favUri->GetUsername (user);
- favUri->SetUserPass (user);
+
+ nsCOMPtr<nsIURI> exposableURI;
+ rv = mOwner->mFixup->CreateExposableURI (favUri, getter_AddRefs (exposableURI));
+ NS_ENSURE_SUCCESS (rv, rv);
nsCString spec;
- favUri->GetSpec (spec);
+ exposableURI->GetSpec (spec);
/* ok, we accept this as a valid favicon for this site */
g_signal_emit_by_name (mOwner->mEmbed, "ge_favicon", spec.get());
@@ -429,13 +429,12 @@ EphyDOMLinkEventListener::HandleEvent (nsIDOMEvent* aDOMEvent)
rv = GetDocURI (linkElement, getter_AddRefs (docUri));
NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && docUri, NS_ERROR_FAILURE);
- /* Hide password part */
- nsCString user;
- docUri->GetUsername (user);
- docUri->SetUserPass (user);
+ nsCOMPtr<nsIURI> exposableURI;
+ rv = mOwner->mFixup->CreateExposableURI (docUri, getter_AddRefs (exposableURI));
+ NS_ENSURE_SUCCESS (rv, rv);
nsCString resolvedLink;
- rv = docUri->Resolve (cLink, resolvedLink);
+ rv = exposableURI->Resolve (cLink, resolvedLink);
NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
linkElement->GetAttribute (NS_LITERAL_STRING ("title"), value);
@@ -902,6 +901,9 @@ nsresult EphyBrowser::Init (EphyEmbed *embed)
NS_ENSURE_SUCCESS (rv, rv);
#endif /* HAVE_MOZILLA_PSM */
+ mFixup = do_GetService (NS_URIFIXUP_CONTRACTID);
+ NS_ENSURE_TRUE (mFixup, NS_ERROR_FAILURE);
+
mInitialized = PR_TRUE;
return NS_OK;
diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h
index 18520fc03..ac0ef2ef6 100644
--- a/embed/mozilla/EphyBrowser.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -37,6 +37,7 @@
#include <nsIWebBrowser.h>
#include <nsIWebNavigation.h>
#include <nsPIDOMWindow.h>
+#include <nsIURIFixup.h>
#ifdef ALLOW_PRIVATE_API
#include <nsIContentViewer.h>
@@ -225,6 +226,7 @@ private:
#ifdef HAVE_MOZILLA_PSM
nsCOMPtr<nsISecureBrowserUI> mSecurityInfo;
#endif
+ nsCOMPtr<nsIURIFixup> mFixup;
nsresult GetListener (void);
nsresult AttachListeners (void);