-
-
Notifications
You must be signed in to change notification settings - Fork 30
remove use of eval by doing our own string parsing #118
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for posting this, I will review this in the next couple of weeks. Note that the JS implementation here runs in addition to the Wasm implementation, where the JS implementation is only used when Wasm is not otherwise supported on the system. So - the implementation needs to be copied verbatim to the |
|
Oh, I see this is in the JS wrapper so it applies to the Wasm path - we just need to be careful to ensure both the JS entry point and the Wasm entry point support the feature I think? One other thought I had here - Wasm might itself be disabled by turning off eval, I'm not sure though, in which case perhaps it is the JS path that matters for the feature. |
|
I guess I need to copy this into |
|
That makes sense. Yeah so it just needs to be in both wrappers then most likely. It would be nice to see some tests for the coverage cases though. |
|
Happy to add tests. In |
|
Updated the pure-js impl and added a couple tests for other kinds of escape sequences. The existing tests already covered a few of them. And I added Also, |
Fixes #117.
I ended up just writing this myself because existing parsers are concerned with location information and etc, which is not relevant here.
It's technically very slightly too permissive in that it always allows
\8and\9in string literals, which are legal only in non-strict code, but I don't think this should matter in this application. I didn't bother with useful error messages because it's just eating the errors anyway.