Bug 1287073 - remove SEC_FORCE_INHERIT_PRINCIPAL_WAS_DROPPED from nsILoadInfo r=sicking

This commit is contained in:
Yoshi Huang 2016-07-18 14:35:13 +08:00
Родитель 706065f96d
Коммит 84039380cc
6 изменённых файлов: 29 добавлений и 13 удалений

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

@ -367,8 +367,7 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
// Check if SEC_FORCE_INHERIT_PRINCIPAL was dropped because of
// sandboxing:
if (loadInfo->GetLoadingSandboxed() &&
(loadInfo->GetSecurityFlags() &
nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL_WAS_DROPPED)) {
loadInfo->GetForceInheritPrincipalDropped()) {
forceInterit = true;
}
}

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

@ -251,6 +251,7 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
aLoadInfo->GetUpgradeInsecureRequests(),
aLoadInfo->GetVerifySignedContent(),
aLoadInfo->GetEnforceSRI(),
aLoadInfo->GetForceInheritPrincipalDropped(),
aLoadInfo->GetInnerWindowID(),
aLoadInfo->GetOuterWindowID(),
aLoadInfo->GetParentOuterWindowID(),
@ -317,6 +318,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
loadInfoArgs.upgradeInsecureRequests(),
loadInfoArgs.verifySignedContent(),
loadInfoArgs.enforceSRI(),
loadInfoArgs.forceInheritPrincipalDropped(),
loadInfoArgs.innerWindowID(),
loadInfoArgs.outerWindowID(),
loadInfoArgs.parentOuterWindowID(),

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

@ -51,6 +51,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
, mUpgradeInsecureRequests(false)
, mVerifySignedContent(false)
, mEnforceSRI(false)
, mForceInheritPrincipalDropped(false)
, mInnerWindowID(0)
, mOuterWindowID(0)
, mParentOuterWindowID(0)
@ -91,7 +92,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
// if the load is sandboxed, we can not also inherit the principal
if (mSecurityFlags & nsILoadInfo::SEC_SANDBOXED) {
mSecurityFlags ^= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
mSecurityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL_WAS_DROPPED;
mForceInheritPrincipalDropped = true;
}
if (aLoadingContext) {
@ -204,6 +205,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
, mUpgradeInsecureRequests(false)
, mVerifySignedContent(false)
, mEnforceSRI(false)
, mForceInheritPrincipalDropped(false)
, mInnerWindowID(0)
, mOuterWindowID(0)
, mParentOuterWindowID(0)
@ -222,7 +224,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
// if the load is sandboxed, we can not also inherit the principal
if (mSecurityFlags & nsILoadInfo::SEC_SANDBOXED) {
mSecurityFlags ^= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
mSecurityFlags |= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL_WAS_DROPPED;
mForceInheritPrincipalDropped = true;
}
// NB: Ignore the current inner window since we're navigating away from it.
@ -251,6 +253,7 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
, mUpgradeInsecureRequests(rhs.mUpgradeInsecureRequests)
, mVerifySignedContent(rhs.mVerifySignedContent)
, mEnforceSRI(rhs.mEnforceSRI)
, mForceInheritPrincipalDropped(rhs.mForceInheritPrincipalDropped)
, mInnerWindowID(rhs.mInnerWindowID)
, mOuterWindowID(rhs.mOuterWindowID)
, mParentOuterWindowID(rhs.mParentOuterWindowID)
@ -276,6 +279,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
bool aUpgradeInsecureRequests,
bool aVerifySignedContent,
bool aEnforceSRI,
bool aForceInheritPrincipalDropped,
uint64_t aInnerWindowID,
uint64_t aOuterWindowID,
uint64_t aParentOuterWindowID,
@ -297,6 +301,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
, mUpgradeInsecureRequests(aUpgradeInsecureRequests)
, mVerifySignedContent(aVerifySignedContent)
, mEnforceSRI(aEnforceSRI)
, mForceInheritPrincipalDropped(aForceInheritPrincipalDropped)
, mInnerWindowID(aInnerWindowID)
, mOuterWindowID(aOuterWindowID)
, mParentOuterWindowID(aParentOuterWindowID)
@ -576,6 +581,13 @@ LoadInfo::GetEnforceSRI(bool* aResult)
return NS_OK;
}
NS_IMETHODIMP
LoadInfo::GetForceInheritPrincipalDropped(bool* aResult)
{
*aResult = mForceInheritPrincipalDropped;
return NS_OK;
}
NS_IMETHODIMP
LoadInfo::GetInnerWindowID(uint64_t* aResult)
{

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

@ -92,6 +92,7 @@ private:
bool aUpgradeInsecureRequests,
bool aVerifySignedContent,
bool aEnforceSRI,
bool aForceInheritPrincipalDropped,
uint64_t aInnerWindowID,
uint64_t aOuterWindowID,
uint64_t aParentOuterWindowID,
@ -132,6 +133,7 @@ private:
bool mUpgradeInsecureRequests;
bool mVerifySignedContent;
bool mEnforceSRI;
bool mForceInheritPrincipalDropped;
uint64_t mInnerWindowID;
uint64_t mOuterWindowID;
uint64_t mParentOuterWindowID;

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

@ -124,7 +124,7 @@ interface nsILoadInfo : nsISupports
* This flag can not be used together with SEC_SANDBOXED. If both are passed
* to the LoadInfo constructor then this flag will be dropped. If you need
* to know whether this flag would have been present but was dropped due to
* sandboxing, check for the SEC_FORCE_INHERIT_PRINCIPAL_WAS_DROPPED flag.
* sandboxing, check for the forceInheritPrincipalDropped flag.
*/
const unsigned long SEC_FORCE_INHERIT_PRINCIPAL = (1<<7);
@ -177,14 +177,6 @@ interface nsILoadInfo : nsISupports
*/
const unsigned long SEC_FORCE_PRIVATE_BROWSING = (1<<13);
/**
* The SEC_FORCE_INHERIT_PRINCIPAL flag may be dropped when a load info
* object is created. Specifically, it will be dropped if the SEC_SANDBOXED
* flag is also present. This flag is set if SEC_FORCE_INHERIT_PRINCIPAL was
* dropped.
*/
const unsigned long SEC_FORCE_INHERIT_PRINCIPAL_WAS_DROPPED = (1<<14);
/**
* The loadingPrincipal is the principal that is responsible for the load.
* It is *NOT* the principal tied to the resource/URI that this
@ -391,6 +383,14 @@ interface nsILoadInfo : nsISupports
*/
[infallible] attribute boolean enforceSRI;
/**
* The SEC_FORCE_INHERIT_PRINCIPAL flag may be dropped when a load info
* object is created. Specifically, it will be dropped if the SEC_SANDBOXED
* flag is also present. This flag is set if SEC_FORCE_INHERIT_PRINCIPAL was
* dropped.
*/
[infallible] readonly attribute boolean forceInheritPrincipalDropped;
/**
* These are the window IDs of the window in which the element being
* loaded lives. parentOuterWindowID is the window ID of this window's

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

@ -36,6 +36,7 @@ struct LoadInfoArgs
bool upgradeInsecureRequests;
bool verifySignedContent;
bool enforceSRI;
bool forceInheritPrincipalDropped;
uint64_t innerWindowID;
uint64_t outerWindowID;
uint64_t parentOuterWindowID;