Bug 330037 - First check if script/data url's are allowed, r=dveditz, sr=bzbarsky

This commit is contained in:
martijn.martijn%gmail.com 2006-03-15 11:03:25 +00:00
Родитель 1465a361dc
Коммит 99bb8c1c9e
1 изменённых файлов: 6 добавлений и 6 удалений

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

@ -1276,12 +1276,6 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
rv = GetBaseURIScheme(aTargetURI, targetScheme);
if (NS_FAILED(rv)) return rv;
if (nsCRT::strcasecmp(targetScheme.get(), sourceScheme.get()) == 0)
{
// every scheme can access another URI from the same scheme
return NS_OK;
}
//-- Some callers do not allow loading javascript: or data: URLs
if (((aFlags & (nsIScriptSecurityManager::DISALLOW_SCRIPT |
nsIScriptSecurityManager::DISALLOW_SCRIPT_OR_DATA)) &&
@ -1292,6 +1286,12 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
return NS_ERROR_DOM_BAD_URI;
}
if (nsCRT::strcasecmp(targetScheme.get(), sourceScheme.get()) == 0)
{
// every scheme can access another URI from the same scheme
return NS_OK;
}
//-- If the schemes don't match, the policy is specified in this table.
enum Action { AllowProtocol, DenyProtocol, PrefControlled, ChromeProtocol};
static const struct