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

Unified Diff: Source/bindings/templates/interface.cpp

Issue 61523003: IDL compiler: [CheckSecurity=Frame] interfaces (initial) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 years, 1 month 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 | « Source/bindings/scripts/unstable/v8_methods.py ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/interface.cpp
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
index fb4ac2b50a6888caa821791479fb8ccc13c105cc..d131de3a22a14497346f7b7ee58b668407bf4b85 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -79,6 +79,25 @@ static void {{interface_name}}ReplaceableAttributeSetterCallback(v8::Local<v8::S
{##############################################################################}
+{% block security_check_functions %}
+{% if is_check_security and interface_name != 'Window' %}
+bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>)
+{
+ {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(host);
+ return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecurityError);
+}
+
+bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
+{
+ {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(host);
+ return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSecurityError);
+}
+
+{% endif %}
+{% endblock %}
+
+
+{##############################################################################}
{% block class_attributes %}
{# FIXME: rename to install_attributes and put into configure_class_template #}
{% if attributes %}
@@ -115,13 +134,9 @@ static const V8DOMConfiguration::AccessorConfiguration {{v8_class_name}}Accessor
{##############################################################################}
{% block class_methods %}
{# FIXME: rename to install_methods and put into configure_class_template #}
-{% if methods %}
+{% if has_method_configuration %}
static const V8DOMConfiguration::MethodConfiguration {{v8_class_name}}Methods[] = {
- {% for method in methods
- if method.do_not_check_signature and
- not method.per_context_enabled_function_name and
- (not method.overload_index or method.overload_index == 1) %}
- {# For overloaded methods, only generate one accessor #}
+ {% for method in methods if method.do_generate_method_configuration %}
{% filter conditional(method.conditional_string) %}
{{method_configuration(method)}},
{% endfilter %}
@@ -153,7 +168,7 @@ static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
{% set methods_name, methods_length =
('%sMethods' % v8_class_name,
'WTF_ARRAY_LENGTH(%sMethods)' % v8_class_name)
- if methods else (0, 0) %}
+ if has_method_configuration else (0, 0) %}
{{attributes_name}}, {{attributes_length}},
{{accessors_name}}, {{accessors_length}},
{{methods_name}}, {{methods_length}},
@@ -163,6 +178,9 @@ static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
UNUSED_PARAM(instanceTemplate);
UNUSED_PARAM(prototypeTemplate);
+ {% if is_check_security and interface_name != 'Window' %}
+ instanceTemplate->SetAccessCheckCallbacks({{cpp_class_name}}V8Internal::namedSecurityCheck, {{cpp_class_name}}V8Internal::indexedSecurityCheck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class_name}}::wrapperTypeInfo)));
+ {% endif %}
{% for attribute in attributes if attribute.runtime_enabled_function_name %}
{% filter conditional(attribute.conditional_string) %}
if ({{attribute.runtime_enabled_function_name}}()) {
« no previous file with comments | « Source/bindings/scripts/unstable/v8_methods.py ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698