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
Questions about the beautifier and why it is needed #110
Comments
Thank you for your question @MrLi2018 ! The beautifier is used to make it easier for the subsequent steps to inject the statements that check if the process needs to be interrupted. I guess if we would construct an AST of the JS and then compile it into JS again, we could maybe omit this. Or maybe through some more clever regexes - but for the time being, the injections won't work without it. |
What do you mean by injection? Beautifier is only used to format JS. If JS is not required in the program, can it be deleted? Or is it having other security concerns? @mxro @tangrammer @turbanoff @obourgain |
Hello, I am not a maintainer, so can only speak about my understanding of the code. The beautifier is used to format the script in this method, and then once it is properly formatted, it will inject some code in some parts of the script here for the list The interruption flag is used to make a script exit, for example if it went over its allocated cpu time. I don't understand what you mean by For my project we did two changes to reduce the cost of the beautifier:
|
Thank you for answering the question. However, during program debugging, I found that I only used this code.(final String preamble = getPreamble();return preamble + injectedJs;) Therefore, I wanted to ask whether to remove jsbeautiful in certain scenarios because it was time-consuming, and I tried to rewrite the JsSanitizer class and remove jsbeautiful only to use splicing, and ut passed, so I don't understand if it's necessary, in some scenarios. @obourgain |
in NashornSandboxImpl you can override method |
Evaluating the beautifier.js file is time-consuming. Can it be deleted or closed? What problems does it solve?
scriptEngine.eval(getBeautifyJs()); It takes a long time. Can you set the switch to disable it?
The text was updated successfully, but these errors were encountered: