зеркало из https://github.com/mozilla/gecko-dev.git
Bug 214949
Make XUL error pages work again by making GetOrigin() return the full spec for chrome: URIs and preventing principal lookups when the principals hash is empty. r+sr=jst@netscape.com a=rjesup@wgate.com
This commit is contained in:
Родитель
e3cdfbf901
Коммит
c2d2462e51
|
@ -140,8 +140,18 @@ nsPrincipal::GetOrigin(char **aOrigin)
|
|||
NS_ASSERTION(uri, "No Domain or Codebase");
|
||||
|
||||
nsCAutoString hostPort;
|
||||
nsresult rv = uri->GetHostPort(hostPort);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
// chrome: URLs don't have a meaningful origin, so make
|
||||
// sure we just get the full spec for them.
|
||||
// XXX this should be removed in favor of the solution in
|
||||
// bug 160042.
|
||||
PRBool isChrome;
|
||||
nsresult rv = uri->SchemeIs("chrome", &isChrome);
|
||||
if (NS_SUCCEEDED(rv) && !isChrome) {
|
||||
rv = uri->GetHostPort(hostPort);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !isChrome) {
|
||||
nsCAutoString scheme;
|
||||
rv = uri->GetScheme(scheme);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -1654,6 +1654,8 @@ nsScriptSecurityManager::GetCodebasePrincipal(nsIURI *aURI,
|
|||
rv = CreateCodebasePrincipal(aURI, getter_AddRefs(principal));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mPrincipals.Count() > 0)
|
||||
{
|
||||
//-- Check to see if we already have this principal.
|
||||
nsCOMPtr<nsIPrincipal> fromTable;
|
||||
mPrincipals.Get(principal, getter_AddRefs(fromTable));
|
||||
|
@ -1674,6 +1676,7 @@ nsScriptSecurityManager::GetCodebasePrincipal(nsIURI *aURI,
|
|||
if (fromTable)
|
||||
principal = fromTable;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*result = principal);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче