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

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

Issue 413393003: Blink-in-JS: Implement internal APIs exposed only to private scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('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 afa5a3a135656c3f9d9e58db6c485b2dd7b1ce6d..5cb8c68af8edaae169dc95e4659bbb378d6d52b7 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -29,6 +29,7 @@
' | '.join(attribute.access_control_list) %}
{% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' %
' | '.join(attribute.property_attributes) %}
+{% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivateScript' if attribute.only_exposed_to_private_script else 'V8DOMConfiguration::ExposedToAllScripts' %}
{% set on_prototype = '1 /* on prototype */'
if interface_name == 'Window' and attribute.idl_type == 'EventHandler'
else '0 /* on instance */' %}
@@ -41,6 +42,7 @@
wrapper_type_info,
access_control,
property_attribute,
+ only_exposed_to_private_script,
] %}
{% if not attribute.is_expose_js_accessors %}
{% set attribute_configuration_list = attribute_configuration_list
@@ -57,7 +59,8 @@
{% set method_callback_for_main_world =
'%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class, method.name)
if method.is_per_world_bindings else '0' %}
-{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}}
+{% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivateScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::ExposedToAllScripts' %}
+{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}}
{%- endmacro %}
@@ -728,8 +731,7 @@ void {{v8_class}}::visitDOMWrapper(void* object, const v8::Persistent<v8::Object
{% if interface_name == 'Window' %}
static const V8DOMConfiguration::AttributeConfiguration shadowAttributes[] = {
{% for attribute in attributes if attribute.is_unforgeable %}
- {# FIXME: Expose [OnlyExposedToPrivateScript] attributes to window objects of private scripts #}
- {% if not attribute.only_exposed_to_private_script %}
+ {% if not attribute.is_implemented_in_private_script or not attribute.only_exposed_to_private_script %}
bashi 2014/07/25 07:57:42 nit: We check the same condition four times. We ma
haraken 2014/07/25 08:26:59 Done.
{{attribute_configuration(attribute)}},
{% endif %}
{% endfor %}
@@ -749,8 +751,7 @@ static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[]
attribute.runtime_enabled_function or
attribute.per_context_enabled_function or
(interface_name == 'Window' and attribute.is_unforgeable)) %}
- {# FIXME: Expose [OnlyExposedToPrivateScript] attributes to window objects of private scripts #}
- {% if not attribute.only_exposed_to_private_script %}
+ {% if not attribute.is_implemented_in_private_script or not attribute.only_exposed_to_private_script %}
bashi 2014/07/25 07:57:42 nit: Can we merge this to the above if?
haraken 2014/07/25 08:26:59 Done.
{% filter conditional(attribute.conditional_string) %}
{{attribute_configuration(attribute)}},
{% endfilter %}
@@ -767,8 +768,7 @@ static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[]
{% if has_accessors %}
static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
{% for attribute in attributes if attribute.is_expose_js_accessors %}
- {# FIXME: Expose [OnlyExposedToPrivateScript] attributes to window objects of private scripts #}
- {% if not attribute.only_exposed_to_private_script %}
+ {% if not attribute.is_implemented_in_private_script or not attribute.only_exposed_to_private_script %}
{{attribute_configuration(attribute)}},
{% endif %}
{% endfor %}
@@ -783,8 +783,7 @@ static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] =
{% if method_configuration_methods %}
static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
{% for method in method_configuration_methods %}
- {# FIXME: Expose [OnlyExposedToPrivateScript] methods to window objects of private scripts #}
- {% if not method.only_exposed_to_private_script %}
+ {% if not method.is_implemented_in_private_script or not method.only_exposed_to_private_script %}
bashi 2014/07/25 07:57:42 nit: We check this condition two times.
haraken 2014/07/25 08:26:59 Done.
{% filter conditional(method.conditional_string) %}
{{method_configuration(method)}},
{% endfilter %}
@@ -1060,7 +1059,7 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio
'static_cast<v8::PropertyAttribute>(%s)' %
' | '.join(method.property_attributes or ['v8::DontDelete']) %}
static const V8DOMConfiguration::AttributeConfiguration {{method.name}}OriginSafeAttributeConfiguration = {
- "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callback_for_main_world}}, {{setter_callback_for_main_world}}, &{{v8_class}}::wrapperTypeInfo, v8::ALL_CAN_READ, {{property_attribute}}, false
+ "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callback_for_main_world}}, {{setter_callback_for_main_world}}, &{{v8_class}}::wrapperTypeInfo, v8::ALL_CAN_READ, {{property_attribute}}, V8DOMConfiguration::ExposedToAllScripts, false,
};
V8DOMConfiguration::installAttribute({{method.function_template}}, v8::Handle<v8::ObjectTemplate>(), {{method.name}}OriginSafeAttributeConfiguration, isolate);
{%- endmacro %}
@@ -1075,7 +1074,7 @@ V8DOMConfiguration::installAttribute({{method.function_template}}, v8::Handle<v8
'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attributes)
if method.property_attributes else 'v8::None' %}
static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {
- "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}
+ "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, V8DOMConfiguration::ExposedToAllScripts,
};
V8DOMConfiguration::installMethodCustomSignature({{method.function_template}}, {{method.signature}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate);
{%- endmacro %}
« no previous file with comments | « Source/bindings/core/v8/V8DOMConfiguration.cpp ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698