| Index: Source/bindings/templates/interface.cpp
|
| diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
|
| index 34d7d22266e047aa46d0329cbb8e5cbbdb6cc1e5..4e019f1c5fcfff652f5a4f8097ae7302934fd91b 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.custom_exposed_rules 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.custom_exposed_rules and
|
| not attribute.is_static %}
|
| {% filter conditional(attribute.conditional_string) %}
|
| if ({{attribute.runtime_enabled_function}}()) {
|
| @@ -1155,13 +1157,19 @@ 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 %}
|
| + ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationContext());
|
| +
|
| + {% for attribute in attributes if attribute.per_context_enabled_function or attribute.custom_exposed_rules %}
|
| + {% if attribute.per_context_enabled_function %}
|
| if ({{attribute.per_context_enabled_function}}(impl->document())) {
|
| + {% else %}
|
| + if (context && ({{attribute.custom_exposed_rules}})) {
|
| + {% endif %}
|
| static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
|
| {{attribute_configuration(attribute)}};
|
| V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate);
|
| @@ -1174,9 +1182,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 +1194,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.custom_exposed_rules}}))
|
| + 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 +1333,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;
|
| }
|
|
|