Fiox the special-casing for about:blank to deal with it now being

moz-safe-about:blank as far as the security manager is concerned.  Bug 342108,
r=darin, sr=jst
This commit is contained in:
bzbarsky%mit.edu 2006-06-22 02:21:06 +00:00
Родитель 6c8d302694
Коммит 714b309562
3 изменённых файлов: 13 добавлений и 5 удалений

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

@ -918,7 +918,7 @@ nsScriptSecurityManager::CheckSameOriginPrincipalInternal(nsIPrincipal* aSubject
nsXPIDLCString origin;
rv = aObject->GetOrigin(getter_Copies(origin));
NS_ENSURE_SUCCESS(rv, rv);
if (nsCRT::strcasecmp(origin, "about:blank") == 0)
if (nsCRT::strcasecmp(origin, "moz-safe-about:blank") == 0)
return NS_OK;
}

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

@ -989,7 +989,7 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
},
{ NS_SAFEABOUTPROTOCOLHANDLER_CLASSNAME,
NS_SAFEABOUTPROTOCOLHANDLER_CID,
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "safe-about",
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-safe-about",
nsSafeAboutProtocolHandlerConstructor
},
{ "about:blank",

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

@ -117,10 +117,18 @@ nsAboutProtocolHandler::NewURI(const nsACString &aSpec,
}
if (isSafe) {
// We need to indicate that this baby is safe. Use an inner
// URI that no one but the security manager will see.
// We need to indicate that this baby is safe. Use an inner URI that
// no one but the security manager will see. Make sure to preserve our
// path, in case someone decides to hardcode checks for particular
// about: URIs somewhere.
nsCAutoString spec;
rv = url->GetPath(spec);
NS_ENSURE_SUCCESS(rv, rv);
spec.Insert("moz-safe-about:", 0);
nsCOMPtr<nsIURI> inner;
rv = NS_NewURI(getter_AddRefs(inner), "moz-safe-about:x");
rv = NS_NewURI(getter_AddRefs(inner), spec);
NS_ENSURE_SUCCESS(rv, rv);
nsSimpleNestedURI* outer = new nsSimpleNestedURI(inner);