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

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

Issue 462623002: Add a missing check for exceptions thrown in methods implemented in private scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {# Local variables #} 6 {# Local variables #}
7 {% if method.has_exception_state %} 7 {% if method.has_exception_state %}
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
9 {% endif %} 9 {% endif %}
10 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 {% else %} 522 {% else %}
523 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} 523 {# Empty array initializers are illegal, and don\'t compile in MSVC. #}
524 v8::Handle<v8::Value> *argv = 0; 524 v8::Handle<v8::Value> *argv = 0;
525 {% endif %} 525 {% endif %}
526 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); 526 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() );
527 v8::TryCatch block; 527 v8::TryCatch block;
528 V8RethrowTryCatchScope rethrow(block); 528 V8RethrowTryCatchScope rethrow(block);
529 {% if method.idl_type == 'void' %} 529 {% if method.idl_type == 'void' %}
530 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na me}}", holder, {{method.arguments | length}}, argv); 530 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na me}}", holder, {{method.arguments | length}}, argv);
531 if (block.HasCaught()) { 531 if (block.HasCaught()) {
532 PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scriptStat e->isolate(), exceptionState, block.Exception()); 532 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip tState->isolate(), exceptionState, block.Exception())) {
533 // FIXME: We should support more exceptions.
534 RELEASE_ASSERT_NOT_REACHED();
535 }
533 return false; 536 return false;
534 } 537 }
535 {% else %} 538 {% else %}
536 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar gv); 539 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar gv);
537 if (block.HasCaught()) { 540 if (block.HasCaught()) {
538 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip tState->isolate(), exceptionState, block.Exception())) { 541 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip tState->isolate(), exceptionState, block.Exception())) {
539 // FIXME: We should support exceptions other than DOM exceptions. 542 // FIXME: We should support more exceptions.
540 RELEASE_ASSERT_NOT_REACHED(); 543 RELEASE_ASSERT_NOT_REACHED();
541 } 544 }
542 return false; 545 return false;
543 } 546 }
544 {{method.private_script_v8_value_to_local_cpp_value}}; 547 {{method.private_script_v8_value_to_local_cpp_value}};
545 RELEASE_ASSERT(!exceptionState.hadException()); 548 RELEASE_ASSERT(!exceptionState.hadException());
546 *result = cppValue; 549 *result = cppValue;
547 {% endif %} 550 {% endif %}
548 return true; 551 return true;
549 } 552 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ()); 595 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ());
593 {% else %} 596 {% else %}
594 {% set constructor_class = v8_class + ('Constructor' 597 {% set constructor_class = v8_class + ('Constructor'
595 if constructor.is_named_constructor else 598 if constructor.is_named_constructor else
596 '') %} 599 '') %}
597 v8::Handle<v8::Object> wrapper = info.Holder(); 600 v8::Handle<v8::Object> wrapper = info.Holder();
598 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}}); 601 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}});
599 {% endif %} 602 {% endif %}
600 v8SetReturnValue(info, wrapper); 603 v8SetReturnValue(info, wrapper);
601 {% endmacro %} 604 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/tests/results/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698