Index: Source/bindings/templates/interface.cpp |
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp |
index 34d7d22266e047aa46d0329cbb8e5cbbdb6cc1e5..bfd02d84e77d82c85650192489eb994f9ea2e2d8 100644 |
--- a/Source/bindings/templates/interface.cpp |
+++ b/Source/bindings/templates/interface.cpp |
@@ -560,7 +560,7 @@ static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::String> na |
if is_active_dom_object else '0' %} |
{% set to_event_target = '%s::toEventTarget' % v8_class |
if is_event_target else '0' %} |
-const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_active_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} }; |
+const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_active_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installConditionallyEnabledMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} }; |
{{generate_constructor(named_constructor)}} |
v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate* isolate) |
@@ -748,6 +748,7 @@ static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] |
attribute.is_static or |
attribute.runtime_enabled_function or |
attribute.per_context_enabled_function or |
+ attribute.exposed_test or |
(interface_name == 'Window' and attribute.is_unforgeable)) |
and attribute.should_be_exposed_to_script %} |
{% filter conditional(attribute.conditional_string) %} |
@@ -922,6 +923,7 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio |
{% for attribute in attributes |
if attribute.runtime_enabled_function and |
not attribute.per_context_enabled_function and |
+ not attribute.exposed_test and |
not attribute.is_static %} |
{% filter conditional(attribute.conditional_string) %} |
if ({{attribute.runtime_enabled_function}}()) { |
@@ -1155,17 +1157,21 @@ v8::Handle<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Handle<v8: |
{##############################################################################} |
-{% block install_per_context_attributes %} |
-{% if has_per_context_enabled_attributes %} |
-void {{v8_class}}::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceTemplate, {{cpp_class}}* impl, v8::Isolate* isolate) |
+{% block install_conditional_attributes %} |
+{% if has_conditional_attributes %} |
+void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceTemplate, {{cpp_class}}* impl, v8::Isolate* isolate) |
{ |
v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instanceTemplate->GetPrototype()); |
- {% for attribute in attributes if attribute.per_context_enabled_function %} |
- if ({{attribute.per_context_enabled_function}}(impl->document())) { |
- static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
- {{attribute_configuration(attribute)}}; |
- V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
- } |
+ ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationContext()); |
+ |
+ {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} |
+ {% filter per_context_enabled(attribute.per_context_enabled_function) %} |
+ {% filter exposed(attribute.exposed_test) %} |
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
+ {{attribute_configuration(attribute)}}; |
+ V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
+ {% endfilter %} |
+ {% endfilter %} |
{% endfor %} |
} |
@@ -1174,9 +1180,9 @@ void {{v8_class}}::installPerContextEnabledProperties(v8::Handle<v8::Object> ins |
{##############################################################################} |
-{% block install_per_context_methods %} |
-{% if per_context_enabled_methods %} |
-void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> prototypeTemplate, v8::Isolate* isolate) |
+{% block install_conditional_methods %} |
+{% if has_conditional_methods %} |
+void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeTemplate, v8::Isolate* isolate) |
{ |
{# Define per-context enabled operations #} |
v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate)); |
@@ -1186,6 +1192,10 @@ void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot |
if (context && context->isDocument() && {{method.per_context_enabled_function}}(toDocument(context))) |
prototypeTemplate->Set(v8AtomicString(isolate, "{{method.name}}"), v8::FunctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction()); |
{% endfor %} |
+ {% for method in conditionally_exposed_methods %} |
+ if (context && ({{method.exposed_test}})) |
+ prototypeTemplate->Set(v8AtomicString(isolate, "{{method.name}}"), v8::FunctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction()); |
+ {% endfor %} |
} |
{% endif %} |
@@ -1321,7 +1331,7 @@ v8::Handle<v8::Object> {{v8_class}}::createWrapper({{pass_cpp_type}} impl, v8::H |
channelData->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate()); |
} |
{% endif %} |
- installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
+ installConditionallyEnabledProperties(wrapper, impl.get(), isolate); |
V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl, &wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}}); |
return wrapper; |
} |