mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1143922 - Add AsyncOpen2 to nsIChannel and perform security checks when opening a channel - scriptSecurityManager changes (r=sicking,bholley)
This commit is contained in:
parent
036feb79ea
commit
733184dc1c
@ -336,6 +336,26 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
|
||||
NS_ADDREF(*aPrincipal = loadInfo->TriggeringPrincipal());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSecurityFlags securityFlags = loadInfo->GetSecurityMode();
|
||||
if (securityFlags == nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS ||
|
||||
securityFlags == nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS ||
|
||||
securityFlags == nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS) {
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal = loadInfo->TriggeringPrincipal();
|
||||
bool inheritForAboutBlank = loadInfo->GetAboutBlankInherits();
|
||||
|
||||
if (nsContentUtils::ChannelShouldInheritPrincipal(triggeringPrincipal,
|
||||
uri,
|
||||
inheritForAboutBlank,
|
||||
false)) {
|
||||
triggeringPrincipal.forget(aPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GetChannelURIPrincipal(aChannel, aPrincipal);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user