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

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

Issue 27073003: CSP Suborigins Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test fixes 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
Index: Source/core/dom/ExecutionContext.cpp
diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
index 5abde3878489ee2166a8fe0a3988a17fbe8b2a69..ed79927892bebb3e3743430203b92859f454e8d1 100644
--- a/Source/core/dom/ExecutionContext.cpp
+++ b/Source/core/dom/ExecutionContext.cpp
@@ -37,6 +37,7 @@
#include "core/page/WindowFocusAllowedIndicator.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerThread.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/MainThread.h"
namespace blink {
@@ -226,6 +227,20 @@ bool ExecutionContext::isWindowInteractionAllowed() const
return m_windowInteractionTokens > 0 || WindowFocusAllowedIndicator::windowFocusAllowed();
}
+// |name| should be non-empty, and this should be enforced by parsing.
+void ExecutionContext::enforceSuborigin(const String& name)
+{
+ if (name.isNull())
+ return;
+ ASSERT(!name.isEmpty());
+ ASSERT(RuntimeEnabledFeatures::suboriginsEnabled());
+ SecurityOrigin* origin = securityContext().securityOrigin();
+ ASSERT(origin);
+ ASSERT(!origin->hasSuborigin() || origin->suboriginName() == name);
Mike West 2015/03/23 07:32:55 ASSERTing here means that `Content-Security-Policy
jww 2015/04/11 02:52:36 It should never get to that point. In the assignme
+ origin->addSuborigin(name);
+ securityContext().didUpdateSecurityOrigin();
+}
+
DEFINE_TRACE(ExecutionContext)
{
#if ENABLE(OILPAN)

Powered by Google App Engine
This is Rietveld 408576698