Index: third_party/WebKit/Source/bindings/templates/methods.cpp |
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp b/third_party/WebKit/Source/bindings/templates/methods.cpp |
index 7da229e550055d6fe6ba1edcd669ed0be57fdff7..5073b50e5bda688c530eeb6ffcaca9426e7323f3 100644 |
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp |
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp |
@@ -33,16 +33,16 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const |
// didn't work in this case. |
if (const DOMWindow* window = impl->toDOMWindow()) { |
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), currentDOMWindow(info.GetIsolate()), window, exceptionState)) { |
- {% if not method.returns_promise %} |
- exceptionState.throwIfNeeded(); |
+ {% if method.returns_promise %} |
+ exceptionState.clearException(); |
{% endif %} |
return; |
} |
} |
{% else %}{# interface_name == 'EventTarget' #} |
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), currentDOMWindow(info.GetIsolate()), impl, exceptionState)) { |
- {% if not method.returns_promise %} |
- exceptionState.throwIfNeeded(); |
+ {% if method.returns_promise %} |
+ exceptionState.clearException(); |
{% endif %} |
return; |
} |
@@ -51,8 +51,8 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const |
{% if method.is_check_security_for_return_value %} |
if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), currentDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) { |
v8SetReturnValueNull(info); |
- {% if not method.returns_promise %} |
- exceptionState.throwIfNeeded(); |
+ {% if method.returns_promise %} |
+ exceptionState.clearException(); |
{% endif %} |
return; |
} |
@@ -208,7 +208,6 @@ if (!{{argument.name}}{% if argument.is_nullable %} && !isUndefinedOrNull(info[{ |
{# Invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enums #} |
{{declare_enum_validation_variable(argument.enum_values)}} |
if (!isValidEnum({{argument.name}}, validValues, WTF_ARRAY_LENGTH(validValues), "{{argument.enum_type}}", exceptionState)) { |
- exceptionState.throwIfNeeded(); |
return; |
} |
{% elif argument.idl_type == 'Promise' %} |
@@ -320,8 +319,9 @@ ExceptionMessages::failedToExecute("{{method.name}}", "{{interface_name}}", {{er |
{% macro propagate_error_with_exception_state(method_or_overloads) %} |
{% if method_or_overloads.returns_promise_all %} |
v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIsolate())).v8Value()); |
-{% elif not method_or_overloads.returns_promise %} |
-exceptionState.throwIfNeeded(); |
+{% endif %} |
+{% if method_or_overloads.returns_promise_all or method_or_overloads.returns_promise %} |
+exceptionState.clearException(); |
{% endif %} |
return; |
{%- endmacro %} |
@@ -466,24 +466,21 @@ void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance, const v |
ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage", interfaceName, info.Holder(), info.GetIsolate()); |
if (UNLIKELY(info.Length() < 1)) { |
setMinimumArityTypeError(exceptionState, 1, info.Length()); |
- exceptionState.throwIfNeeded(); |
return; |
} |
Transferables transferables; |
if (info.Length() > 1) { |
const int transferablesArgIndex = 1; |
if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info[transferablesArgIndex], transferablesArgIndex, transferables, exceptionState)) { |
- exceptionState.throwIfNeeded(); |
return; |
} |
} |
RefPtr<SerializedScriptValue> message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], &transferables, nullptr, exceptionState); |
- if (exceptionState.throwIfNeeded()) |
+ if (exceptionState.hadException()) |
return; |
// FIXME: Only pass context/exceptionState if instance really requires it. |
ExecutionContext* context = currentExecutionContext(info.GetIsolate()); |
instance->postMessage(context, message.release(), transferables.messagePorts, exceptionState); |
- exceptionState.throwIfNeeded(); |
} |
{% endmacro %} |