Index: Source/core/dom/ExecutionContext.cpp |
diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp |
index d08002ec5d244d04c2598381d4997616bbe716a9..401cc8ffa345c5479dbe87e13a04a0da5ce22bdc 100644 |
--- a/Source/core/dom/ExecutionContext.cpp |
+++ b/Source/core/dom/ExecutionContext.cpp |
@@ -38,6 +38,7 @@ |
#include "core/inspector/ScriptCallStack.h" |
#include "core/workers/WorkerGlobalScope.h" |
#include "core/workers/WorkerThread.h" |
+#include "platform/RuntimeEnabledFeatures.h" |
#include "wtf/MainThread.h" |
namespace blink { |
@@ -235,6 +236,16 @@ KURL ExecutionContext::completeURL(const String& url) const |
return virtualCompleteURL(url); |
} |
+bool ExecutionContext::hasSuborigin() |
+{ |
+ return securityContext().securityOrigin()->hasSuborigin(); |
+} |
+ |
+String ExecutionContext::suboriginName() |
+{ |
+ return securityContext().securityOrigin()->suboriginName(); |
+} |
+ |
void ExecutionContext::allowWindowInteraction() |
{ |
++m_windowInteractionTokens; |
@@ -267,6 +278,20 @@ void ExecutionContext::removeURLFromMemoryCache(const KURL& url) |
memoryCache()->removeURLFromCache(url); |
} |
+// |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); |
+ origin->addSuborigin(name); |
+ securityContext().didUpdateSecurityOrigin(); |
+} |
+ |
DEFINE_TRACE(ExecutionContext) |
{ |
#if ENABLE(OILPAN) |