How to get ExecuteJavaScript() to return the result of a Promise?

3D WebView's ExecuteJavaScript() method returns a string representation of the result of evaluating the given JavaScript. So, if the given JavaScript returns a Promise, the method will just return the string "[object Promise]", which is the result of calling the Promise's toString() method. ExecuteJavaScript() doesn't currently have the ability to await a Promise returned by the given JavaScript, but you can use 3D WebView's message passing API to send a message from JavaScript to C# when the Promise is resolved, like this:

// Use MessageEmitted to listen for a message sent from JavaScript.
await webViewPrefab.WaitUntilInitialized();
webViewPrefab.WebView.MessageEmitted += (sender, eventArgs) => {
    Debug.Log("Result received - " + eventArgs.Value);
};

// Sometime later, run some JavaScript that returns a Promise
// and use vuplex.postMessage() to send the result to C#.
await webViewPrefab.WebView.WaitForNextPageLoadToFinish();
webViewPrefab.WebView.ExecuteJavaScript(
    @"(async () => {
        const result = await someAsyncFunction();
        vuplex.postMessage('result:' + result);
    })()"
);