зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
a87f0ccbd2
Коммит
38928a5688
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче