epiphany r8207 - branches/gnome-2-22/embed/mozilla



Author: chpe
Date: Wed Apr  9 17:53:23 2008
New Revision: 8207
URL: http://svn.gnome.org/viewvc/epiphany?rev=8207&view=rev

Log:
Use nsIURIFixup instead of massaging the URI ourself.


Modified:
   branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp
   branches/gnome-2-22/embed/mozilla/EphyBrowser.h

Modified: branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp
==============================================================================
--- branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp	(original)
+++ branches/gnome-2-22/embed/mozilla/EphyBrowser.cpp	Wed Apr  9 17:53:23 2008
@@ -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 @@
 					 &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 @@
 			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 @@
 	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;

Modified: branches/gnome-2-22/embed/mozilla/EphyBrowser.h
==============================================================================
--- branches/gnome-2-22/embed/mozilla/EphyBrowser.h	(original)
+++ branches/gnome-2-22/embed/mozilla/EphyBrowser.h	Wed Apr  9 17:53:23 2008
@@ -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 @@
 #ifdef HAVE_MOZILLA_PSM
 	nsCOMPtr<nsISecureBrowserUI> mSecurityInfo;
 #endif
+        nsCOMPtr<nsIURIFixup> mFixup;
 
 	nsresult GetListener (void);
 	nsresult AttachListeners (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]