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

Unified Diff: Source/bindings/core/v8/V8DOMWrapper.h

Issue 1262353002: Add access checks to V8WrapperInstationScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update Created 5 years, 5 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 | « no previous file | Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698