From c05e66e7a3f04e103d5bb2c16886d777c2315de0 Mon Sep 17 00:00:00 2001 From: "stridey%gmail.com" Date: Wed, 25 Oct 2006 19:02:32 +0000 Subject: [PATCH] Camino only - Don't show wyciwyg URLs in location bar. Patch by smorgan r=hwaara sr=pink b=306396 --- camino/resources/application/all-camino.js | 3 +++ camino/src/download/nsDownloadListener.mm | 11 +++++++++-- camino/src/embedding/CHBrowserListener.mm | 9 ++++++++- camino/src/embedding/CHBrowserView.mm | 13 ++++++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/camino/resources/application/all-camino.js b/camino/resources/application/all-camino.js index 8c97e1afe4c8..c163ce06b9d9 100644 --- a/camino/resources/application/all-camino.js +++ b/camino/resources/application/all-camino.js @@ -135,3 +135,6 @@ pref("browser.link.open_newwindow.restriction", 2); // enable popup blocking pref("dom.disable_open_during_load", true); + +// don't hide user:pass when fixing up URIs +pref("browser.fixup.hide_user_pass", false); diff --git a/camino/src/download/nsDownloadListener.mm b/camino/src/download/nsDownloadListener.mm index 97c442f1d65b..e762f3298f73 100644 --- a/camino/src/download/nsDownloadListener.mm +++ b/camino/src/download/nsDownloadListener.mm @@ -41,6 +41,7 @@ #include "nsDownloadListener.h" +#include "nsIURIFixup.h" #include "nsIWebProgress.h" #include "nsIFileURL.h" #include "netCore.h" @@ -312,8 +313,14 @@ nsDownloadListener::InitDialog() spec.Append(hostport); spec.Append(path); } - else - mURI->GetSpec(spec); + else { + nsCOMPtr exposableURI; + nsCOMPtr fixup(do_GetService("@mozilla.org/docshell/urifixup;1")); + if (fixup && NS_SUCCEEDED(fixup->CreateExposableURI(mURI, getter_AddRefs(exposableURI))) && exposableURI) + exposableURI->GetSpec(spec); + else + mURI->GetSpec(spec); + } [mDownloadDisplay setSourceURL: [NSString stringWithUTF8String:spec.get()]]; } diff --git a/camino/src/embedding/CHBrowserListener.mm b/camino/src/embedding/CHBrowserListener.mm index 276961a63b47..bb335f5e1513 100644 --- a/camino/src/embedding/CHBrowserListener.mm +++ b/camino/src/embedding/CHBrowserListener.mm @@ -46,6 +46,7 @@ #include "nsIWebNavigation.h" #include "nsIWebProgress.h" #include "nsIURI.h" +#include "nsIURIFixup.h" #include "nsIDOMElement.h" #include "nsIDOMWindow.h" #include "nsIDOMDocument.h" @@ -708,7 +709,13 @@ CHBrowserListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aR } nsCAutoString spec; - aLocation->GetSpec(spec); + nsCOMPtr exposableLocation; + nsCOMPtr fixup(do_GetService("@mozilla.org/docshell/urifixup;1")); + if (fixup && NS_SUCCEEDED(fixup->CreateExposableURI(aLocation, getter_AddRefs(exposableLocation))) && exposableLocation) + exposableLocation->GetSpec(spec); + else + aLocation->GetSpec(spec); + NSString* str = [NSString stringWithUTF8String:spec.get()]; NSEnumerator* enumerator = [mListeners objectEnumerator]; diff --git a/camino/src/embedding/CHBrowserView.mm b/camino/src/embedding/CHBrowserView.mm index d0dbe9d267b8..d791be0956bf 100644 --- a/camino/src/embedding/CHBrowserView.mm +++ b/camino/src/embedding/CHBrowserView.mm @@ -51,6 +51,7 @@ #include "nsIDocCharset.h" #include "nsIURI.h" +#include "nsIURIFixup.h" #include "nsIDocument.h" #include "nsIDOMWindow.h" #include "nsPIDOMWindow.h" @@ -537,6 +538,10 @@ const long NSFindPanelActionSetFindString = 7; browserSetup->SetProperty(property, value); } +// Gets the current URI in fixed-up form, suitable for display to the user. +// In the case of wyciwyg: URIs, this will not be the actual URI of the page +// according to gecko. +// // should we be using the window.location URL instead? see nsIDOMLocation.h - (NSString*)getCurrentURI { @@ -550,7 +555,13 @@ const long NSFindPanelActionSetFindString = 7; return @""; nsCAutoString spec; - uri->GetSpec(spec); + nsCOMPtr exposableURI; + nsCOMPtr fixup(do_GetService("@mozilla.org/docshell/urifixup;1")); + if (fixup && NS_SUCCEEDED(fixup->CreateExposableURI(uri, getter_AddRefs(exposableURI))) && exposableURI) + exposableURI->GetSpec(spec); + else + uri->GetSpec(spec); + return [NSString stringWithUTF8String:spec.get()]; }