mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
JavascriptAsyncMethodHandler - Obtain Promise from context on Execute
Previously the promise reference was passed into the handler, now we obtain the reference on demand
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "../CefSharp.Core/Internals/Messaging/Messages.h"
|
||||
#include "../CefSharp.Core/Internals/Serialization/Primitives.h"
|
||||
#include "Serialization/V8Serialization.h"
|
||||
#include "CefAppUnmanagedWrapper.h"
|
||||
|
||||
using namespace CefSharp::Internals::Messaging;
|
||||
using namespace CefSharp::Internals::Serialization;
|
||||
@@ -21,8 +22,11 @@ namespace CefSharp
|
||||
{
|
||||
auto context = CefV8Context::GetCurrentContext();
|
||||
auto browser = context->GetBrowser();
|
||||
|
||||
auto promiseCreator = context->GetGlobal()->GetValue(CefAppUnmanagedWrapper::kPromiseCreatorFunction);
|
||||
|
||||
//this will create a promise and give us the reject/resolve functions {p: Promise, res: resolve(), rej: reject()}
|
||||
auto promiseData = _promiseCreator->ExecuteFunctionWithContext(context, nullptr, CefV8ValueList());
|
||||
auto promiseData = promiseCreator->ExecuteFunctionWithContext(context, nullptr, CefV8ValueList());
|
||||
retval = promiseData->GetValue("p");
|
||||
|
||||
auto resolve = promiseData->GetValue("res");
|
||||
|
||||
Reference in New Issue
Block a user