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

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

Issue 767313003: IDL dictionary: Throw a TypeError when an interface member conversion fails (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "{{v8_original_class}}.h" 8 #include "{{v8_original_class}}.h"
9 9
10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} 10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %}
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Do nothing. 45 // Do nothing.
46 {% if member.is_nullable %} 46 {% if member.is_nullable %}
47 } else if ({{member.name}}Value->IsNull()) { 47 } else if ({{member.name}}Value->IsNull()) {
48 impl.{{member.null_setter_name}}(); 48 impl.{{member.null_setter_name}}();
49 {% endif %} 49 {% endif %}
50 } else { 50 } else {
51 {% if member.use_output_parameter_for_result %} 51 {% if member.use_output_parameter_for_result %}
52 {{member.cpp_type}} {{member.name}}; 52 {{member.cpp_type}} {{member.name}};
53 {% endif %} 53 {% endif %}
54 {{member.v8_value_to_local_cpp_value}}; 54 {{member.v8_value_to_local_cpp_value}};
55 {% if member.is_interface_type %}
56 if (!{{member.name}} && !{{member.name}}Value->IsNull()) {
57 exceptionState.throwTypeError("member {{member.name}} is not of type {{member.idl_type}}.");
58 return;
59 }
60 {% endif %}
55 {% if member.enum_validation_expression %} 61 {% if member.enum_validation_expression %}
56 String string = {{member.name}}; 62 String string = {{member.name}};
57 if (!({{member.enum_validation_expression}})) { 63 if (!({{member.enum_validation_expression}})) {
58 exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); 64 exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value.");
59 return; 65 return;
60 } 66 }
61 {% elif member.is_object %} 67 {% elif member.is_object %}
62 if (!{{member.name}}.isObject()) { 68 if (!{{member.name}}.isObject()) {
63 exceptionState.throwTypeError("member {{member.name}} is not an obje ct."); 69 exceptionState.throwTypeError("member {{member.name}} is not an obje ct.");
64 return; 70 return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 104 }
99 105
100 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(const v8::Handle<v8: :Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) 106 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(const v8::Handle<v8: :Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
101 { 107 {
102 {{cpp_class}} impl; 108 {{cpp_class}} impl;
103 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); 109 {{v8_class}}::toImpl(isolate, value, impl, exceptionState);
104 return impl; 110 return impl;
105 } 111 }
106 112
107 } // namespace blink 113 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698