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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/methods.cpp

Issue 2209203002: binding: Always throws an exception in the current realm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro generate_method(method, world_suffix) %} 4 {% macro generate_method(method, world_suffix) %}
5 {% if method.returns_promise and method.has_exception_state %} 5 {% if method.returns_promise and method.has_exception_state %}
6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e) 6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e)
7 {% else %} 7 {% else %}
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
9 {% endif %} 9 {% endif %}
10 { 10 {
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 {######################################} 336 {######################################}
337 {% macro throw_minimum_arity_type_error(method, number_of_required_arguments) %} 337 {% macro throw_minimum_arity_type_error(method, number_of_required_arguments) %}
338 {% if method.has_exception_state %} 338 {% if method.has_exception_state %}
339 setMinimumArityTypeError(exceptionState, {{number_of_required_arguments}}, info. Length()); 339 setMinimumArityTypeError(exceptionState, {{number_of_required_arguments}}, info. Length());
340 {{propagate_error_with_exception_state(method)}} 340 {{propagate_error_with_exception_state(method)}}
341 {%- elif method.idl_type == 'Promise' %} 341 {%- elif method.idl_type == 'Promise' %}
342 v8SetReturnValue(info, ScriptPromise::rejectRaw(ScriptState::current(info.GetIso late()), {{create_minimum_arity_type_error_without_exception_state(method, numbe r_of_required_arguments)}})); 342 v8SetReturnValue(info, ScriptPromise::rejectRaw(ScriptState::current(info.GetIso late()), {{create_minimum_arity_type_error_without_exception_state(method, numbe r_of_required_arguments)}}));
343 return; 343 return;
344 {%- else %} 344 {%- else %}
345 V8ThrowException::throwException({{create_minimum_arity_type_error_without_excep tion_state(method, number_of_required_arguments)}}, info.GetIsolate()); 345 V8ThrowException::throwException(info.GetIsolate(), {{create_minimum_arity_type_ error_without_exception_state(method, number_of_required_arguments)}});
346 return; 346 return;
347 {%- endif %} 347 {%- endif %}
348 {%- endmacro %} 348 {%- endmacro %}
349 349
350 350
351 {######################################} 351 {######################################}
352 {% macro create_minimum_arity_type_error_without_exception_state(method, number_ of_required_arguments) %} 352 {% macro create_minimum_arity_type_error_without_exception_state(method, number_ of_required_arguments) %}
353 {% if method.is_constructor %} 353 {% if method.is_constructor %}
354 createMinimumArityTypeErrorForConstructor(info.GetIsolate(), "{{interface_name}} ", {{number_of_required_arguments}}, info.Length()) 354 createMinimumArityTypeErrorForConstructor(info.GetIsolate(), "{{interface_name}} ", {{number_of_required_arguments}}, info.Length())
355 {%- else %} 355 {%- else %}
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 if method.overloads else 697 if method.overloads else
698 method.runtime_enabled_function) %} 698 method.runtime_enabled_function) %}
699 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 699 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
700 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); 700 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration);
701 {% endfilter %}{# runtime_enabled() #} 701 {% endfilter %}{# runtime_enabled() #}
702 {% endfilter %}{# exposed() #} 702 {% endfilter %}{# exposed() #}
703 {% endfilter %}{# secure_context() #} 703 {% endfilter %}{# secure_context() #}
704 {% endfor %} 704 {% endfor %}
705 {% endif %} 705 {% endif %}
706 {%- endmacro %} 706 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698