diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-06-21 20:56:16 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-06-21 20:56:16 +0200 |
commit | 3f8a6e25520c76304db649c971fe8284bc9c9ab7 (patch) | |
tree | 8fc4a0b9cac50602b7159eef7e0bf05bd6190a05 /netwerk/base/LoadInfo.cpp | |
parent | 2546ae588f7131bf2879af4ed6094a96025f1a27 (diff) | |
download | UXP-3f8a6e25520c76304db649c971fe8284bc9c9ab7.tar UXP-3f8a6e25520c76304db649c971fe8284bc9c9ab7.tar.gz UXP-3f8a6e25520c76304db649c971fe8284bc9c9ab7.tar.lz UXP-3f8a6e25520c76304db649c971fe8284bc9c9ab7.tar.xz UXP-3f8a6e25520c76304db649c971fe8284bc9c9ab7.zip |
CSP: Support for "LoadInfo::GetLoadingContext" and "LoadInfo::GetLoadingContextXPCOM()"
https://bugzilla.mozilla.org/show_bug.cgi?id=1439713 (partially)
Diffstat (limited to 'netwerk/base/LoadInfo.cpp')
-rw-r--r-- | netwerk/base/LoadInfo.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp index a8c9a5a25..ebe9d4703 100644 --- a/netwerk/base/LoadInfo.cpp +++ b/netwerk/base/LoadInfo.cpp @@ -81,7 +81,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal, // This constructor shouldn't be used for TYPE_DOCUMENT loads that don't // have a loadingPrincipal - MOZ_ASSERT(skipContentTypeCheck || + MOZ_ASSERT(skipContentTypeCheck || mLoadingPrincipal || mInternalContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT); // TODO(bug 1259873): Above, we initialize mIsThirdPartyContext to false meaning @@ -493,6 +493,27 @@ LoadInfo::ContextForTopLevelLoad() return context; } +already_AddRefed<nsISupports> +LoadInfo::GetLoadingContext() +{ + nsCOMPtr<nsISupports> context; + if (mInternalContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) { + context = ContextForTopLevelLoad(); + } + else { + context = LoadingNode(); + } + return context.forget(); +} + +NS_IMETHODIMP +LoadInfo::GetLoadingContextXPCOM(nsISupports** aResult) +{ + nsCOMPtr<nsISupports> context = GetLoadingContext(); + context.forget(aResult); + return NS_OK; +} + NS_IMETHODIMP LoadInfo::GetSecurityFlags(nsSecurityFlags* aResult) { |