-
Notifications
You must be signed in to change notification settings - Fork 81
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
beautifyJs why what will execute my script? #127
Comments
Is there an error in the JavaScript file that should be run? |
There should be no errors, I wonder why beautifyJs would execute my script, is it not just glorification, and this is an occasional problem. |
Beautify will run for all scripts. It is used to simplify the formatting of scripts so that it is easier to inject the statements for the sandbox. Since Beautify will run for all scripts - I would assume it is either a problem with the script or if it is intermittent Nashorn? Here for reference the code that injects the statements for the sandbox (and uses beautify): https://github.com/javadelight/delight-nashorn-sandbox/blob/master/src/main/java/delight/nashornsandbox/internal/JsSanitizer.java |
I don't think this is the problem of JS script, because it is an occasional problem rather than a necessary problem. In addition, I think beautify JS will only format my JS text, but I don't know if it will execute my JS |
The beautify does not run the code - it only changes the code, and then it is run by Nashorn. My guess is there is a different problem causing the error (and it has nothing to do with beautify). You can enable debugging |
Caused by: ECMAException: TypeError: Cannot get property "length" of null\n
at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)\n
at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)\n
at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)\n
at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)\n
at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkNull(NashornBottomLinker.java:183)\n
at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:66)\n
at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)\n
at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:154)\n
at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:253)\n
at jdk.nashorn.internal.scripts.Script$Recompilation$92$128098A$^eval_.L:10#L:3403#TokenStream(:3439)\n
at jdk.nashorn.internal.scripts.Script$Recompilation$90$124532$^eval_.L:10#L:3256#tokenize(:3311)\n
at jdk.nashorn.internal.scripts.Script$Recompilation$59$13770A$^eval_.L:10#L:199#_reset(:427)\n
at jdk.nashorn.internal.scripts.Script$Recompilation$58$15003$^eval_.L:10#L:199#beautify(:438)\n
at jdk.nashorn.internal.scripts.Script$Recompilation$50$7249AA$^eval_.L:10#L:150#js_beautify(:188)\n
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:641)\n
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)\n
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)\n
at jdk.nashorn.api.scripting.ScriptObjectMirror.call(ScriptObjectMirror.java:117)\n
at delight.nashornsandbox.internal.JsSanitizer.lambda$beautifierAsFunction$1(JsSanitizer.java:320)\n
at delight.nashornsandbox.internal.JsSanitizer.beautifyJs(JsSanitizer.java:292)\n
at delight.nashornsandbox.internal.JsSanitizerExt.secureJs(JsSanitizerExt.java:36)\n
The text was updated successfully, but these errors were encountered: