diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-22 11:47:32 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-22 11:47:32 +0100 |
commit | 7b7ea5c59a6f282be1d02a199f46483447ec00c1 (patch) | |
tree | 8687a74d52001a48b616a8fc30e3ada54d19cb0c /dom/security/nsCSPContext.cpp | |
parent | b7274fd666e1bb33effc1425701f566bcaa6f7be (diff) | |
parent | cff4a7d0b65b9cfe272d72f7a26e3dcc33ea0a03 (diff) | |
download | UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar.gz UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar.lz UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.tar.xz UXP-7b7ea5c59a6f282be1d02a199f46483447ec00c1.zip |
Merge branch 'ported-moebius'
Diffstat (limited to 'dom/security/nsCSPContext.cpp')
-rw-r--r-- | dom/security/nsCSPContext.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/dom/security/nsCSPContext.cpp b/dom/security/nsCSPContext.cpp index 815c7734d..5e435d4ca 100644 --- a/dom/security/nsCSPContext.cpp +++ b/dom/security/nsCSPContext.cpp @@ -156,10 +156,13 @@ nsCSPContext::ShouldLoad(nsContentPolicyType aContentType, nsAutoString nonce; bool parserCreated = false; if (!isPreload) { - nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(aRequestContext); - if (htmlElement) { - rv = htmlElement->GetAttribute(NS_LITERAL_STRING("nonce"), nonce); - NS_ENSURE_SUCCESS(rv, rv); + if (aContentType == nsIContentPolicy::TYPE_SCRIPT || + aContentType == nsIContentPolicy::TYPE_STYLESHEET) { + nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(aRequestContext); + if (htmlElement) { + rv = htmlElement->GetAttribute(NS_LITERAL_STRING("nonce"), nonce); + NS_ENSURE_SUCCESS(rv, rv); + } } nsCOMPtr<nsIScriptElement> script = do_QueryInterface(aRequestContext); @@ -343,6 +346,20 @@ nsCSPContext::GetBlockAllMixedContent(bool *outBlockAllMixedContent) } NS_IMETHODIMP +nsCSPContext::GetEnforcesFrameAncestors(bool *outEnforcesFrameAncestors) +{ + *outEnforcesFrameAncestors = false; + for (uint32_t i = 0; i < mPolicies.Length(); i++) { + if (!mPolicies[i]->getReportOnlyFlag() && + mPolicies[i]->hasDirective(nsIContentSecurityPolicy::FRAME_ANCESTORS_DIRECTIVE)) { + *outEnforcesFrameAncestors = true; + return NS_OK; + } + } + return NS_OK; +} + +NS_IMETHODIMP nsCSPContext::GetReferrerPolicy(uint32_t* outPolicy, bool* outIsSet) { *outIsSet = false; |