| Index: Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
|
| diff --git a/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp b/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
|
| index 1b5d8149d40ec2ca1f2a601b4b5556727b0cb6b5..19c8da7ee8fa5048bcb9f03cd075d47b1087aac7 100644
|
| --- a/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
|
| +++ b/Source/bindings/v8/custom/V8PromiseResolverCustom.cpp
|
| @@ -39,20 +39,53 @@ namespace WebCore {
|
|
|
| void V8PromiseResolver::fulfillMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| {
|
| + v8::Local<v8::Object> resolver = args.This();
|
| + if (V8PromiseCustom::isInternalDetached(resolver))
|
| + return;
|
| + v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver);
|
| + if (V8PromiseCustom::getState(internal) != V8PromiseCustom::Pending)
|
| + return;
|
| + V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet);
|
| +
|
| + v8::Isolate* isolate = args.GetIsolate();
|
| + v8::Local<v8::Value> result = v8::Undefined();
|
| + if (args.Length() > 0)
|
| + result = args[0];
|
| + V8PromiseCustom::fulfillResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
|
| +}
|
| +
|
| +void V8PromiseResolver::resolveMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| +{
|
| + v8::Local<v8::Object> resolver = args.This();
|
| + if (V8PromiseCustom::isInternalDetached(resolver))
|
| + return;
|
| + v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver);
|
| + if (V8PromiseCustom::getState(internal) != V8PromiseCustom::Pending)
|
| + return;
|
| + V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet);
|
| +
|
| v8::Isolate* isolate = args.GetIsolate();
|
| v8::Local<v8::Value> result = v8::Undefined();
|
| if (args.Length() > 0)
|
| result = args[0];
|
| - V8PromiseCustom::fulfillResolver(args.This(), result, V8PromiseCustom::Asynchronous, isolate);
|
| + V8PromiseCustom::resolveResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
|
| }
|
|
|
| void V8PromiseResolver::rejectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
|
| {
|
| + v8::Local<v8::Object> resolver = args.This();
|
| + if (V8PromiseCustom::isInternalDetached(resolver))
|
| + return;
|
| + v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver);
|
| + if (V8PromiseCustom::getState(internal) != V8PromiseCustom::Pending)
|
| + return;
|
| + V8PromiseCustom::setState(internal, V8PromiseCustom::PendingWithResolvedFlagSet);
|
| +
|
| v8::Isolate* isolate = args.GetIsolate();
|
| v8::Local<v8::Value> result = v8::Undefined();
|
| if (args.Length() > 0)
|
| result = args[0];
|
| - V8PromiseCustom::rejectResolver(args.This(), result, V8PromiseCustom::Asynchronous, isolate);
|
| + V8PromiseCustom::rejectResolver(resolver, result, V8PromiseCustom::Asynchronous, isolate);
|
| }
|
|
|
| } // namespace WebCore
|
|
|