mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
Replaced kPromiseCreatorScript with native promise
This commit is contained in:
committed by
Alex Maitland
parent
e9bc7f3c02
commit
e3012e8ecb
@@ -13,13 +13,11 @@ namespace CefSharp
|
||||
{
|
||||
void JavascriptAsyncMethodCallback::Success(const CefRefPtr<CefV8Value>& result)
|
||||
{
|
||||
if (_resolve.get() && _context.get() && _context->Enter())
|
||||
if (_promise.get() && _context.get() && _context->Enter())
|
||||
{
|
||||
try
|
||||
{
|
||||
CefV8ValueList args;
|
||||
args.push_back(result);
|
||||
_resolve->ExecuteFunction(nullptr, args);
|
||||
_promise->ResolvePromise(result);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -30,13 +28,11 @@ namespace CefSharp
|
||||
|
||||
void JavascriptAsyncMethodCallback::Fail(const CefString& exception)
|
||||
{
|
||||
if (_reject.get() && _context.get() && _context->Enter())
|
||||
if (_promise.get() && _context.get() && _context->Enter())
|
||||
{
|
||||
try
|
||||
{
|
||||
CefV8ValueList args;
|
||||
args.push_back(CefV8Value::CreateString(exception));
|
||||
_reject->ExecuteFunction(nullptr, args);
|
||||
_promise->RejectPromise(exception);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user