| OLD | NEW |
| 1 {% filter format_blink_cpp_source_code %} | 1 {% filter format_blink_cpp_source_code %} |
| 2 | 2 |
| 3 {% include 'copyright_block.txt' %} | 3 {% include 'copyright_block.txt' %} |
| 4 #include "{{v8_class_or_partial}}.h" | 4 #include "{{v8_class_or_partial}}.h" |
| 5 | 5 |
| 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} | 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} |
| 7 #include "{{filename}}" | 7 #include "{{filename}}" |
| 8 {% endfor %} | 8 {% endfor %} |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 {% endif %}{# not is_partial #} | 78 {% endif %}{# not is_partial #} |
| 79 {% if not is_array_buffer_or_view %} | 79 {% if not is_array_buffer_or_view %} |
| 80 namespace {{cpp_class_or_partial}}V8Internal { | 80 namespace {{cpp_class_or_partial}}V8Internal { |
| 81 {% if has_partial_interface %} | 81 {% if has_partial_interface %} |
| 82 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 82 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
| 83 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba
ckInfo<v8::Value>&) = 0; | 83 static void (*{{method.name}}MethodForPartialInterface)(const v8::FunctionCallba
ckInfo<v8::Value>&) = 0; |
| 84 {% endfor %} | 84 {% endfor %} |
| 85 {% endif %} | 85 {% endif %} |
| 86 | 86 |
| 87 {# Constants #} | 87 {##############################################################################} |
| 88 {% from 'constants.cpp.tmpl' import constant_getter_callback | |
| 89 with context %} | |
| 90 {% for constant in constants | has_special_getter %} | |
| 91 {{constant_getter_callback(constant)}} | |
| 92 {% endfor %} | |
| 93 {# Attributes #} | 88 {# Attributes #} |
| 94 {##############################################################################} | |
| 95 {% from 'attributes.cpp.tmpl' import constructor_getter_callback, | 89 {% from 'attributes.cpp.tmpl' import constructor_getter_callback, |
| 96 attribute_getter, attribute_getter_callback, | 90 attribute_getter, attribute_getter_callback, |
| 97 attribute_setter, attribute_setter_callback, | 91 attribute_setter, attribute_setter_callback, |
| 98 attribute_cache_property_callback, | 92 attribute_cache_property_callback, |
| 99 with context %} | 93 with context %} |
| 100 {% for attribute in attributes %} | 94 {% for attribute in attributes %} |
| 101 {% if attribute.is_cached_accessor %} | |
| 102 {{attribute_cache_property_callback(attribute)}} | |
| 103 {% endif %} | |
| 104 {% for world_suffix in attribute.world_suffixes %} | 95 {% for world_suffix in attribute.world_suffixes %} |
| 105 {% if not attribute.has_custom_getter and not attribute.constructor_type %} | 96 {% if not attribute.has_custom_getter and not attribute.constructor_type %} |
| 106 {{attribute_getter(attribute, world_suffix)}} | 97 {{attribute_getter(attribute, world_suffix)}} |
| 107 {% endif %} | 98 {% endif %} |
| 108 {% if not attribute.constructor_type %} | 99 {% if attribute.has_setter and not attribute.has_custom_setter %} |
| 109 {{attribute_getter_callback(attribute, world_suffix)}} | |
| 110 {% elif attribute.needs_constructor_getter_callback %} | |
| 111 {{constructor_getter_callback(attribute, world_suffix)}} | |
| 112 {% endif %} | |
| 113 {% if attribute.has_setter %} | |
| 114 {% if not attribute.has_custom_setter %} | |
| 115 {{attribute_setter(attribute, world_suffix)}} | 100 {{attribute_setter(attribute, world_suffix)}} |
| 116 {% endif %} | 101 {% endif %} |
| 117 {{attribute_setter_callback(attribute, world_suffix)}} | |
| 118 {% endif %} | |
| 119 {% endfor %} | 102 {% endfor %} |
| 120 {% endfor %} | 103 {% endfor %} |
| 121 {##############################################################################} | 104 {##############################################################################} |
| 122 {# Methods #} | 105 {# Methods #} |
| 123 {% from 'methods.cpp.tmpl' import generate_method, overload_resolution_method, | 106 {% from 'methods.cpp.tmpl' import generate_method, overload_resolution_method, |
| 124 method_callback, origin_safe_method_getter, generate_constructor, | 107 origin_safe_method_getter, generate_constructor, |
| 125 generate_post_message_impl, runtime_determined_length_method, | 108 generate_post_message_impl, runtime_determined_length_method, |
| 126 runtime_determined_maxarg_method | 109 runtime_determined_maxarg_method |
| 127 with context %} | 110 with context %} |
| 128 {% for method in methods %} | 111 {% for method in methods %} |
| 129 {% for world_suffix in method.world_suffixes %} | 112 {% for world_suffix in method.world_suffixes %} |
| 130 {% if not method.is_custom and not method.is_post_message and method.visible %} | 113 {% if not method.is_custom and not method.is_post_message and method.visible %} |
| 131 {{generate_method(method, world_suffix)}} | 114 {{generate_method(method, world_suffix)}} |
| 132 {% endif %} | 115 {% endif %} |
| 133 {% if method.is_post_message and not is_partial %} | 116 {% if method.is_post_message and not is_partial %} |
| 134 {{generate_post_message_impl(method)}} | 117 {{generate_post_message_impl(method)}} |
| 135 {% endif %} | 118 {% endif %} |
| 136 {% if method.overloads and method.overloads.visible %} | 119 {% if method.overloads and method.overloads.visible %} |
| 137 {% if method.overloads.runtime_determined_lengths %} | 120 {% if method.overloads.runtime_determined_lengths %} |
| 138 {{runtime_determined_length_method(method.overloads)}} | 121 {{runtime_determined_length_method(method.overloads)}} |
| 139 {% endif %} | 122 {% endif %} |
| 140 {% if method.overloads.runtime_determined_maxargs %} | 123 {% if method.overloads.runtime_determined_maxargs %} |
| 141 {{runtime_determined_maxarg_method(method.overloads)}} | 124 {{runtime_determined_maxarg_method(method.overloads)}} |
| 142 {% endif %} | 125 {% endif %} |
| 143 {{overload_resolution_method(method.overloads, world_suffix)}} | 126 {{overload_resolution_method(method.overloads, world_suffix)}} |
| 144 {% endif %} | 127 {% endif %} |
| 145 {% if not method.overload_index or method.overloads %} | |
| 146 {# Document about the following condition: #} | |
| 147 {# https://docs.google.com/document/d/1qBC7Therp437Jbt_QYAtNYMZs6zQ_7_tnMkNUG_AC
qs/edit?usp=sharing #} | |
| 148 {% if (method.overloads and method.overloads.visible and | |
| 149 (not method.overloads.has_partial_overloads or not is_partial)) or | |
| 150 (not method.overloads and method.visible) %} | |
| 151 {# A single callback is generated for overloaded methods #} | |
| 152 {# with considering partial overloads #} | |
| 153 {{method_callback(method, world_suffix)}} | |
| 154 {% endif %} | |
| 155 {% endif %} | |
| 156 {% if method.is_cross_origin and method.visible %} | 128 {% if method.is_cross_origin and method.visible %} |
| 157 {{origin_safe_method_getter(method, world_suffix)}} | 129 {{origin_safe_method_getter(method, world_suffix)}} |
| 158 {% endif %} | 130 {% endif %} |
| 159 {% endfor %} | 131 {% endfor %} |
| 160 {% endfor %} | 132 {% endfor %} |
| 161 {% if iterator_method %} | 133 {% if iterator_method %} |
| 162 {{generate_method(iterator_method)}} | 134 {{generate_method(iterator_method)}} |
| 163 {{method_callback(iterator_method)}} | |
| 164 {% endif %} | 135 {% endif %} |
| 165 {% block origin_safe_method_setter %}{% endblock %} | 136 {% block origin_safe_method_setter %}{% endblock %} |
| 166 {# Constructors #} | 137 {# Constructors #} |
| 167 {% for constructor in constructors %} | 138 {% for constructor in constructors %} |
| 168 {{generate_constructor(constructor)}} | 139 {{generate_constructor(constructor)}} |
| 169 {% endfor %} | 140 {% endfor %} |
| 170 {% block overloaded_constructor %}{% endblock %} | 141 {% block overloaded_constructor %}{% endblock %} |
| 171 {% block event_constructor %}{% endblock %} | |
| 172 {# Special operations (methods) #} | 142 {# Special operations (methods) #} |
| 173 {% block named_property_getter %}{% endblock %} | 143 {% block named_property_getter %}{% endblock %} |
| 174 {% block named_property_getter_callback %}{% endblock %} | |
| 175 {% block named_property_setter %}{% endblock %} | 144 {% block named_property_setter %}{% endblock %} |
| 176 {% block named_property_setter_callback %}{% endblock %} | |
| 177 {% block named_property_deleter %}{% endblock %} | 145 {% block named_property_deleter %}{% endblock %} |
| 178 {% block named_property_deleter_callback %}{% endblock %} | |
| 179 {% block named_property_query %}{% endblock %} | 146 {% block named_property_query %}{% endblock %} |
| 180 {% block named_property_query_callback %}{% endblock %} | |
| 181 {% block named_property_enumerator %}{% endblock %} | 147 {% block named_property_enumerator %}{% endblock %} |
| 182 {% block named_property_enumerator_callback %}{% endblock %} | |
| 183 {% block indexed_property_getter %}{% endblock %} | 148 {% block indexed_property_getter %}{% endblock %} |
| 184 {% block indexed_property_getter_callback %}{% endblock %} | |
| 185 {% block indexed_property_setter %}{% endblock %} | 149 {% block indexed_property_setter %}{% endblock %} |
| 186 {% block indexed_property_setter_callback %}{% endblock %} | |
| 187 {% block indexed_property_deleter %}{% endblock %} | 150 {% block indexed_property_deleter %}{% endblock %} |
| 188 {% block indexed_property_deleter_callback %}{% endblock %} | |
| 189 {##############################################################################} | 151 {##############################################################################} |
| 190 {% block security_check_functions %} | 152 {% if has_access_check_callbacks and not is_partial and has_cross_origin_named_e
numerator %} |
| 191 {% if has_access_check_callbacks and not is_partial %} | |
| 192 {{exported}}bool securityCheck(v8::Local<v8::Context> accessingContext, v8::Loca
l<v8::Object> accessedObject, v8::Local<v8::Value> data) { | |
| 193 {% if interface_name == 'Window' %} | |
| 194 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | |
| 195 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(accessed
Object, isolate); | |
| 196 if (window.IsEmpty()) | |
| 197 return false; // the frame is gone. | |
| 198 | |
| 199 const DOMWindow* targetWindow = V8Window::toImpl(window); | |
| 200 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces
singContext)), targetWindow, BindingSecurity::ErrorReportOption::DoNotReport); | |
| 201 {% else %}{# if interface_name == 'Window' #} | |
| 202 {# Not 'Window' means it\'s Location. #} | |
| 203 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject); | |
| 204 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces
singContext)), impl, BindingSecurity::ErrorReportOption::DoNotReport); | |
| 205 {% endif %}{# if interface_name == 'Window' #} | |
| 206 } | |
| 207 | |
| 208 {% if has_cross_origin_named_enumerator %} | |
| 209 static const struct { | 153 static const struct { |
| 210 using GetterCallback = void(*)(const v8::PropertyCallbackInfo<v8::Value>&); | 154 using GetterCallback = void(*)(const v8::PropertyCallbackInfo<v8::Value>&); |
| 211 using SetterCallback = void(*)(v8::Local<v8::Value>, const V8CrossOriginSetter
Info&); | 155 using SetterCallback = void(*)(v8::Local<v8::Value>, const V8CrossOriginSetter
Info&); |
| 212 | 156 |
| 213 const char* const name; | 157 const char* const name; |
| 214 const GetterCallback getter; | 158 const GetterCallback getter; |
| 215 const SetterCallback setter; | 159 const SetterCallback setter; |
| 216 } kCrossOriginAttributeTable[] = { | 160 } kCrossOriginAttributeTable[] = { |
| 217 {##### Cross-origin attributes #####} | 161 {##### Cross-origin attributes #####} |
| 218 {% for attribute in attributes if attribute.has_cross_origin_getter or attribu
te.has_cross_origin_setter %} | 162 {% for attribute in attributes if attribute.has_cross_origin_getter or attribu
te.has_cross_origin_setter %} |
| 219 { | 163 { |
| 220 "{{attribute.name}}", | 164 "{{attribute.name}}", |
| 221 {%+ if attribute.has_cross_origin_getter %}&{{cpp_class}}V8Internal::{{attri
bute.name}}AttributeGetter{% else %}nullptr{% endif %}, | 165 {%+ if attribute.has_cross_origin_getter %}&{{cpp_class}}V8Internal::{{attri
bute.name}}AttributeGetter{% else %}nullptr{% endif %}, |
| 222 {%+ if attribute.has_cross_origin_setter %}&{{cpp_class}}V8Internal::{{attri
bute.name}}AttributeSetter{% else %}nullptr{% endif %}, | 166 {%+ if attribute.has_cross_origin_setter %}&{{cpp_class}}V8Internal::{{attri
bute.name}}AttributeSetter{% else %}nullptr{% endif %}, |
| 223 }, | 167 }, |
| 224 {% endfor %} | 168 {% endfor %} |
| 225 {##### Cross-origin methods #####} | 169 {##### Cross-origin methods #####} |
| 226 {% for method in methods if method.is_cross_origin %} | 170 {% for method in methods if method.is_cross_origin %} |
| 227 {"{{method.name}}", &{{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodG
etter, nullptr}, | 171 {"{{method.name}}", &{{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodG
etter, nullptr}, |
| 228 {% endfor %} | 172 {% endfor %} |
| 229 }; | 173 }; |
| 230 {% endif %} | 174 {% endif %} |
| 175 {##############################################################################} |
| 176 } // namespace {{cpp_class_or_partial}}V8Internal |
| 177 |
| 178 {# Constants #} |
| 179 {% from 'constants.cpp.tmpl' import constant_getter_callback with context %} |
| 180 {% for constant in constants | has_special_getter %} |
| 181 {{constant_getter_callback(constant)}} |
| 182 {% endfor %} |
| 183 {# Attributes #} |
| 184 {% from 'attributes.cpp.tmpl' import constructor_getter_callback, |
| 185 attribute_getter_callback, attribute_setter_callback, |
| 186 attribute_cache_property_callback, |
| 187 with context %} |
| 188 {% for attribute in attributes %} |
| 189 {% if attribute.is_cached_accessor %} |
| 190 {{attribute_cache_property_callback(attribute)}} |
| 191 {% endif %} |
| 192 {% for world_suffix in attribute.world_suffixes %} |
| 193 {% if not attribute.constructor_type %} |
| 194 {{attribute_getter_callback(attribute, world_suffix)}} |
| 195 {% elif attribute.needs_constructor_getter_callback %} |
| 196 {{constructor_getter_callback(attribute, world_suffix)}} |
| 197 {% endif %} |
| 198 {% if attribute.has_setter %} |
| 199 {{attribute_setter_callback(attribute, world_suffix)}} |
| 200 {% endif %} |
| 201 {% endfor %} |
| 202 {% endfor %} |
| 203 |
| 204 {# Methods #} |
| 205 {% from 'methods.cpp.tmpl' import origin_safe_method_getter_callback, |
| 206 method_callback with context %} |
| 207 {% for method in methods %} |
| 208 {% for world_suffix in method.world_suffixes %} |
| 209 {% if not method.overload_index or method.overloads %} |
| 210 {# Document about the following condition: #} |
| 211 {# https://docs.google.com/document/d/1qBC7Therp437Jbt_QYAtNYMZs6zQ_7_tnMkNUG_AC
qs/edit?usp=sharing #} |
| 212 {% if (method.overloads and method.overloads.visible and |
| 213 (not method.overloads.has_partial_overloads or not is_partial)) or |
| 214 (not method.overloads and method.visible) %} |
| 215 {# A single callback is generated for overloaded methods #} |
| 216 {# with considering partial overloads #} |
| 217 {{method_callback(method, world_suffix)}} |
| 218 {% endif %} |
| 219 {% endif %} |
| 220 {% if method.is_cross_origin and method.visible %} |
| 221 {{origin_safe_method_getter_callback(method, world_suffix)}} |
| 222 {% endif %} |
| 223 {% endfor %} |
| 224 {% endfor %} |
| 225 {% if iterator_method %} |
| 226 {{method_callback(iterator_method)}} |
| 227 {% endif %} |
| 228 {% block origin_safe_method_setter_callback %}{% endblock %} |
| 229 {# Special operations (methods) #} |
| 230 {% block named_property_getter_callback %}{% endblock %} |
| 231 {% block named_property_setter_callback %}{% endblock %} |
| 232 {% block named_property_deleter_callback %}{% endblock %} |
| 233 {% block named_property_query_callback %}{% endblock %} |
| 234 {% block named_property_enumerator_callback %}{% endblock %} |
| 235 {% block indexed_property_getter_callback %}{% endblock %} |
| 236 {% block indexed_property_setter_callback %}{% endblock %} |
| 237 {% block indexed_property_deleter_callback %}{% endblock %} |
| 238 |
| 239 {% if has_access_check_callbacks and not is_partial %} |
| 240 bool {{v8_class_or_partial}}::securityCheck(v8::Local<v8::Context> accessingCont
ext, v8::Local<v8::Object> accessedObject, v8::Local<v8::Value> data) { |
| 241 {% if interface_name == 'Window' %} |
| 242 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 243 v8::Local<v8::Object> window = V8Window::findInstanceInPrototypeChain(accessed
Object, isolate); |
| 244 if (window.IsEmpty()) |
| 245 return false; // the frame is gone. |
| 246 |
| 247 const DOMWindow* targetWindow = V8Window::toImpl(window); |
| 248 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces
singContext)), targetWindow, BindingSecurity::ErrorReportOption::DoNotReport); |
| 249 {% else %}{# if interface_name == 'Window' #} |
| 250 {# Not 'Window' means it\'s Location. #} |
| 251 {{cpp_class}}* impl = {{v8_class}}::toImpl(accessedObject); |
| 252 return BindingSecurity::shouldAllowAccessTo(toLocalDOMWindow(toDOMWindow(acces
singContext)), impl, BindingSecurity::ErrorReportOption::DoNotReport); |
| 253 {% endif %}{# if interface_name == 'Window' #} |
| 254 } |
| 231 | 255 |
| 232 {% if has_cross_origin_named_getter %} | 256 {% if has_cross_origin_named_getter %} |
| 233 {{exported}}void crossOriginNamedGetter(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) { | 257 void {{v8_class_or_partial}}::crossOriginNamedGetter(v8::Local<v8::Name> name, c
onst v8::PropertyCallbackInfo<v8::Value>& info) { |
| 234 if (!name->IsString()) | 258 if (!name->IsString()) |
| 235 return; | 259 return; |
| 236 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); | 260 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 237 | 261 |
| 238 for (const auto& attribute : kCrossOriginAttributeTable) { | 262 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA
ttributeTable) { |
| 239 if (propertyName == attribute.name && attribute.getter) { | 263 if (propertyName == attribute.name && attribute.getter) { |
| 240 attribute.getter(info); | 264 attribute.getter(info); |
| 241 return; | 265 return; |
| 242 } | 266 } |
| 243 } | 267 } |
| 244 | 268 |
| 245 {% if named_property_getter and named_property_getter.is_cross_origin %} | 269 {% if named_property_getter and named_property_getter.is_cross_origin %} |
| 246 {% if named_property_getter.is_custom %} | 270 {% if named_property_getter.is_custom %} |
| 247 {{v8_class}}::namedPropertyGetterCustom(propertyName, info); | 271 {{v8_class}}::namedPropertyGetterCustom(propertyName, info); |
| 248 {% else %} | 272 {% else %} |
| 249 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info); | 273 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info); |
| 250 {% endif %} | 274 {% endif %} |
| 251 {% else %} | 275 {% else %} |
| 252 BindingSecurity::failedAccessCheckFor( | 276 BindingSecurity::failedAccessCheckFor( |
| 253 info.GetIsolate(), | 277 info.GetIsolate(), |
| 254 {{v8_class}}::toImpl(info.Holder())->frame()); | 278 {{v8_class}}::toImpl(info.Holder())->frame()); |
| 255 {% endif %} | 279 {% endif %} |
| 256 } | 280 } |
| 257 {% endif %} | 281 {% endif %} |
| 258 | 282 |
| 259 {% if has_cross_origin_named_setter %} | 283 {% if has_cross_origin_named_setter %} |
| 260 {{exported}}void crossOriginNamedSetter(v8::Local<v8::Name> name, v8::Local<v8::
Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { | 284 void {{v8_class_or_partial}}::crossOriginNamedSetter(v8::Local<v8::Name> name, v
8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 261 if (!name->IsString()) | 285 if (!name->IsString()) |
| 262 return; | 286 return; |
| 263 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); | 287 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 264 | 288 |
| 265 for (const auto& attribute : kCrossOriginAttributeTable) { | 289 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA
ttributeTable) { |
| 266 if (propertyName == attribute.name && attribute.setter) { | 290 if (propertyName == attribute.name && attribute.setter) { |
| 267 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho
lder())); | 291 attribute.setter(value, V8CrossOriginSetterInfo(info.GetIsolate(), info.Ho
lder())); |
| 268 return; | 292 return; |
| 269 } | 293 } |
| 270 } | 294 } |
| 271 | 295 |
| 272 {# If there were no matches in the cross-origin attribute table, consider it | 296 {# If there were no matches in the cross-origin attribute table, consider it |
| 273 an access check failure: there are no custom named setters that are | 297 an access check failure: there are no custom named setters that are |
| 274 accessible from a cross-origin context. #} | 298 accessible from a cross-origin context. #} |
| 275 | 299 |
| 276 BindingSecurity::failedAccessCheckFor( | 300 BindingSecurity::failedAccessCheckFor( |
| 277 info.GetIsolate(), | 301 info.GetIsolate(), |
| 278 {{v8_class}}::toImpl(info.Holder())->frame()); | 302 {{v8_class}}::toImpl(info.Holder())->frame()); |
| 279 } | 303 } |
| 280 {% endif %} | 304 {% endif %} |
| 281 | 305 |
| 282 {% if has_cross_origin_named_enumerator %} | 306 {% if has_cross_origin_named_enumerator %} |
| 283 {{exported}}void crossOriginNamedEnumerator(const v8::PropertyCallbackInfo<v8::A
rray>& info) { | 307 void {{v8_class_or_partial}}::crossOriginNamedEnumerator(const v8::PropertyCallb
ackInfo<v8::Array>& info) { |
| 284 Vector<String> names; | 308 Vector<String> names; |
| 285 for (const auto& attribute : kCrossOriginAttributeTable) | 309 for (const auto& attribute : {{cpp_class_or_partial}}V8Internal::kCrossOriginA
ttributeTable) |
| 286 names.push_back(attribute.name); | 310 names.push_back(attribute.name); |
| 287 | 311 |
| 288 v8SetReturnValue( | 312 v8SetReturnValue( |
| 289 info, | 313 info, |
| 290 ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>()); | 314 ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>()); |
| 291 } | 315 } |
| 292 {% endif %} | 316 {% endif %} |
| 293 | 317 |
| 294 {% if has_cross_origin_indexed_getter %} | 318 {% if has_cross_origin_indexed_getter %} |
| 295 {{exported}}void crossOriginIndexedGetter(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) { | 319 void {{v8_class_or_partial}}::crossOriginIndexedGetter(uint32_t index, const v8:
:PropertyCallbackInfo<v8::Value>& info) { |
| 296 {% if indexed_property_getter.is_custom %} | 320 {% if indexed_property_getter.is_custom %} |
| 297 {{v8_class}}::indexedPropertyGetterCustom(index, info); | 321 {{v8_class}}::indexedPropertyGetterCustom(index, info); |
| 298 {% else %} | 322 {% else %} |
| 299 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info); | 323 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info); |
| 300 {% endif %} | 324 {% endif %} |
| 301 } | 325 } |
| 302 {% endif %} | 326 {% endif %} |
| 303 | 327 {% endif %}{# has_access_check_callbacks #} |
| 304 {% endif %} | |
| 305 {% endblock %} | |
| 306 {##############################################################################} | |
| 307 } // namespace {{cpp_class_or_partial}}V8Internal | |
| 308 | 328 |
| 309 {% block visit_dom_wrapper %}{% endblock %} | 329 {% block visit_dom_wrapper %}{% endblock %} |
| 310 {##############################################################################} | 330 {##############################################################################} |
| 311 {% block install_attributes %} | 331 {% block install_attributes %} |
| 312 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} | 332 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} |
| 313 {% if data_attributes %} | 333 {% if data_attributes %} |
| 314 // Suppress warning: global constructors, because AttributeConfiguration is triv
ial | 334 // Suppress warning: global constructors, because AttributeConfiguration is triv
ial |
| 315 // and does not depend on another global objects. | 335 // and does not depend on another global objects. |
| 316 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 336 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| 317 #pragma clang diagnostic push | 337 #pragma clang diagnostic push |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 {% endif %} | 465 {% endif %} |
| 446 {% if accessors %} | 466 {% if accessors %} |
| 447 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototy
peTemplate, interfaceTemplate, signature, {{'%sAccessors' % v8_class}}, {{'WTF_A
RRAY_LENGTH(%sAccessors)' % v8_class}}); | 467 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototy
peTemplate, interfaceTemplate, signature, {{'%sAccessors' % v8_class}}, {{'WTF_A
RRAY_LENGTH(%sAccessors)' % v8_class}}); |
| 448 {% endif %} | 468 {% endif %} |
| 449 {% if methods | has_method_configuration(is_partial) %} | 469 {% if methods | has_method_configuration(is_partial) %} |
| 450 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototype
Template, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARRAY
_LENGTH(%sMethods)' % v8_class}}); | 470 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototype
Template, interfaceTemplate, signature, {{'%sMethods' % v8_class}}, {{'WTF_ARRAY
_LENGTH(%sMethods)' % v8_class}}); |
| 451 {% endif %} | 471 {% endif %} |
| 452 | 472 |
| 453 {% if has_access_check_callbacks and not is_partial %} | 473 {% if has_access_check_callbacks and not is_partial %} |
| 454 // Cross-origin access check | 474 // Cross-origin access check |
| 455 {% set cross_origin_named_getter = '%sV8Internal::crossOriginNamedGetter' % cp
p_class if has_cross_origin_named_getter else 'nullptr' %} | 475 {% set cross_origin_named_getter = '%s::crossOriginNamedGetter' % v8_class_or_
partial if has_cross_origin_named_getter else 'nullptr' %} |
| 456 {% set cross_origin_named_setter = '%sV8Internal::crossOriginNamedSetter' % cp
p_class if has_cross_origin_named_setter else 'nullptr' %} | 476 {% set cross_origin_named_setter = '%s::crossOriginNamedSetter' % v8_class_or_
partial if has_cross_origin_named_setter else 'nullptr' %} |
| 457 {% set cross_origin_named_enumerator = '%sV8Internal::crossOriginNamedEnumerat
or' % cpp_class if has_cross_origin_named_enumerator else 'nullptr' %} | 477 {% set cross_origin_named_enumerator = '%s::crossOriginNamedEnumerator' % v8_c
lass_or_partial if has_cross_origin_named_enumerator else 'nullptr' %} |
| 458 {% set cross_origin_indexed_getter = '%sV8Internal::crossOriginIndexedGetter'
% cpp_class if has_cross_origin_indexed_getter else 'nullptr' %} | 478 {% set cross_origin_indexed_getter = '%s::crossOriginIndexedGetter' % v8_class
_or_partial if has_cross_origin_indexed_getter else 'nullptr' %} |
| 459 instanceTemplate->SetAccessCheckCallbackAndHandler({{cpp_class}}V8Internal::se
curityCheck, v8::NamedPropertyHandlerConfiguration({{cross_origin_named_getter}}
, {{cross_origin_named_setter}}, nullptr, nullptr, {{cross_origin_named_enumerat
or}}), v8::IndexedPropertyHandlerConfiguration({{cross_origin_indexed_getter}}),
v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperT
ypeInfo))); | 479 instanceTemplate->SetAccessCheckCallbackAndHandler({{v8_class_or_partial}}::se
curityCheck, v8::NamedPropertyHandlerConfiguration({{cross_origin_named_getter}}
, {{cross_origin_named_setter}}, nullptr, nullptr, {{cross_origin_named_enumerat
or}}), v8::IndexedPropertyHandlerConfiguration({{cross_origin_indexed_getter}}),
v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperT
ypeInfo))); |
| 460 {% endif %} | 480 {% endif %} |
| 461 | 481 |
| 462 {% for feature_name, attribute_list in runtime_enabled_attributes | groupby('r
untime_enabled_feature_name') %} | 482 {% for feature_name, attribute_list in runtime_enabled_attributes | groupby('r
untime_enabled_feature_name') %} |
| 463 {% filter runtime_enabled(feature_name) %} | 483 {% filter runtime_enabled(feature_name) %} |
| 464 {% for attribute in attribute_list | unique_by('name') | sort %} | 484 {% for attribute in attribute_list | unique_by('name') | sort %} |
| 465 {% if attribute.is_data_type_property %} | 485 {% if attribute.is_data_type_property %} |
| 466 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Co
nfiguration = {{attribute_configuration(attribute)}}; | 486 const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Co
nfiguration = {{attribute_configuration(attribute)}}; |
| 467 V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, prototy
peTemplate, attribute{{attribute.name}}Configuration); | 487 V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, prototy
peTemplate, attribute{{attribute.name}}Configuration); |
| 468 {% else %} | 488 {% else %} |
| 469 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Conf
iguration = {{attribute_configuration(attribute)}}; | 489 const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Conf
iguration = {{attribute_configuration(attribute)}}; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 484 | 504 |
| 485 {% if has_array_iterator and not is_partial %} | 505 {% if has_array_iterator and not is_partial %} |
| 486 // Array iterator (@@iterator) | 506 // Array iterator (@@iterator) |
| 487 {%+ if is_global %}instanceTemplate{% else %}prototypeTemplate{% endif %}->Set
IntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values,
v8::DontEnum); | 507 {%+ if is_global %}instanceTemplate{% else %}prototypeTemplate{% endif %}->Set
IntrinsicDataProperty(v8::Symbol::GetIterator(isolate), v8::kArrayProto_values,
v8::DontEnum); |
| 488 {% endif %} | 508 {% endif %} |
| 489 | 509 |
| 490 {% if iterator_method %} | 510 {% if iterator_method %} |
| 491 {% filter exposed(iterator_method.exposed_test) %} | 511 {% filter exposed(iterator_method.exposed_test) %} |
| 492 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %} | 512 {% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %} |
| 493 // Iterator (@@iterator) | 513 // Iterator (@@iterator) |
| 494 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorCo
nfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::ite
ratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::OnPrototype }; | 514 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorCo
nfiguration = { v8::Symbol::GetIterator, {{v8_class_or_partial}}::iteratorMethod
Callback, 0, v8::DontEnum, V8DOMConfiguration::OnPrototype }; |
| 495 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature
, symbolKeyedIteratorConfiguration); | 515 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature
, symbolKeyedIteratorConfiguration); |
| 496 {% endfilter %} | 516 {% endfilter %} |
| 497 {% endfilter %} | 517 {% endfilter %} |
| 498 {% endif %} | 518 {% endif %} |
| 499 | 519 |
| 500 {% if legacy_caller and not is_partial %} | 520 {% if legacy_caller and not is_partial %} |
| 501 instanceTemplate->SetCallAsFunctionHandler({{cpp_class_or_partial}}V8Internal:
:{{legacy_caller.name}}MethodCallback); | 521 instanceTemplate->SetCallAsFunctionHandler({{cpp_class_or_partial}}V8Internal:
:{{legacy_caller.name}}MethodCallback); |
| 502 {% elif has_custom_legacy_call_as_function and not is_partial %} | 522 {% elif has_custom_legacy_call_as_function and not is_partial %} |
| 503 instanceTemplate->SetCallAsFunctionHandler({{v8_class}}::legacyCallCustom); | 523 instanceTemplate->SetCallAsFunctionHandler({{v8_class}}::legacyCallCustom); |
| 504 {% endif %} | 524 {% endif %} |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 {% block has_instance %}{% endblock %} | 674 {% block has_instance %}{% endblock %} |
| 655 {% block to_impl %}{% endblock %} | 675 {% block to_impl %}{% endblock %} |
| 656 {% block to_impl_with_type_check %}{% endblock %} | 676 {% block to_impl_with_type_check %}{% endblock %} |
| 657 {##############################################################################} | 677 {##############################################################################} |
| 658 {% block prepare_prototype_and_interface_object %}{% endblock %} | 678 {% block prepare_prototype_and_interface_object %}{% endblock %} |
| 659 {##############################################################################} | 679 {##############################################################################} |
| 660 {% block partial_interface %}{% endblock %} | 680 {% block partial_interface %}{% endblock %} |
| 661 } // namespace blink | 681 } // namespace blink |
| 662 | 682 |
| 663 {% endfilter %}{# format_blink_cpp_source_code #} | 683 {% endfilter %}{# format_blink_cpp_source_code #} |
| OLD | NEW |