Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1461)

Unified Diff: Source/core/loader/FrameFetchContext.cpp

Issue 1009583003: Add CSP header for resources with an active policy (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add return statement to avoid compiler error Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FrameFetchContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameFetchContext.cpp
diff --git a/Source/core/loader/FrameFetchContext.cpp b/Source/core/loader/FrameFetchContext.cpp
index 2ff4516d9dd31350df7f2432cb91f7a2a676147a..49461f8c58f31fd5eae9fe16ae7d03a4a4bb77d2 100644
--- a/Source/core/loader/FrameFetchContext.cpp
+++ b/Source/core/loader/FrameFetchContext.cpp
@@ -662,6 +662,16 @@ void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest)
fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicString(String::number(frame()->view()->viewportWidth())));
}
+void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchRequest& fetchRequest)
+{
+ if (!document() || !frame())
+ return;
+
+ const ContentSecurityPolicy* csp = document()->contentSecurityPolicy();
+ if (csp->shouldSendCSPHeader(type))
+ fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active");
+}
+
DEFINE_TRACE(FrameFetchContext)
{
visitor->trace(m_document);
« no previous file with comments | « Source/core/loader/FrameFetchContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698