From 6dbcb632879343f666be3ad35889d23869f6cdd8 Mon Sep 17 00:00:00 2001 From: "sdwilsh%shawnwilsher.com" Date: Thu, 26 Jul 2007 21:26:31 +0000 Subject: [PATCH] Bug 385065 - protocol handling dialog. I accidentally reverted this change when I landed Bug 385065. This was fixed with Bug 389580 and Bug 389580 r+sr=cbiesinger --- .../exthandler/nsExternalHelperAppService.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index df070524cb2..ba4182520bd 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -1203,8 +1203,22 @@ nsExternalHelperAppService::LoadURI(nsIURI *aURI, { NS_ENSURE_ARG_POINTER(aURI); + nsCAutoString spec; + aURI->GetSpec(spec); + + if (spec.Find("%00") != -1) + return NS_ERROR_MALFORMED_URI; + + spec.ReplaceSubstring("\"", "%22"); + spec.ReplaceSubstring("`", "%60"); + + nsCOMPtr ios(do_GetIOService()); + nsCOMPtr uri; + nsresult rv = ios->NewURI(spec, nsnull, nsnull, gettter_AddRefs(uri)); + NS_ENSURE_SUCCESS(rv, rv); + nsCAutoString scheme; - aURI->GetScheme(scheme); + uri->GetScheme(scheme); if (scheme.IsEmpty()) return NS_OK; // must have a scheme @@ -1251,13 +1265,13 @@ nsExternalHelperAppService::LoadURI(nsIURI *aURI, if (!warn || !alwaysAsk && (preferredAction == nsIHandlerInfo::useHelperApp || preferredAction == nsIHandlerInfo::useSystemDefault)) - return handler->LaunchWithURI(aURI); + return handler->LaunchWithURI(uri); nsCOMPtr chooser = do_CreateInstance("@mozilla.org/content-dispatch-chooser;1", &rv); NS_ENSURE_SUCCESS(rv, rv); - return chooser->Ask(handler, aWindowContext, aURI, + return chooser->Ask(handler, aWindowContext, uri, nsIContentDispatchChooser::REASON_CANNOT_HANDLE); }