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

Unified Diff: Source/core/dom/ExecutionContext.cpp

Issue 1117203002: Enforce referrer policies for workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix layout test indentation Created 5 years, 8 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/dom/ExecutionContext.h ('k') | Source/core/frame/csp/ContentSecurityPolicy.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ExecutionContext.cpp
diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
index a559d1c459d0b23cf46a16752ff19ece544d013a..7e21b2bdb2f83d199f61ddf330202f6e21130f65 100644
--- a/Source/core/dom/ExecutionContext.cpp
+++ b/Source/core/dom/ExecutionContext.cpp
@@ -32,6 +32,7 @@
#include "core/events/ErrorEvent.h"
#include "core/events/EventTarget.h"
#include "core/fetch/MemoryCache.h"
+#include "core/frame/UseCounter.h"
#include "core/html/PublicURLManager.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/ScriptCallStack.h"
@@ -73,6 +74,7 @@ ExecutionContext::ExecutionContext()
, m_strictMixedContentCheckingEnforced(false)
, m_windowInteractionTokens(0)
, m_isRunSuspendableTasksScheduled(false)
+ , m_referrerPolicy(ReferrerPolicyDefault)
{
}
@@ -248,6 +250,16 @@ bool ExecutionContext::isWindowInteractionAllowed() const
return m_windowInteractionTokens > 0;
}
+void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy)
+{
+ // FIXME: Can we adopt the CSP referrer policy merge algorithm? Or does the web rely on being able to modify the referrer policy in-flight?
+ UseCounter::count(this, UseCounter::SetReferrerPolicy);
+ if (m_referrerPolicy != ReferrerPolicyDefault)
+ UseCounter::count(this, UseCounter::ResetReferrerPolicy);
+
+ m_referrerPolicy = referrerPolicy;
+}
+
void ExecutionContext::removeURLFromMemoryCache(const KURL& url)
{
memoryCache()->removeURLFromCache(url);
« no previous file with comments | « Source/core/dom/ExecutionContext.h ('k') | Source/core/frame/csp/ContentSecurityPolicy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698