Bug 1162772, part 2 - Expose whether SEC_FORCE_INHERIT_PRINCIPAL was dropped from an nsILoadInfo. r=bz

MozReview-Commit-ID: 5Em9qXwDUIJ
This commit is contained in:
Jonathan Watt 2016-04-28 11:13:09 +01:00
Родитель 25b4d58e2a
Коммит 0fde17d689
2 изменённых файлов: 14 добавлений и 1 удалений

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

@ -88,6 +88,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;
}
if (aLoadingContext) {
@ -194,6 +195,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;
}
// NB: Ignore the current inner window since we're navigating away from it.

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

@ -118,7 +118,10 @@ interface nsILoadInfo : nsISupports
* is loading the URI "http://b.com/whatever", GetChannelResultPrincipal
* will return a principal from "http://a.com/".
*
* This flag can not be used together with SEC_SANDBOXED.
* 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.
*/
const unsigned long SEC_FORCE_INHERIT_PRINCIPAL = (1<<7);
@ -166,6 +169,14 @@ interface nsILoadInfo : nsISupports
*/
const unsigned long SEC_FORCE_PRIVATE_BROWSING = (1<<12);
/**
* 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<<13);
/**
* The loadingPrincipal is the principal that is responsible for the load.
* It is *NOT* the principal tied to the resource/URI that this