Closed Bobris closed 6 years ago
Hello, Boris!
JavaScript Engine Switcher does not support the return of promises. Quote from the documentation: “JavaScript Engine Switcher determines unified interface for access to the basic features of popular JavaScript engines (MSIE JavaScript Engine for .Net, Microsoft ClearScript.V8, Jurassic, Jint and ChakraCore).”.
I don't need to support returning of Promises (at least not in begging). This will fail as soon as you will use Promises inside JS. Question is will you accept pull request which would add support for this eventhough it would be supported only in ChakraCore? (it would be testable behind "Support" getter similiar to other support checks.)
Question is will you accept pull request which would add support for this eventhough it would be supported only in ChakraCore? (it would be testable behind "Support" getter similiar to other support checks.)
No, because it's atypical functionality. SupportsScriptInterruption
and SupportsGarbageCollection
properties are return true
for most engines and is responsible for secondary functionality.
I don't need to support returning of Promises (at least not in begging).
I will try to fix this error. You could give the most simple example of JS code, that causes this error.
It cannot (or actually should not) be fixed without adding "DrainPromiseTaskQueue" method. In threory you could call this kind of method internally after each JS code run. But in that sense it will be probably more correct to implement my own Promise polyfill and don't use Native Promises at all. Anyway thanks for information, that I should not waste time to implement this myself. (Will add sample, after I will get home to work on OSS :-))
Do you use only the JavaScriptEngineSwitcher.ChakraCore module?
Yes because it is most platform independent (it covers Windows, Linux, Mac) with good enough performance.
So here is small example code which will fail with that error message:
jsEngine.Execute("var p = new Promise(r=>r(\"OK\")); p.then(r=>{});");
Msie and Vroom fails on ES6 lambda methods ... So Chakra is only modern engine in switcher ... Anyway I will go with polyfill route so it will be engine independent.
Hello, Boris!
In version 3.0.0 Alpha 4 prevented an occurrence of the “Host may not have set any promise continuation callback. Promises may not be executed.” error.
At the moment, only two engines support the promises: JavaScriptEngineSwitcher.ChakraCore and JavaScriptEngineSwitcher.V8 (not compatible with .NET Standard).
I am afraid that this solution will stack overflow for long Promise chains, but definitely good start. Didn't expected you will work on it.
I am afraid that this solution will stack overflow for long Promise chains...
Already on some code occurred errors?
No currectly. At least bundled postcss correctly processed bootstrap css. Luckily my real world usecase is simple enough. So thanks again for implementing it.
@Bobris I moved the corresponding functionality from 3.X branch to version 2.4.12.
NiL.JS supports full ES6.
Currently when I use Promises inside Chakra it throws with this message:
JavaScriptEngineSwitcher.Core.JsRuntimeException : Error: Host may not have set any promise continuation callback. Promises may not be executed.