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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp

Issue 2713413002: Blink bindings: use v8 to enforce method call access checks (Closed)
Patch Set: Restore comment Created 3 years, 10 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: third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
index 95225f5bf85372e9f5545a68e0975be3bb29d245..127ce2df9192e1a5ccfe15611cebc924ecb6e01f 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -348,6 +348,8 @@ void installMethodInternal(v8::Isolate* isolate,
v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(),
signature, method.length);
functionTemplate->RemovePrototype();
+ if (method.accessCheckConfiguration == V8DOMConfiguration::CheckAccess)
+ functionTemplate->SetAcceptAnyReceiver(false);
if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInstance)
instanceTemplate->Set(
name, functionTemplate,
@@ -358,13 +360,15 @@ void installMethodInternal(v8::Isolate* isolate,
static_cast<v8::PropertyAttribute>(method.attribute));
}
if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInterface) {
- // Operations installed on the interface object must be static
- // operations, so no need to specify a signature, i.e. no need to do
- // type check against a holder.
+ // Operations installed on the interface object must be static methods, so
+ // no need to specify a signature, i.e. no need to do type check against a
+ // holder.
v8::Local<v8::FunctionTemplate> functionTemplate =
v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(),
v8::Local<v8::Signature>(), method.length);
functionTemplate->RemovePrototype();
+ // Similarly, there is no need to do an access check for static methods, as
+ // there is no holder to check against.
interfaceTemplate->Set(
name, functionTemplate,
static_cast<v8::PropertyAttribute>(method.attribute));

Powered by Google App Engine
This is Rietveld 408576698