mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 11:42:36 +00:00
JSB - Remove promise creator Extension
Backport changes from https://github.com/cefsharp/CefSharp/commit/7450d0d51b1d8bfbe7f3aedc7ce8fe3c96e83c03 Add .editorconfig to fix formatting
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
// Copyright © 2010-2017 The CefSharp Authors. All rights reserved.
|
||||
// Copyright © 2010-2017 The CefSharp Authors. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "JavascriptAsyncMethodHandler.h"
|
||||
#include "CefAppUnmanagedWrapper.h"
|
||||
#include "../CefSharp.Core/Internals/Messaging/Messages.h"
|
||||
#include "../CefSharp.Core/Internals/Serialization/Primitives.h"
|
||||
#include "Serialization/V8Serialization.h"
|
||||
@@ -21,8 +22,18 @@ namespace CefSharp
|
||||
{
|
||||
auto context = CefV8Context::GetCurrentContext();
|
||||
auto browser = context->GetBrowser();
|
||||
|
||||
CefRefPtr<CefV8Value> promiseData;
|
||||
CefRefPtr<CefV8Exception> promiseException;
|
||||
|
||||
//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());
|
||||
if (!context->Eval(CefAppUnmanagedWrapper::kPromiseCreatorScript, CefString(), 0, promiseData, promiseException))
|
||||
{
|
||||
exception = promiseException->GetMessage();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
retval = promiseData->GetValue("p");
|
||||
|
||||
auto resolve = promiseData->GetValue("res");
|
||||
|
||||
Reference in New Issue
Block a user