| Index: Source/bindings/v8/V8BindingMacros.h
|
| diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h
|
| index f5ab5832bef8783b2b6e8890d6f03dce09915a27..4b30694221b7b490f11dc2c1aa152a46e99c24f0 100644
|
| --- a/Source/bindings/v8/V8BindingMacros.h
|
| +++ b/Source/bindings/v8/V8BindingMacros.h
|
| @@ -86,6 +86,33 @@ namespace WebCore {
|
| return; \
|
| }
|
|
|
| +#define V8TRYCATCH_VOID_PROMISE(type, var, value, info) \
|
| + type var; \
|
| + { \
|
| + v8::TryCatch block; \
|
| + var = (value); \
|
| + if (UNLIKELY(block.HasCaught())) { \
|
| + v8::Isolate* isolate = info.GetIsolate(); \
|
| + ScriptPromise promise = ScriptPromise::reject(block.Exception(), isolate); \
|
| + v8SetReturnValue(info, promise.v8Value()); \
|
| + return; \
|
| + } \
|
| + }
|
| +
|
| +#define V8TRYCATCH_EXCEPTION_VOID_PROMISE(type, var, value, info, exceptionState) \
|
| + type var; \
|
| + { \
|
| + v8::TryCatch block; \
|
| + var = (value); \
|
| + v8::Isolate* isolate = info.GetIsolate(); \
|
| + if (UNLIKELY(block.HasCaught())) \
|
| + exceptionState.rethrowV8Exception(block.Exception()); \
|
| + if (UNLIKELY(exceptionState.hadException())) { \
|
| + v8SetReturnValue(info, exceptionState.rejectedPromise().v8Value()); \
|
| + return; \
|
| + } \
|
| + }
|
| +
|
| #define V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, retVal) \
|
| type var(value); \
|
| if (UNLIKELY(!var.prepare())) \
|
| @@ -96,6 +123,19 @@ namespace WebCore {
|
| if (UNLIKELY(!var.prepare())) \
|
| return;
|
|
|
| +#define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID_PROMISE(type, var, value, info) \
|
| + type var(value); \
|
| + { \
|
| + v8::TryCatch block; \
|
| + var.prepare(); \
|
| + if (UNLIKELY(block.HasCaught())) { \
|
| + v8::Isolate* isolate = info.GetIsolate(); \
|
| + ScriptPromise promise = ScriptPromise::reject(block.Exception(), isolate); \
|
| + v8SetReturnValue(info, promise.v8Value()); \
|
| + return; \
|
| + } \
|
| + }
|
| +
|
| } // namespace WebCore
|
|
|
| #endif // V8BindingMacros_h
|
|
|