Index: third_party/WebKit/Source/bindings/templates/attributes.cpp |
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp b/third_party/WebKit/Source/bindings/templates/attributes.cpp |
index 89604a191368913c98024872a6205b5d2d9ea3b4..64b21da81ab04751f304240938485908eacf6caa 100644 |
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp |
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp |
@@ -11,6 +11,15 @@ const v8::PropertyCallbackInfo<v8::Value>& info |
const v8::FunctionCallbackInfo<v8::Value>& info |
{%- endif %}) |
{ |
+ {% if attribute.api_experiment_name %} |
+ String errorMessage; |
+ if (!Experiments::isApiEnabled(currentExecutionContext(info.GetIsolate()), "{{ attribute.api_experiment_name }}", errorMessage)) { |
+ v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
+ Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); |
+ document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
+ return; |
+ } |
+ {% endif %} |
{% if attribute.is_reflect and not attribute.is_url |
and attribute.idl_type == 'DOMString' and is_node |
and not attribute.is_implemented_in_private_script %} |
@@ -207,6 +216,15 @@ const v8::FunctionCallbackInfo<v8::Value>& info |
{% filter conditional(attribute.conditional_string) %} |
static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) |
{ |
+ {% if attribute.api_experiment_name %} |
Daniel Nishi
2015/12/16 21:42:03
I've replaced the is%sExperimentallyEnabled with t
|
+ String errorMessage; |
+ if (!Experiments::isApiEnabled(currentExecutionContext(info.GetIsolate()), "{{ attribute.api_experiment_name }}", errorMessage)) { |
+ v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); |
+ Document& document = *toDocument(currentExecutionContext(info.GetIsolate())); |
+ document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, errorMessage)); |
+ return; |
+ } |
+ {% endif %} |
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
{% if attribute.deprecate_as %} |
UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); |
@@ -467,8 +485,7 @@ bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame* |
{% if attribute.constructor_type %} |
{% set getter_callback = |
'%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attribute.name) |
- if attribute.needs_constructor_getter_callback else |
- 'v8ConstructorAttributeGetter' %} |
+ if attribute.needs_constructor_getter_callback else 'v8ConstructorAttributeGetter' %} |
{% set setter_callback = |
'%sV8Internal::%sAttributeSetterCallback' % (cpp_class_or_partial, attribute.name) |
if attribute.needs_constructor_setter_callback else |