Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First fix for not immune to while(1){} #244

Merged
merged 2 commits into from
Sep 14, 2019

Conversation

XmiliaH
Copy link
Collaborator

@XmiliaH XmiliaH commented Sep 14, 2019

This does not fix the Promise & async problems

@XmiliaH
Copy link
Collaborator Author

XmiliaH commented Sep 14, 2019

And for the async problem I currently have no idea to fix it.

lib/main.js Outdated
};

const TIMEOUT_CONTEXT = vm.createContext();
Copy link
Owner

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(()=>{
Copy link
Owner

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.

@patriksimek patriksimek merged commit a63bef7 into patriksimek:master Sep 14, 2019
@patriksimek
Copy link
Owner

Thanks.

@OrkhanAlikhanov
Copy link

@XmiliaH What are the "Promise & async problems"? Couldn't find mention of it anywhere

@XmiliaH
Copy link
Collaborator Author

XmiliaH commented Oct 23, 2019

@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.

@OrkhanAlikhanov
Copy link

Thank you for the quick response!

@fangk
Copy link

fangk commented Jan 15, 2020

https://medium.com/@bvjebin/js-infinite-loops-killing-em-e1c2f5f2db7f
can we use babel inject code into WhileStatement and ForStatement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants