| OLD | NEW |
| 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} | 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} |
| 2 | 2 |
| 3 {##############################################################################} | 3 {##############################################################################} |
| 4 {% macro generate_method(method, world_suffix) %} | 4 {% macro generate_method(method, world_suffix) %} |
| 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) { | 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) { |
| 6 {% filter format_remove_duplicates([ | 6 {% filter format_remove_duplicates([ |
| 7 'ExceptionState exceptionState', | 7 'ExceptionState exceptionState', |
| 8 'ScriptState* scriptState = ']) %} | 8 'ScriptState* scriptState = ']) %} |
| 9 {% set define_exception_state -%} | 9 {% set define_exception_state -%} |
| 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont
ext, "{{interface_name}}", "{{method.name}}"); | 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont
ext, "{{interface_name}}", "{{method.name}}"); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 527 |
| 528 v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTe
mplate(world, &domTemplateKey, {{v8_class_or_partial}}::{{method.name}}MethodCal
lback{{world_suffix}}, v8Undefined(), signature, {{method.length}}); | 528 v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTe
mplate(world, &domTemplateKey, {{v8_class_or_partial}}::{{method.name}}MethodCal
lback{{world_suffix}}, v8Undefined(), signature, {{method.length}}); |
| 529 // Return the function by default, unless the user script has overwritten it. | 529 // Return the function by default, unless the user script has overwritten it. |
| 530 v8SetReturnValue(info, methodTemplate->GetFunction(info.GetIsolate()->GetCurre
ntContext()).ToLocalChecked()); | 530 v8SetReturnValue(info, methodTemplate->GetFunction(info.GetIsolate()->GetCurre
ntContext()).ToLocalChecked()); |
| 531 | 531 |
| 532 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 532 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 533 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
impl, BindingSecurity::ErrorReportOption::DoNotReport)) { | 533 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
impl, BindingSecurity::ErrorReportOption::DoNotReport)) { |
| 534 return; | 534 return; |
| 535 } | 535 } |
| 536 | 536 |
| 537 v8::Local<v8::Value> hiddenValue = V8HiddenValue::getHiddenValue(ScriptState::
current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), v8Atomic
String(info.GetIsolate(), "{{method.name}}")); | 537 v8::Local<v8::Value> propertyValue = |
| 538 if (!hiddenValue.IsEmpty()) { | 538 V8PrivateProperty::createSymbol(info.GetIsolate(), "{{method.name}}") |
| 539 v8SetReturnValue(info, hiddenValue); | 539 .getOrUndefined(v8::Local<v8::Object>::Cast(info.Holder())); |
| 540 if (!propertyValue->IsUndefined()) { |
| 541 v8SetReturnValue(info, propertyValue); |
| 540 } | 542 } |
| 541 } | 543 } |
| 542 {% endmacro %} | 544 {% endmacro %} |
| 543 | 545 |
| 544 {% macro origin_safe_method_getter_callback(method, world_suffix) %} | 546 {% macro origin_safe_method_getter_callback(method, world_suffix) %} |
| 545 void {{v8_class_or_partial}}::{{method.name}}OriginSafeMethodGetterCallback{{wor
ld_suffix}}(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info
) { | 547 void {{v8_class_or_partial}}::{{method.name}}OriginSafeMethodGetterCallback{{wor
ld_suffix}}(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info
) { |
| 546 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix}}
(info); | 548 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix}}
(info); |
| 547 } | 549 } |
| 548 {% endmacro %} | 550 {% endmacro %} |
| 549 | 551 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 {{method_configuration(method) | indent(2)}} | 646 {{method_configuration(method) | indent(2)}} |
| 645 }; | 647 }; |
| 646 for (const auto& methodConfig : {{method.name}}MethodConfiguration) | 648 for (const auto& methodConfig : {{method.name}}MethodConfiguration) |
| 647 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), pro
totypeObject, interfaceObject, signature, methodConfig); | 649 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), pro
totypeObject, interfaceObject, signature, methodConfig); |
| 648 {% endfilter %}{# runtime_enabled() #} | 650 {% endfilter %}{# runtime_enabled() #} |
| 649 {% endfilter %}{# exposed() #} | 651 {% endfilter %}{# exposed() #} |
| 650 {% endfilter %}{# secure_context() #} | 652 {% endfilter %}{# secure_context() #} |
| 651 {% endfor %} | 653 {% endfor %} |
| 652 {% endif %} | 654 {% endif %} |
| 653 {%- endmacro %} | 655 {%- endmacro %} |
| OLD | NEW |