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

Unified Diff: Source/bindings/tests/results/V8TestInterface2.cpp

Issue 232563003: API functions returning Promises should not throw exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/tests/results/V8TestInterface2.cpp
diff --git a/Source/bindings/tests/results/V8TestInterface2.cpp b/Source/bindings/tests/results/V8TestInterface2.cpp
index 5830141422460c4ba7e46c336047ee88bc3cd5e7..790c891752024987bdeec4d74fbfb11fbba2afdb 100644
--- a/Source/bindings/tests/results/V8TestInterface2.cpp
+++ b/Source/bindings/tests/results/V8TestInterface2.cpp
@@ -58,8 +58,10 @@ static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
TONATIVE_VOID_EXCEPTIONSTATE(unsigned, index, toUInt32(info[0], exceptionState), exceptionState);
RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
- if (exceptionState.throwIfNeeded())
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
return;
+ }
v8SetReturnValue(info, result.release());
}
@@ -81,8 +83,10 @@ static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TONATIVE_VOID_EXCEPTIONSTATE(unsigned, index, toUInt32(info[0], exceptionState), exceptionState);
TOSTRING_VOID(V8StringResource<>, value, info[1]);
String result = impl->setItem(index, value, exceptionState);
- if (exceptionState.throwIfNeeded())
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
return;
+ }
v8SetReturnValueString(info, result, info.GetIsolate());
}
@@ -103,8 +107,10 @@ static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
TONATIVE_VOID_EXCEPTIONSTATE(unsigned, index, toUInt32(info[0], exceptionState), exceptionState);
bool result = impl->deleteItem(index, exceptionState);
- if (exceptionState.throwIfNeeded())
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
return;
+ }
v8SetReturnValueBool(info, result);
}
@@ -125,8 +131,10 @@ static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
TOSTRING_VOID(V8StringResource<>, name, info[0]);
RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
- if (exceptionState.throwIfNeeded())
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
return;
+ }
v8SetReturnValue(info, result.release());
}
@@ -148,8 +156,10 @@ static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
TOSTRING_VOID(V8StringResource<>, name, info[0]);
TOSTRING_VOID(V8StringResource<>, value, info[1]);
String result = impl->setNamedItem(name, value, exceptionState);
- if (exceptionState.throwIfNeeded())
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
return;
+ }
v8SetReturnValueString(info, result, info.GetIsolate());
}
@@ -170,8 +180,10 @@ static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf
TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
TOSTRING_VOID(V8StringResource<>, name, info[0]);
bool result = impl->deleteNamedItem(name, exceptionState);
- if (exceptionState.throwIfNeeded())
+ if (exceptionState.hadException()) {
+ exceptionState.throwIfNeeded();
return;
+ }
v8SetReturnValueBool(info, result);
}

Powered by Google App Engine
This is Rietveld 408576698