зеркало из https://github.com/mozilla/pjs.git
Bug 585869 - Check for file scheme in nsResURL::EnsureFile, r=bsmedberg a=blocking2.0
This commit is contained in:
Родитель
1b48aeb895
Коммит
851a291f43
|
@ -95,25 +95,20 @@ nsResURL::EnsureFile()
|
|||
|
||||
nsCAutoString spec;
|
||||
rv = gResHandler->ResolveURI(this, spec);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#if defined(MOZ_CHROME_FILE_FORMAT_JAR) || defined(MOZ_OMNIJAR)
|
||||
nsCAutoString host;
|
||||
rv = GetHost(host);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
// Deal with the fact resource://gre-resouces/ urls do not resolve to files
|
||||
if (host.Equals(kGRE_RESOURCES))
|
||||
|
||||
nsCAutoString scheme;
|
||||
rv = net_ExtractURLScheme(spec, nsnull, nsnull, &scheme);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// Bug 585869:
|
||||
// In most cases, the scheme is jar if it's not file.
|
||||
// Regardless, net_GetFileFromURLSpec should be avoided
|
||||
// when the scheme isn't file.
|
||||
if (!scheme.Equals(NS_LITERAL_CSTRING("file")))
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
#endif
|
||||
#ifdef MOZ_OMNIJAR
|
||||
if (mozilla::OmnijarPath()) {
|
||||
if (host.Equals(kGRE))
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
if (host.IsEmpty())
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
#endif
|
||||
|
||||
rv = net_GetFileFromURLSpec(spec, getter_AddRefs(mFile));
|
||||
#ifdef DEBUG_bsmedberg
|
||||
|
|
Загрузка…
Ссылка в новой задаче