| OLD | NEW |
| 1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% block indexed_property_getter %} | 5 {% block indexed_property_getter %} |
| 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
| 7 {% set getter = indexed_property_getter %} | 7 {% set getter = indexed_property_getter %} |
| 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 9 { | 9 { |
| 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 {% endif %} | 160 {% endif %} |
| 161 {% endblock %} | 161 {% endblock %} |
| 162 | 162 |
| 163 | 163 |
| 164 {##############################################################################} | 164 {##############################################################################} |
| 165 {% block named_property_getter %} | 165 {% block named_property_getter %} |
| 166 {% if named_property_getter and not named_property_getter.is_custom %} | 166 {% if named_property_getter and not named_property_getter.is_custom %} |
| 167 {% set getter = named_property_getter %} | 167 {% set getter = named_property_getter %} |
| 168 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) | 168 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 169 { | 169 { |
| 170 if (!name->IsString()) |
| 171 return; |
| 170 auto nameString = name.As<v8::String>(); | 172 auto nameString = name.As<v8::String>(); |
| 171 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 173 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 172 AtomicString propertyName = toCoreAtomicString(nameString); | 174 AtomicString propertyName = toCoreAtomicString(nameString); |
| 173 {% if getter.is_raises_exception %} | 175 {% if getter.is_raises_exception %} |
| 174 v8::String::Utf8Value namedProperty(nameString); | 176 v8::String::Utf8Value namedProperty(nameString); |
| 175 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 177 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 176 {% endif %} | 178 {% endif %} |
| 177 {% if getter.is_call_with_script_state %} | 179 {% if getter.is_call_with_script_state %} |
| 178 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 180 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 179 {% endif %} | 181 {% endif %} |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 {% endblock %} | 215 {% endblock %} |
| 214 | 216 |
| 215 | 217 |
| 216 {##############################################################################} | 218 {##############################################################################} |
| 217 {% block named_property_setter %} | 219 {% block named_property_setter %} |
| 218 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %} | 220 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %} |
| 219 {% if named_property_setter and not named_property_setter.is_custom %} | 221 {% if named_property_setter and not named_property_setter.is_custom %} |
| 220 {% set setter = named_property_setter %} | 222 {% set setter = named_property_setter %} |
| 221 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 223 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 222 { | 224 { |
| 225 if (!name->IsString()) |
| 226 return; |
| 223 auto nameString = name.As<v8::String>(); | 227 auto nameString = name.As<v8::String>(); |
| 224 {% if setter.has_exception_state %} | 228 {% if setter.has_exception_state %} |
| 225 v8::String::Utf8Value namedProperty(nameString); | 229 v8::String::Utf8Value namedProperty(nameString); |
| 226 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 230 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 227 {% endif %} | 231 {% endif %} |
| 228 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 232 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 229 {# v8_value_to_local_cpp_value('DOMString', 'nameString', 'propertyName') #} | 233 {# v8_value_to_local_cpp_value('DOMString', 'nameString', 'propertyName') #} |
| 230 V8StringResource<> propertyName(nameString); | 234 V8StringResource<> propertyName(nameString); |
| 231 if (!propertyName.prepare()) | 235 if (!propertyName.prepare()) |
| 232 return; | 236 return; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 288 |
| 285 {##############################################################################} | 289 {##############################################################################} |
| 286 {% block named_property_query %} | 290 {% block named_property_query %} |
| 287 {% if named_property_getter and named_property_getter.is_enumerable and | 291 {% if named_property_getter and named_property_getter.is_enumerable and |
| 288 not named_property_getter.is_custom_property_query %} | 292 not named_property_getter.is_custom_property_query %} |
| 289 {% set getter = named_property_getter %} | 293 {% set getter = named_property_getter %} |
| 290 {# If there is an enumerator, there MUST be a query method to properly | 294 {# If there is an enumerator, there MUST be a query method to properly |
| 291 communicate property attributes. #} | 295 communicate property attributes. #} |
| 292 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) | 296 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) |
| 293 { | 297 { |
| 298 if (!name->IsString()) |
| 299 return; |
| 294 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 300 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 295 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); | 301 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 296 v8::String::Utf8Value namedProperty(name); | 302 v8::String::Utf8Value namedProperty(name); |
| 297 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 303 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 298 {% set getter_arguments = ['propertyName', 'exceptionState'] %} | 304 {% set getter_arguments = ['propertyName', 'exceptionState'] %} |
| 299 {% if getter.is_call_with_script_state %} | 305 {% if getter.is_call_with_script_state %} |
| 300 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 306 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 301 {% set getter_arguments = ['scriptState'] + getter_arguments %} | 307 {% set getter_arguments = ['scriptState'] + getter_arguments %} |
| 302 {% endif %} | 308 {% endif %} |
| 303 bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}}); | 309 bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}}); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 328 {% endif %} | 334 {% endif %} |
| 329 {% endblock %} | 335 {% endblock %} |
| 330 | 336 |
| 331 | 337 |
| 332 {##############################################################################} | 338 {##############################################################################} |
| 333 {% block named_property_deleter %} | 339 {% block named_property_deleter %} |
| 334 {% if named_property_deleter and not named_property_deleter.is_custom %} | 340 {% if named_property_deleter and not named_property_deleter.is_custom %} |
| 335 {% set deleter = named_property_deleter %} | 341 {% set deleter = named_property_deleter %} |
| 336 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 342 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
| 337 { | 343 { |
| 344 if (!name->IsString()) |
| 345 return; |
| 338 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 346 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 339 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); | 347 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 340 {% if deleter.is_raises_exception %} | 348 {% if deleter.is_raises_exception %} |
| 341 v8::String::Utf8Value namedProperty(name); | 349 v8::String::Utf8Value namedProperty(name); |
| 342 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "{{interface_name}}", info.Holder(), info.GetIsolate()); | 350 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 343 {% endif %} | 351 {% endif %} |
| 344 {% if deleter.is_call_with_script_state %} | 352 {% if deleter.is_call_with_script_state %} |
| 345 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 353 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 346 {% endif %} | 354 {% endif %} |
| 347 {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %} | 355 {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %} |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 429 |
| 422 {% endif %} | 430 {% endif %} |
| 423 {% endblock %} | 431 {% endblock %} |
| 424 | 432 |
| 425 | 433 |
| 426 {##############################################################################} | 434 {##############################################################################} |
| 427 {% block origin_safe_method_setter %} | 435 {% block origin_safe_method_setter %} |
| 428 {% if has_origin_safe_method_setter %} | 436 {% if has_origin_safe_method_setter %} |
| 429 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo
cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | 437 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo
cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
| 430 { | 438 { |
| 439 if (!name->IsString()) |
| 440 return; |
| 431 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); | 441 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); |
| 432 if (holder.IsEmpty()) | 442 if (holder.IsEmpty()) |
| 433 return; | 443 return; |
| 434 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 444 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 435 v8::String::Utf8Value attributeName(name); | 445 v8::String::Utf8Value attributeName(name); |
| 436 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 446 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 437 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { | 447 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { |
| 438 exceptionState.throwIfNeeded(); | 448 exceptionState.throwIfNeeded(); |
| 439 return; | 449 return; |
| 440 } | 450 } |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 937 |
| 928 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 938 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
| 929 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 939 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| 930 { | 940 { |
| 931 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 941 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
| 932 } | 942 } |
| 933 | 943 |
| 934 {% endfor %} | 944 {% endfor %} |
| 935 {% endif %} | 945 {% endif %} |
| 936 {% endblock %} | 946 {% endblock %} |
| OLD | NEW |