mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 700561 - Relax short-circuit principal checks on account of inner window reuse. r=bz
This commit is contained in:
parent
e616955c4c
commit
196a0a6768
@ -2483,11 +2483,10 @@ nsScriptSecurityManager::doGetObjectPrincipal(JSObject *aObj
|
||||
if (aAllowShortCircuit) {
|
||||
nsIPrincipal *principal = doGetObjectPrincipal(origObj, false);
|
||||
|
||||
// Location is always wrapped (even for same-compartment), so we can
|
||||
// loosen the check to same-origin instead of same-principal.
|
||||
NS_ASSERTION(strcmp(jsClass->name, "Location") == 0 ?
|
||||
NS_SUCCEEDED(CheckSameOriginPrincipal(result, principal)) :
|
||||
result == principal,
|
||||
// Because of inner window reuse, we can have objects with one principal
|
||||
// living in a scope with a different (but same-origin) principal. So
|
||||
// just check same-origin here.
|
||||
NS_ASSERTION(NS_SUCCEEDED(CheckSameOriginPrincipal(result, principal)),
|
||||
"Principal mismatch. Not good");
|
||||
}
|
||||
#endif
|
||||
|
@ -2917,9 +2917,18 @@ XPCWrappedNative::GetObjectPrincipal() const
|
||||
{
|
||||
nsIPrincipal* principal = GetScope()->GetPrincipal();
|
||||
#ifdef DEBUG
|
||||
// Because of inner window reuse, we can have objects with one principal
|
||||
// living in a scope with a different (but same-origin) principal. So
|
||||
// just check same-origin here.
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> objPrin(do_QueryInterface(mIdentity));
|
||||
NS_ASSERTION(!objPrin || objPrin->GetPrincipal() == principal,
|
||||
"Principal mismatch. Expect bad things to happen");
|
||||
if (objPrin) {
|
||||
bool equal;
|
||||
if (!principal)
|
||||
equal = !objPrin->GetPrincipal();
|
||||
else
|
||||
principal->Equals(objPrin->GetPrincipal(), &equal);
|
||||
NS_ASSERTION(equal, "Principal mismatch. Expect bad things to happen");
|
||||
}
|
||||
#endif
|
||||
return principal;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user