5 ms·
> Attempting to sandbox user-supplied Javascript just seems like an exercise in futility. You just need to run the javascript in a interpreter written in javas
by daenz 12y ago
> Attempting to sandbox user-supplied Javascript just seems like an exercise in futility.
You just need to run the javascript in a interpreter written in javascript /sarcasm
>> EDIT: oh god it's real https://github.com/mozilla/narcissus https://github.com/mozilla/narcissus
- Igglyboo 12y agoWait what? Wouldn't a js2js interpreter just be eval()??? How is this more than a joke project?
- roywiggins 12y agoeval() calls the interpreter that's running the current code with some arbitrary string. The code that's interpreting it is not Javascript; you can't poke around and change it without recompiling whatever binary it is. Implementing Javascript in Javascript lets you quickly play with new features: you can add features to the toy interpreter more easily than nodejs. There's a long tradition of self-hosting compilers: C is compiled with programs that were written in C. PyPy is a Python interpreter written in Python (actually RPython but it's a subset of Python). http://en.wikipedia.org/wiki/History_of_compiler_construction#Self-hosting_compilers http://en.wikipedia.org/wiki/History_of_compiler_constructio...