-
Notifications
You must be signed in to change notification settings - Fork 298
First fix for not immune to while(1){} #244
Conversation
And for the async problem I currently have no idea to fix it. |
lib/main.js
Outdated
}; | ||
|
||
const TIMEOUT_CONTEXT = vm.createContext(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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