Chromium Code Reviews| 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) |
|
Yuki
2015/07/30 11:00:54
The style guide recommends an enum value.
https://
|
| : 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/07/30 10:43:36
Would you help me understand why we want to enable
|
| + // If the context is different, we need to make sure that the current |
| + // context has access to the creation context. |
| + if (!m_context.IsEmpty()) { |
|
haraken
2015/07/30 10:43:36
m_context shouldn't be empty here.
|
| + Frame* frame = toFrameIfNotDetached(contextForWrapper); |
| + RELEASE_ASSERT(!frame || BindingSecurity::shouldAllowAccessToFrame(isolate, frame, DoNotReportSecurityError)); |
|
haraken
2015/07/30 10:43:36
Just to confirm: This will allow a wrapper creatio
|
| + } |
| + } |
| m_context = v8::Local<v8::Context>::New(isolate, contextForWrapper); |
| m_didEnterContext = true; |
| m_context->Enter(); |