зеркало из https://github.com/mozilla/gecko-dev.git
Bug 996069 - Part1: nsContentUtils::IsSystemOrExpandedPrincipal. r=bz
This commit is contained in:
Родитель
66aea42178
Коммит
2434cfbdd2
|
@ -1326,6 +1326,14 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool IsExpandedPrincipal(nsIPrincipal* aPrincipal);
|
static bool IsExpandedPrincipal(nsIPrincipal* aPrincipal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if aPrincipal is the system or an nsExpandedPrincipal.
|
||||||
|
*/
|
||||||
|
static bool IsSystemOrExpandedPrincipal(nsIPrincipal* aPrincipal)
|
||||||
|
{
|
||||||
|
return IsSystemPrincipal(aPrincipal) || IsExpandedPrincipal(aPrincipal);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the system principal from the security manager.
|
* Gets the system principal from the security manager.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1544,17 +1544,9 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
||||||
// for in InternalLoad is data:, javascript:, and about:blank
|
// for in InternalLoad is data:, javascript:, and about:blank
|
||||||
// URIs. For other URIs this would all be dead wrong!
|
// URIs. For other URIs this would all be dead wrong!
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
|
||||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (owner && mItemType != typeChrome) {
|
if (owner && mItemType != typeChrome) {
|
||||||
nsCOMPtr<nsIPrincipal> ownerPrincipal = do_QueryInterface(owner);
|
nsCOMPtr<nsIPrincipal> ownerPrincipal = do_QueryInterface(owner);
|
||||||
bool isSystem;
|
if (nsContentUtils::IsSystemOrExpandedPrincipal(ownerPrincipal)) {
|
||||||
rv = secMan->IsSystemPrincipal(ownerPrincipal, &isSystem);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
nsCOMPtr<nsIExpandedPrincipal> ep = do_QueryInterface(ownerPrincipal);
|
|
||||||
if (isSystem || ep) {
|
|
||||||
if (ownerIsExplicit) {
|
if (ownerIsExplicit) {
|
||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
}
|
}
|
||||||
|
@ -1564,6 +1556,9 @@ nsDocShell::LoadURI(nsIURI * aURI,
|
||||||
}
|
}
|
||||||
if (!owner && !inheritOwner && !ownerIsExplicit) {
|
if (!owner && !inheritOwner && !ownerIsExplicit) {
|
||||||
// See if there's system or chrome JS code running
|
// See if there's system or chrome JS code running
|
||||||
|
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||||
|
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
rv = secMan->SubjectPrincipalIsSystem(&inheritOwner);
|
rv = secMan->SubjectPrincipalIsSystem(&inheritOwner);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
// Set it back to false
|
// Set it back to false
|
||||||
|
|
Загрузка…
Ссылка в новой задаче