Index: Source/bindings/core/v8/V8DOMWrapper.h |
diff --git a/Source/bindings/core/v8/V8DOMWrapper.h b/Source/bindings/core/v8/V8DOMWrapper.h |
index dbe68a1b08316e3db33ceddd845530c2240cfbf1..5dbad6421e53b62438ee54db2596748a48f742a9 100644 |
--- a/Source/bindings/core/v8/V8DOMWrapper.h |
+++ b/Source/bindings/core/v8/V8DOMWrapper.h |
@@ -31,8 +31,10 @@ |
#ifndef V8DOMWrapper_h |
#define V8DOMWrapper_h |
+#include "bindings/core/v8/BindingSecurity.h" |
#include "bindings/core/v8/DOMDataStore.h" |
#include "bindings/core/v8/ScriptWrappable.h" |
+#include "bindings/core/v8/V8Binding.h" |
#include "wtf/PassRefPtr.h" |
#include "wtf/RawPtr.h" |
#include "wtf/text/AtomicString.h" |
@@ -106,7 +108,7 @@ inline v8::Local<v8::Object> V8DOMWrapper::associateObjectWithWrapper(v8::Isolat |
class V8WrapperInstantiationScope { |
public: |
- V8WrapperInstantiationScope(v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
+ V8WrapperInstantiationScope(v8::Local<v8::Object> creationContext, v8::Isolate* isolate, bool withSecurityCheck = true) |
: m_didEnterContext(false) |
, m_context(isolate->GetCurrentContext()) |
{ |
@@ -119,6 +121,14 @@ public: |
// is different from the context that we are about to enter. |
if (contextForWrapper == m_context) |
return; |
+ if (withSecurityCheck) { |
haraken
2015/09/08 08:48:07
This code should be in a slow path. Can we move th
epertoso
2015/09/08 09:29:35
Done.
|
+ // If the context is different, we need to make sure that the current |
+ // context has access to the creation context. |
+ if (!m_context.IsEmpty()) { |
+ Frame* frame = toFrameIfNotDetached(contextForWrapper); |
+ RELEASE_ASSERT(!frame || BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoNotReportSecurityError)); |
+ } |
+ } |
m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper); |
m_didEnterContext = true; |
m_context->Enter(); |