First fix for not immune to while(1){}#244
Conversation
|
And for the async problem I currently have no idea to fix it. |
| runTimeout: new VMScript('fn()', 'timeout_bridge.js')._compileVM() | ||
| }; | ||
|
|
||
| const TIMEOUT_CONTEXT = vm.createContext(); |
There was a problem hiding this comment.
I'd suggest changing that to const TIMEOUT_CONTEXT = null and moving vm.createContext() inside the doWithTimeout function. Just a performance tweak for situations when timeout is not used.
| } catch (e) { | ||
| throw this._internal.Decontextify.value(e); | ||
| } | ||
| return doWithTimeout(()=>{ |
There was a problem hiding this comment.
We should use doWithTimeout only when timeout is specified. Related to my previous comment.
|
Thanks. |
|
@XmiliaH What are the "Promise & async problems"? Couldn't find mention of it anywhere |
|
@OrkhanAlikhanov see #180 (comment). However, there is currently a PR #246 that tries to address this issue by disallowing scripts with the word async and patching Promise. This has some sideeffects, for example eval can't be used as direct eval any more. |
|
Thank you for the quick response! |
|
https://medium.com/@bvjebin/js-infinite-loops-killing-em-e1c2f5f2db7f |
This does not fix the Promise & async problems