nsExternalHelperAppService::ExternalProtocolHandlerExists (almost) always sets aHandlerExists to PR_TRUE, enabling gnomevfs protocols (bug 389632), patch by Karl Tomlinson <mozbugs@karlt.net>, r+sr=biesi,dmose; a=roc

This commit is contained in:
dmose%mozilla.org 2007-07-27 18:31:13 +00:00
Родитель a87f0ccbd2
Коммит 38928a5688
6 изменённых файлов: 23 добавлений и 6 удалений

Просмотреть файл

@ -240,7 +240,8 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
PRBool exists;
nsresult rv = OSProtocolHandlerExists(nsPromiseFlatCString(aScheme).get(),
&exists);
NS_ENSURE_SUCCESS(rv, nsnull);
if (NS_FAILED(rv) || !exists)
return nsnull;
nsMIMEInfoBeOS *handlerInfo =
new nsMIMEInfoBeOS(aScheme, nsMIMEInfoBase::eProtocolInfo);

Просмотреть файл

@ -323,7 +323,8 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
PRBool exists;
nsresult rv = OSProtocolHandlerExists(nsPromiseFlatCString(aScheme).get(),
&exists);
NS_ENSURE_SUCCESS(rv, nsnull);
if (NS_FAILED(rv) || !exists)
return nsnull;
nsMIMEInfoMac *handlerInfo =
new nsMIMEInfoMac(aScheme, nsMIMEInfoBase::eProtocolInfo);

Просмотреть файл

@ -584,8 +584,10 @@ NS_IMETHODIMP nsExternalProtocolHandler::NewURI(const nsACString &aSpec,
NS_IMETHODIMP nsExternalProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
{
// only try to return a channel if we have a protocol handler for the url
// Only try to return a channel if we have a protocol handler for the url.
// nsOSHelperAppService::LoadUriInternal relies on this to check trustedness
// for some platforms at least. (win uses ::ShellExecute and unix uses
// gnome_url_show.)
PRBool haveExternalHandler = HaveExternalProtocolHandler(aURI);
if (haveExternalHandler)
{

Просмотреть файл

@ -242,6 +242,14 @@ nsGNOMERegistry::HandlerExists(const char *aProtocolScheme)
return PR_FALSE;
}
// XXX Check HandlerExists() before calling LoadURL.
//
// If there is not a registered handler for the protocol, gnome_url_show()
// falls back to using gnomevfs modules. See bug 389632. We don't want
// this fallback to happen as we are not sure of the safety of all gnomevfs
// modules and MIME-default applications. (gnomevfs should be handled in
// nsGnomeVFSProtocolHandler.)
/* static */ nsresult
nsGNOMERegistry::LoadURL(nsIURI *aURL)
{

Просмотреть файл

@ -1639,10 +1639,14 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
{
NS_ASSERTION(!aScheme.IsEmpty(), "No scheme was specified!");
// We must check that a registered handler exists so that gnome_url_show
// doesn't fallback to gnomevfs.
// See nsGNOMERegistry::LoadURL and bug 389632.
PRBool exists;
nsresult rv = OSProtocolHandlerExists(nsPromiseFlatCString(aScheme).get(),
&exists);
NS_ENSURE_SUCCESS(rv, nsnull);
if (NS_FAILED(rv) || !exists)
return nsnull;
nsMIMEInfoUnix *handlerInfo =
new nsMIMEInfoUnix(aScheme, nsMIMEInfoBase::eProtocolInfo);

Просмотреть файл

@ -561,7 +561,8 @@ nsOSHelperAppService::GetProtocolInfoFromOS(const nsACString &aScheme)
PRBool exists;
nsresult rv = OSProtocolHandlerExists(nsPromiseFlatCString(aScheme).get(),
&exists);
NS_ENSURE_SUCCESS(rv, nsnull);
if (NS_FAILED(rv) || !exists)
return nsnull;
nsMIMEInfoWin *handlerInfo =
new nsMIMEInfoWin(aScheme, nsMIMEInfoBase::eProtocolInfo);