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

Side by Side Diff: Source/bindings/templates/interface.cpp

Issue 211333004: Tidy up error reporting for calling-constructor-as-function. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: re-use failedToConstruct() in constructorNotCallableAsFunction(). Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 {##############################################################################} 813 {##############################################################################}
814 {% block constructor_callback %} 814 {% block constructor_callback %}
815 {% if constructors or has_custom_constructor or has_event_constructor %} 815 {% if constructors or has_custom_constructor or has_event_constructor %}
816 void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value> & info) 816 void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value> & info)
817 { 817 {
818 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); 818 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
819 {% if measure_as %} 819 {% if measure_as %}
820 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{ measure_as}}); 820 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{ measure_as}});
821 {% endif %} 821 {% endif %}
822 if (!info.IsConstructCall()) { 822 if (!info.IsConstructCall()) {
823 throwTypeError(ExceptionMessages::failedToConstruct("{{interface_name}}" , "Please use the 'new' operator, this DOM object constructor cannot be called a s a function."), info.GetIsolate()); 823 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("{{in terface_name}}"), info.GetIsolate());
824 return; 824 return;
825 } 825 }
826 826
827 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { 827 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
828 v8SetReturnValue(info, info.Holder()); 828 v8SetReturnValue(info, info.Holder());
829 return; 829 return;
830 } 830 }
831 831
832 {% if has_custom_constructor %} 832 {% if has_custom_constructor %}
833 {{v8_class}}::constructorCustom(info); 833 {{v8_class}}::constructorCustom(info);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 {% endfilter %} 1315 {% endfilter %}
1316 } 1316 }
1317 1317
1318 template<> 1318 template<>
1319 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1319 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1320 { 1320 {
1321 return toV8(impl, creationContext, isolate); 1321 return toV8(impl, creationContext, isolate);
1322 } 1322 }
1323 1323
1324 {% endblock %} 1324 {% endblock %}
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698