Commit 2053033a authored by jl@opera.com's avatar jl@opera.com

Use auto-rethrowing v8::TryCatch variant

To avoid the need to call ReThrow() on the v8::TryCatch that may or
may not be declared, and the risk of forgetting to do so in some case,
use an auto-rethrowing v8::TryCatch variant instead.

BUG=362388

Review URL: https://codereview.chromium.org/304223007

git-svn-id: svn://svn.chromium.org/blink/trunk@175134 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 645fae94
...@@ -755,7 +755,7 @@ def generate_constructor(interface, constructor): ...@@ -755,7 +755,7 @@ def generate_constructor(interface, constructor):
return { return {
'argument_list': constructor_argument_list(interface, constructor), 'argument_list': constructor_argument_list(interface, constructor),
'arguments': [v8_methods.generate_argument(interface, constructor, argument, index, arguments_need_try_catch) 'arguments': [v8_methods.generate_argument(interface, constructor, argument, index)
for index, argument in enumerate(constructor.arguments)], for index, argument in enumerate(constructor.arguments)],
'arguments_need_try_catch': arguments_need_try_catch, 'arguments_need_try_catch': arguments_need_try_catch,
'cpp_type': cpp_template_type( 'cpp_type': cpp_template_type(
......
...@@ -100,7 +100,7 @@ def generate_method(interface, method): ...@@ -100,7 +100,7 @@ def generate_method(interface, method):
return { return {
'activity_logging_world_list': v8_utilities.activity_logging_world_list(method), # [ActivityLogging] 'activity_logging_world_list': v8_utilities.activity_logging_world_list(method), # [ActivityLogging]
'arguments': [generate_argument(interface, method, argument, index, arguments_need_try_catch) 'arguments': [generate_argument(interface, method, argument, index)
for index, argument in enumerate(arguments)], for index, argument in enumerate(arguments)],
'arguments_need_try_catch': arguments_need_try_catch, 'arguments_need_try_catch': arguments_need_try_catch,
'conditional_string': v8_utilities.conditional_string(method), 'conditional_string': v8_utilities.conditional_string(method),
...@@ -157,7 +157,7 @@ def generate_method(interface, method): ...@@ -157,7 +157,7 @@ def generate_method(interface, method):
} }
def generate_argument(interface, method, argument, index, method_has_try_catch): def generate_argument(interface, method, argument, index):
extended_attributes = argument.extended_attributes extended_attributes = argument.extended_attributes
idl_type = argument.idl_type idl_type = argument.idl_type
this_cpp_value = cpp_value(interface, method, index) this_cpp_value = cpp_value(interface, method, index)
...@@ -195,7 +195,7 @@ def generate_argument(interface, method, argument, index, method_has_try_catch): ...@@ -195,7 +195,7 @@ def generate_argument(interface, method, argument, index, method_has_try_catch):
'name': argument.name, 'name': argument.name,
'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True),
'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value), 'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value),
'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index, method_has_try_catch), 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index),
} }
...@@ -279,7 +279,7 @@ def v8_value_to_local_cpp_variadic_value(argument, index): ...@@ -279,7 +279,7 @@ def v8_value_to_local_cpp_variadic_value(argument, index):
return '%s(%s)' % (macro, ', '.join(macro_args)) return '%s(%s)' % (macro, ', '.join(macro_args))
def v8_value_to_local_cpp_value(argument, index, method_has_try_catch): def v8_value_to_local_cpp_value(argument, index):
extended_attributes = argument.extended_attributes extended_attributes = argument.extended_attributes
idl_type = argument.idl_type idl_type = argument.idl_type
name = argument.name name = argument.name
...@@ -292,8 +292,7 @@ def v8_value_to_local_cpp_value(argument, index, method_has_try_catch): ...@@ -292,8 +292,7 @@ def v8_value_to_local_cpp_value(argument, index, method_has_try_catch):
else: else:
v8_value = 'info[%s]' % index v8_value = 'info[%s]' % index
return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value,
name, index=index, declare_variable=False, name, index=index, declare_variable=False)
method_has_try_catch=method_has_try_catch)
################################################################################ ################################################################################
......
...@@ -443,7 +443,7 @@ def v8_value_to_cpp_value_array_or_sequence(array_or_sequence_type, v8_value, in ...@@ -443,7 +443,7 @@ def v8_value_to_cpp_value_array_or_sequence(array_or_sequence_type, v8_value, in
return expression return expression
def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True, method_has_try_catch=False): def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True):
"""Returns an expression that converts a V8 value to a C++ value and stores it as a local value.""" """Returns an expression that converts a V8 value to a C++ value and stores it as a local value."""
this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, used_as_argument=True) this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attributes, used_as_argument=True)
...@@ -467,15 +467,6 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl ...@@ -467,15 +467,6 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
else: else:
suffix += '_INTERNAL' suffix += '_INTERNAL'
# The TOSTRING_VOID_INTERNAL macro comes in two flavors; use the right one
# depending on whether the containing method has a v8::TryCatch local
# (named 'block') declared or not. If there is such a local, use the block
# for avoiding declaring another one for performance and propagate the
# exception.
if (macro == 'TOSTRING_VOID' and not declare_variable and
not method_has_try_catch):
suffix += '_NOTRYCATCH'
return '%s(%s)' % (macro + suffix, ', '.join(args)) return '%s(%s)' % (macro + suffix, ', '.join(args))
......
...@@ -25,7 +25,7 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const ...@@ -25,7 +25,7 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
{% if interface_name == 'EventTarget' %} {% if interface_name == 'EventTarget' %}
if (DOMWindow* window = impl->toDOMWindow()) { if (DOMWindow* window = impl->toDOMWindow()) {
if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) { if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
{{throw_from_exception_state(method) | indent(12)}} {{throw_from_exception_state(method)}};
return; return;
} }
if (!window->document()) if (!window->document())
...@@ -33,14 +33,14 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const ...@@ -33,14 +33,14 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
} }
{% elif method.is_check_security_for_frame %} {% elif method.is_check_security_for_frame %}
if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->frame(), exceptionState)) { if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->frame(), exceptionState)) {
{{throw_from_exception_state(method) | indent(8)}} {{throw_from_exception_state(method)}};
return; return;
} }
{% endif %} {% endif %}
{% if method.is_check_security_for_node %} {% if method.is_check_security_for_node %}
if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->{{method.name}}(exceptionState), exceptionState)) { if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->{{method.name}}(exceptionState), exceptionState)) {
v8SetReturnValueNull(info); v8SetReturnValueNull(info);
{{throw_from_exception_state(method) | indent(8)}} {{throw_from_exception_state(method)}};
return; return;
} }
{% endif %} {% endif %}
...@@ -81,6 +81,7 @@ if (listener && !impl->toNode()) ...@@ -81,6 +81,7 @@ if (listener && !impl->toNode())
{ {
{% if method.arguments_need_try_catch %} {% if method.arguments_need_try_catch %}
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
{% endif %} {% endif %}
{% for argument in method.arguments %} {% for argument in method.arguments %}
{{generate_argument(method, argument, world_suffix) | indent}} {{generate_argument(method, argument, world_suffix) | indent}}
...@@ -117,9 +118,9 @@ OwnPtr<{{argument.idl_type}}> {{argument.name}} ...@@ -117,9 +118,9 @@ OwnPtr<{{argument.idl_type}}> {{argument.name}}
Optional Dictionary arguments default to empty dictionary. #} Optional Dictionary arguments default to empty dictionary. #}
if (UNLIKELY(info.Length() <= {{argument.index}})) { if (UNLIKELY(info.Length() <= {{argument.index}})) {
{% if world_suffix %} {% if world_suffix %}
{{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argument.cpp_value, method.arguments_need_try_catch) | indent}} {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argument.cpp_value) | indent}}
{% else %} {% else %}
{{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value, method.arguments_need_try_catch) | indent}} {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}}
{% endif %} {% endif %}
{% if argument.has_event_listener_argument %} {% if argument.has_event_listener_argument %}
{{hidden_dependency_action(method.name) | indent}} {{hidden_dependency_action(method.name) | indent}}
...@@ -178,7 +179,7 @@ if (!std::isnan({{argument.name}}NativeValue)) ...@@ -178,7 +179,7 @@ if (!std::isnan({{argument.name}}NativeValue))
{% elif argument.idl_type == 'SerializedScriptValue' %} {% elif argument.idl_type == 'SerializedScriptValue' %}
{{argument.name}} = SerializedScriptValue::create(info[{{argument.index}}], 0, 0, exceptionState, info.GetIsolate()); {{argument.name}} = SerializedScriptValue::create(info[{{argument.index}}], 0, 0, exceptionState, info.GetIsolate());
if (exceptionState.hadException()) { if (exceptionState.hadException()) {
{{throw_from_exception_state(method) | indent}} {{throw_from_exception_state(method)}};
return; return;
} }
{% elif argument.is_variadic_wrapper_type %} {% elif argument.is_variadic_wrapper_type %}
...@@ -228,7 +229,7 @@ if (!{{argument.name}}.isUndefinedOrNull() && !{{argument.name}}.isObject()) { ...@@ -228,7 +229,7 @@ if (!{{argument.name}}.isUndefinedOrNull() && !{{argument.name}}.isObject()) {
{######################################} {######################################}
{% macro cpp_method_call(method, v8_set_return_value, cpp_value, has_try_catch) %} {% macro cpp_method_call(method, v8_set_return_value, cpp_value) %}
{# Local variables #} {# Local variables #}
{% if method.is_call_with_script_state %} {% if method.is_call_with_script_state %}
ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ScriptState* scriptState = ScriptState::current(info.GetIsolate());
...@@ -251,7 +252,7 @@ RefPtr<ScriptArguments> scriptArguments(createScriptArguments(info, {{method.num ...@@ -251,7 +252,7 @@ RefPtr<ScriptArguments> scriptArguments(createScriptArguments(info, {{method.num
{# Post-call #} {# Post-call #}
{% if method.is_raises_exception %} {% if method.is_raises_exception %}
if (exceptionState.hadException()) { if (exceptionState.hadException()) {
{{throw_from_exception_state(method, has_try_catch) | indent}} {{throw_from_exception_state(method)}};
return; return;
} }
{% endif %} {% endif %}
...@@ -289,27 +290,19 @@ v8SetReturnValueNull(info); ...@@ -289,27 +290,19 @@ v8SetReturnValueNull(info);
{% macro throw_type_error(method, error_message) %} {% macro throw_type_error(method, error_message) %}
{% if method.has_exception_state %} {% if method.has_exception_state %}
exceptionState.throwTypeError({{error_message}}); exceptionState.throwTypeError({{error_message}});
{{throw_from_exception_state(method, method.arguments_need_try_catch)}} {{throw_from_exception_state(method)}};
{%- else %}{# method.has_exception_state #} {% elif method.is_constructor %}
{% if method.is_constructor %}
throwTypeError(ExceptionMessages::failedToConstruct("{{interface_name}}", {{error_message}}), info.GetIsolate()); throwTypeError(ExceptionMessages::failedToConstruct("{{interface_name}}", {{error_message}}), info.GetIsolate());
{% else %}{# method.has_exception_state #} {% else %}{# method.has_exception_state #}
throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{interface_name}}", {{error_message}}), info.GetIsolate()); throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{interface_name}}", {{error_message}}), info.GetIsolate());
{% endif %}
{% if method.arguments_need_try_catch %}
block.ReThrow();
{% endif %}
{% endif %}{# method.has_exception_state #} {% endif %}{# method.has_exception_state #}
{% endmacro %} {% endmacro %}
{######################################} {######################################}
{# FIXME: return a rejected Promise if method.idl_type == 'Promise' #} {# FIXME: return a rejected Promise if method.idl_type == 'Promise' #}
{% macro throw_from_exception_state(method, has_try_catch) %} {% macro throw_from_exception_state(method) %}
exceptionState.throwIfNeeded(); exceptionState.throwIfNeeded()
{% if has_try_catch %}
block.ReThrow();
{%- endif %}
{%- endmacro %} {%- endmacro %}
......
...@@ -803,9 +803,9 @@ static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo ...@@ -803,9 +803,9 @@ static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo
TestInterfaceEmpty* testInterfaceEmptyArg; TestInterfaceEmpty* testInterfaceEmptyArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())) { if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())) {
throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate()); throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
block.ReThrow();
return; return;
} }
TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
...@@ -831,16 +831,15 @@ static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: ...@@ -831,16 +831,15 @@ static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8:
float floatArg; float floatArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberValue())); TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberValue()));
if (!std::isfinite(doubleArg)) { if (!std::isfinite(doubleArg)) {
throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsolate()); throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsolate());
block.ReThrow();
return; return;
} }
TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue())); TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue()));
if (!std::isfinite(floatArg)) { if (!std::isfinite(floatArg)) {
throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsolate()); throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsolate());
block.ReThrow();
return; return;
} }
} }
...@@ -865,6 +864,7 @@ static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: ...@@ -865,6 +864,7 @@ static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8::
float unrestrictedFloatArg; float unrestrictedFloatArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0]->NumberValue())); TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0]->NumberValue()));
TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]->NumberValue())); TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]->NumberValue()));
} }
...@@ -929,11 +929,11 @@ static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ...@@ -929,11 +929,11 @@ static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val
TestInterfaceEmpty* testInterfaceEmptyArg; TestInterfaceEmpty* testInterfaceEmptyArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TOSTRING_VOID_INTERNAL(strArg, info[0]); TOSTRING_VOID_INTERNAL(strArg, info[0]);
if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.GetIsolate())) { if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.GetIsolate())) {
exceptionState.throwTypeError("parameter 2 is not of type 'TestInterfaceEmpty'."); exceptionState.throwTypeError("parameter 2 is not of type 'TestInterfaceEmpty'.");
exceptionState.throwIfNeeded(); exceptionState.throwIfNeeded();
block.ReThrow();
return; return;
} }
TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[1])); TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
...@@ -1056,6 +1056,7 @@ static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va ...@@ -1056,6 +1056,7 @@ static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va
int longArg; int longArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState);
} }
TestPartialInterface::partialVoidMethodLongArg(*impl, longArg); TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
...@@ -1105,6 +1106,7 @@ static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall ...@@ -1105,6 +1106,7 @@ static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall
ScriptValue partialCallbackTypeArg; ScriptValue partialCallbackTypeArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(partialCallbackTypeArg, ScriptValue(ScriptState::current(info.GetIsolate()), info[0])); TONATIVE_VOID_INTERNAL(partialCallbackTypeArg, ScriptValue(ScriptState::current(info.GetIsolate()), info[0]));
} }
TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partialCallbackTypeArg); TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partialCallbackTypeArg);
......
...@@ -58,6 +58,7 @@ static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -58,6 +58,7 @@ static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
unsigned index; unsigned index;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState);
} }
RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
...@@ -87,6 +88,7 @@ static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -87,6 +88,7 @@ static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
V8StringResource<> value; V8StringResource<> value;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState);
TOSTRING_VOID_INTERNAL(value, info[1]); TOSTRING_VOID_INTERNAL(value, info[1]);
} }
...@@ -116,6 +118,7 @@ static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -116,6 +118,7 @@ static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
unsigned index; unsigned index;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exceptionState), exceptionState);
} }
bool result = impl->deleteItem(index, exceptionState); bool result = impl->deleteItem(index, exceptionState);
...@@ -143,7 +146,7 @@ static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -143,7 +146,7 @@ static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
V8StringResource<> name; V8StringResource<> name;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(name, info[0]); TOSTRING_VOID_INTERNAL(name, info[0]);
} }
RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
if (exceptionState.hadException()) { if (exceptionState.hadException()) {
...@@ -171,8 +174,8 @@ static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -171,8 +174,8 @@ static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
V8StringResource<> name; V8StringResource<> name;
V8StringResource<> value; V8StringResource<> value;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(name, info[0]); TOSTRING_VOID_INTERNAL(name, info[0]);
TOSTRING_VOID_INTERNAL_NOTRYCATCH(value, info[1]); TOSTRING_VOID_INTERNAL(value, info[1]);
} }
String result = impl->setNamedItem(name, value, exceptionState); String result = impl->setNamedItem(name, value, exceptionState);
if (exceptionState.hadException()) { if (exceptionState.hadException()) {
...@@ -199,7 +202,7 @@ static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf ...@@ -199,7 +202,7 @@ static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf
TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
V8StringResource<> name; V8StringResource<> name;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(name, info[0]); TOSTRING_VOID_INTERNAL(name, info[0]);
} }
bool result = impl->deleteNamedItem(name, exceptionState); bool result = impl->deleteNamedItem(name, exceptionState);
if (exceptionState.hadException()) { if (exceptionState.hadException()) {
......
...@@ -75,6 +75,7 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -75,6 +75,7 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterfaceEmpty* optionalTestInterfaceEmptyArg; TestInterfaceEmpty* optionalTestInterfaceEmptyArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberValue())); TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberValue()));
TOSTRING_VOID_INTERNAL(stringArg, info[1]); TOSTRING_VOID_INTERNAL(stringArg, info[1]);
TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[2])); TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[2]));
...@@ -82,7 +83,6 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -82,7 +83,6 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) { if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object."); exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object.");
exceptionState.throwIfNeeded(); exceptionState.throwIfNeeded();
block.ReThrow();
return; return;
} }
TONATIVE_VOID_INTERNAL(sequenceStringArg, toNativeArray<String>(info[4], 5, info.GetIsolate())); TONATIVE_VOID_INTERNAL(sequenceStringArg, toNativeArray<String>(info[4], 5, info.GetIsolate()));
...@@ -91,7 +91,6 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -91,7 +91,6 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isObject()) { if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isObject()) {
exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is not an object."); exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is not an object.");
exceptionState.throwIfNeeded(); exceptionState.throwIfNeeded();
block.ReThrow();
return; return;
} }
TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[7])); TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[7]));
......
...@@ -50,7 +50,7 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -50,7 +50,7 @@ static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
v8::Isolate* isolate = info.GetIsolate(); v8::Isolate* isolate = info.GetIsolate();
V8StringResource<> stringArg; V8StringResource<> stringArg;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(stringArg, info[0]); TOSTRING_VOID_INTERNAL(stringArg, info[0]);
} }
RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(stringArg); RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(stringArg);
...@@ -65,10 +65,10 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -65,10 +65,10 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
Dictionary dictionaryArg; Dictionary dictionaryArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(dictionaryArg, Dictionary(info[0], info.GetIsolate())); TONATIVE_VOID_INTERNAL(dictionaryArg, Dictionary(info[0], info.GetIsolate()));
if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) { if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor2", "parameter 1 ('dictionaryArg') is not an object."), info.GetIsolate()); throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor2", "parameter 1 ('dictionaryArg') is not an object."), info.GetIsolate());
block.ReThrow();
return; return;
} }
} }
...@@ -91,6 +91,7 @@ static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -91,6 +91,7 @@ static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info)
V8StringResource<> optionalStringArg; V8StringResource<> optionalStringArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState);
TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[2]); TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[2]);
...@@ -99,7 +100,6 @@ static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -99,7 +100,6 @@ static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info)
if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUndefinedOptionalDictionaryArg.isObject()) { if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUndefinedOptionalDictionaryArg.isObject()) {
exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDictionaryArg') is not an object."); exceptionState.throwTypeError("parameter 5 ('defaultUndefinedOptionalDictionaryArg') is not an object.");
exceptionState.throwIfNeeded(); exceptionState.throwIfNeeded();
block.ReThrow();
return; return;
} }
if (UNLIKELY(info.Length() <= 5)) { if (UNLIKELY(info.Length() <= 5)) {
......
...@@ -52,7 +52,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -52,7 +52,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
} }
V8StringResource<> stringArg; V8StringResource<> stringArg;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(stringArg, info[0]); TOSTRING_VOID_INTERNAL(stringArg, info[0]);
} }
RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg); RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg);
......
...@@ -83,6 +83,7 @@ static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -83,6 +83,7 @@ static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterfaceGarbageCollected* arg; TestInterfaceGarbageCollected* arg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(arg, V8TestInterfaceGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), info[0])); TONATIVE_VOID_INTERNAL(arg, V8TestInterfaceGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
} }
impl->func(arg); impl->func(arg);
...@@ -104,7 +105,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -104,7 +105,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
} }
V8StringResource<> str; V8StringResource<> str;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(str, info[0]); TOSTRING_VOID_INTERNAL(str, info[0]);
} }
RawPtr<TestInterfaceGarbageCollected> impl = TestInterfaceGarbageCollected::create(str); RawPtr<TestInterfaceGarbageCollected> impl = TestInterfaceGarbageCollected::create(str);
......
...@@ -105,6 +105,7 @@ static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::Functio ...@@ -105,6 +105,7 @@ static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::Functio
V8StringResource<> optionalStringArg; V8StringResource<> optionalStringArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TOSTRING_VOID_INTERNAL(stringArg, info[0]); TOSTRING_VOID_INTERNAL(stringArg, info[0]);
TONATIVE_VOID_INTERNAL(defaultUndefinedOptionalBooleanArg, info[1]->BooleanValue()); TONATIVE_VOID_INTERNAL(defaultUndefinedOptionalBooleanArg, info[1]->BooleanValue());
TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(defaultUndefinedOptionalLongArg, toInt32(info[2], exceptionState), exceptionState); TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(defaultUndefinedOptionalLongArg, toInt32(info[2], exceptionState), exceptionState);
......
...@@ -73,7 +73,7 @@ static void V8TestInterfaceNamedConstructor2ConstructorCallback(const v8::Functi ...@@ -73,7 +73,7 @@ static void V8TestInterfaceNamedConstructor2ConstructorCallback(const v8::Functi
} }
V8StringResource<> stringArg; V8StringResource<> stringArg;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(stringArg, info[0]); TOSTRING_VOID_INTERNAL(stringArg, info[0]);
} }
RefPtr<TestInterfaceNamedConstructor2> impl = TestInterfaceNamedConstructor2::createForJSConstructor(*document, stringArg); RefPtr<TestInterfaceNamedConstructor2> impl = TestInterfaceNamedConstructor2::createForJSConstructor(*document, stringArg);
......
...@@ -252,6 +252,7 @@ static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod(con ...@@ -252,6 +252,7 @@ static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethod(con
bool optionalBooleanArgument; bool optionalBooleanArgument;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
if (UNLIKELY(info.Length() <= 0)) { if (UNLIKELY(info.Length() <= 0)) {
v8SetReturnValueFast(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg()), impl); v8SetReturnValueFast(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg()), impl);
return; return;
...@@ -274,6 +275,7 @@ static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodForM ...@@ -274,6 +275,7 @@ static void perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArgMethodForM
bool optionalBooleanArgument; bool optionalBooleanArgument;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
if (UNLIKELY(info.Length() <= 0)) { if (UNLIKELY(info.Length() <= 0)) {
v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg())); v8SetReturnValueForMainWorld(info, WTF::getPtr(impl->perWorldBindingsTestInterfaceEmptyMethodOptionalBooleanArg()));
return; return;
......
...@@ -83,6 +83,7 @@ static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -83,6 +83,7 @@ static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterfaceWillBeGarbageCollected* arg; TestInterfaceWillBeGarbageCollected* arg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(arg, V8TestInterfaceWillBeGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), info[0])); TONATIVE_VOID_INTERNAL(arg, V8TestInterfaceWillBeGarbageCollected::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
} }
impl->func(arg); impl->func(arg);
...@@ -104,7 +105,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -104,7 +105,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
} }
V8StringResource<> str; V8StringResource<> str;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(str, info[0]); TOSTRING_VOID_INTERNAL(str, info[0]);
} }
RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::create(str); RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::create(str);
...@@ -151,7 +152,7 @@ static void V8TestInterfaceWillBeGarbageCollectedConstructorCallback(const v8::F ...@@ -151,7 +152,7 @@ static void V8TestInterfaceWillBeGarbageCollectedConstructorCallback(const v8::F
} }
V8StringResource<> str; V8StringResource<> str;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(str, info[0]); TOSTRING_VOID_INTERNAL(str, info[0]);
} }
RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::createForJSConstructor(*document, str); RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterfaceWillBeGarbageCollected::createForJSConstructor(*document, str);
......
...@@ -53,7 +53,7 @@ static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -53,7 +53,7 @@ static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder()); TestSpecialOperations* impl = V8TestSpecialOperations::toNative(info.Holder());
V8StringResource<> name; V8StringResource<> name;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(name, info[0]); TOSTRING_VOID_INTERNAL(name, info[0]);
} }
bool result0Enabled = false; bool result0Enabled = false;
RefPtrWillBeRawPtr<Node> result0; RefPtrWillBeRawPtr<Node> result0;
......
...@@ -103,6 +103,7 @@ static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V ...@@ -103,6 +103,7 @@ static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V
Vector<int> arrayOfLongsArg; Vector<int> arrayOfLongsArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
if (UNLIKELY(info.Length() <= 0)) { if (UNLIKELY(info.Length() <= 0)) {
impl->voidMethodArrayOfLongsArg(); impl->voidMethodArrayOfLongsArg();
return; return;
...@@ -130,6 +131,7 @@ static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: ...@@ -130,6 +131,7 @@ static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8:
V8StringResource<> stringArg; V8StringResource<> stringArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[0]->NumberValue())); TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[0]->NumberValue()));
TOSTRING_VOID_INTERNAL(stringArg, info[1]); TOSTRING_VOID_INTERNAL(stringArg, info[1]);
} }
...@@ -178,6 +180,7 @@ static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ...@@ -178,6 +180,7 @@ static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun
Vector<RefPtr<TestInterfaceEmpty> > testInterfaceEmptyTypeSequenceArg; Vector<RefPtr<TestInterfaceEmpty> > testInterfaceEmptyTypeSequenceArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(testInterfaceEmptyTypeSequenceArg, (toRefPtrNativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate()))); TONATIVE_VOID_INTERNAL(testInterfaceEmptyTypeSequenceArg, (toRefPtrNativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate())));
} }
v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfaceEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg))); v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfaceEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg)));
...@@ -226,6 +229,7 @@ static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ...@@ -226,6 +229,7 @@ static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba
Vector<String> arrayOfStringsArg; Vector<String> arrayOfStringsArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(arrayOfStringsArg, toNativeArray<String>(info[0], 1, info.GetIsolate())); TONATIVE_VOID_INTERNAL(arrayOfStringsArg, toNativeArray<String>(info[0], 1, info.GetIsolate()));
} }
v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(arrayOfStringsArg), info.Holder(), info.GetIsolate())); v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(arrayOfStringsArg), info.Holder(), info.GetIsolate()));
...@@ -248,6 +252,7 @@ static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo ...@@ -248,6 +252,7 @@ static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo
Vector<String> stringArrayArg; Vector<String> stringArrayArg;
{ {
v8::TryCatch block; v8::TryCatch block;
V8RethrowTryCatchScope rethrow(block);
TONATIVE_VOID_INTERNAL(stringArrayArg, toNativeArray<String>(info[0], 1, info.GetIsolate())); TONATIVE_VOID_INTERNAL(stringArrayArg, toNativeArray<String>(info[0], 1, info.GetIsolate()));
} }
v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringArrayArg), info.Holder(), info.GetIsolate())); v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringArrayArg), info.Holder(), info.GetIsolate()));
...@@ -269,7 +274,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) ...@@ -269,7 +274,7 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
} }
V8StringResource<> stringArg; V8StringResource<> stringArg;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(stringArg, info[0]); TOSTRING_VOID_INTERNAL(stringArg, info[0]);
} }
RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg); RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg);
......
...@@ -939,6 +939,30 @@ private: ...@@ -939,6 +939,30 @@ private:
void GetDevToolsFunctionInfo(v8::Handle<v8::Function>, v8::Isolate*, int& scriptId, String& resourceName, int& lineNumber); void GetDevToolsFunctionInfo(v8::Handle<v8::Function>, v8::Isolate*, int& scriptId, String& resourceName, int& lineNumber);
PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(ExecutionContext*, v8::Handle<v8::Function>, v8::Isolate*); PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(ExecutionContext*, v8::Handle<v8::Function>, v8::Isolate*);
class V8RethrowTryCatchScope FINAL {
public:
explicit V8RethrowTryCatchScope(v8::TryCatch& block) : m_block(block) { }
~V8RethrowTryCatchScope()
{
// ReThrow() is a no-op if no exception has been caught, so always call.
m_block.ReThrow();
}
private:
v8::TryCatch& m_block;
};
class V8ResetTryCatchScope FINAL {
public:
explicit V8ResetTryCatchScope(v8::TryCatch& block) : m_block(block) { }
~V8ResetTryCatchScope()
{
m_block.Reset();
}
private:
v8::TryCatch& m_block;
};
} // namespace WebCore } // namespace WebCore
......
...@@ -47,17 +47,16 @@ namespace WebCore { ...@@ -47,17 +47,16 @@ namespace WebCore {
} }
#define TONATIVE_VOID_INTERNAL(var, value) \ #define TONATIVE_VOID_INTERNAL(var, value) \
var = (value); \ var = (value); \
if (UNLIKELY(block.HasCaught())) { \ if (UNLIKELY(block.HasCaught())) \
block.ReThrow(); \ return;
return; \
}
#define TONATIVE_VOID(type, var, value) \ #define TONATIVE_VOID(type, var, value) \
type var; \ type var; \
{ \ { \
v8::TryCatch block; \ v8::TryCatch block; \
TONATIVE_VOID_INTERNAL(var, value); \ V8RethrowTryCatchScope rethrow(block); \
TONATIVE_VOID_INTERNAL(var, value); \
} }
#define TONATIVE_DEFAULT(type, var, value, retVal) \ #define TONATIVE_DEFAULT(type, var, value, retVal) \
...@@ -106,15 +105,7 @@ namespace WebCore { ...@@ -106,15 +105,7 @@ namespace WebCore {
#define TOSTRING_VOID_INTERNAL(var, value) \ #define TOSTRING_VOID_INTERNAL(var, value) \
var = (value); \ var = (value); \
if (UNLIKELY(!var.prepare())) { \ if (UNLIKELY(!var.prepare())) \
block.ReThrow(); \
return; \
}
// There are no v8::TryCatch declared outside.
#define TOSTRING_VOID_INTERNAL_NOTRYCATCH(var, value) \
var = (value); \
if (UNLIKELY(!var.prepare())) \
return; return;
#define TOSTRING_DEFAULT(type, var, value, retVal) \ #define TOSTRING_DEFAULT(type, var, value, retVal) \
......
...@@ -97,7 +97,7 @@ void V8Document::createEventMethodCustom(const v8::FunctionCallbackInfo<v8::Valu ...@@ -97,7 +97,7 @@ void V8Document::createEventMethodCustom(const v8::FunctionCallbackInfo<v8::Valu
Document* impl = V8Document::toNative(info.Holder()); Document* impl = V8Document::toNative(info.Holder());
V8StringResource<> eventType; V8StringResource<> eventType;
{ {
TOSTRING_VOID_INTERNAL_NOTRYCATCH(eventType, info[0]); TOSTRING_VOID_INTERNAL(eventType, info[0]);
} }
RefPtrWillBeRawPtr<Event> result = createEventModules(eventType, exceptionState); RefPtrWillBeRawPtr<Event> result = createEventModules(eventType, exceptionState);
if (exceptionState.hadException()) { if (exceptionState.hadException()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment