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

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

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
Index: Source/bindings/core/v8/V8DOMWrapper.cpp
diff --git a/Source/bindings/core/v8/V8DOMWrapper.cpp b/Source/bindings/core/v8/V8DOMWrapper.cpp
index d1d463530fce504e16c7315e5d844489bfd81409..eb747326039c3202f7ea55492bf07d24f39a1585 100644
--- a/Source/bindings/core/v8/V8DOMWrapper.cpp
+++ b/Source/bindings/core/v8/V8DOMWrapper.cpp
@@ -34,6 +34,7 @@
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8HTMLCollection.h"
#include "bindings/core/v8/V8HTMLDocument.h"
+#include "bindings/core/v8/V8Location.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "bindings/core/v8/V8PerContextData.h"
#include "bindings/core/v8/V8PerIsolateData.h"
@@ -72,7 +73,12 @@ static v8::Local<v8::Object> wrapInShadowTemplate(v8::Local<v8::Object> wrapper,
v8::Local<v8::Object> V8DOMWrapper::createWrapper(v8::Isolate* isolate, v8::Local<v8::Object> creationContext, const WrapperTypeInfo* type, ScriptWrappable* scriptWrappable)
{
- V8WrapperInstantiationScope scope(creationContext, isolate);
+ ASSERT(!type->equals(&V8Window::wrapperTypeInfo));
+ // According to https://html.spec.whatwg.org/multipage/browsers.html#security-location,
+ // cross-origin script access to a few properties of Location is allowed.
+ // Location already implements the necessary security checks.
+ bool withSecurityCheck = !type->equals(&V8Location::wrapperTypeInfo);
+ V8WrapperInstantiationScope scope(creationContext, isolate, withSecurityCheck);
V8PerContextData* perContextData = V8PerContextData::from(scope.context());
v8::Local<v8::Object> wrapper;

Powered by Google App Engine
This is Rietveld 408576698