bcoe / sandcastle

A simple and powerful sandbox for running untrusted JavaScript.
MIT License
220 stars 48 forks source link

Pass globals on re-run #47

Closed danslimmon closed 9 years ago

danslimmon commented 9 years ago

Without this, you end up with nasty race conditions when you're using globals and the sandcastle gets kicked over. E.g.:

  1. Pass while(true){} to sandcastle
  2. Before that script is finished, pass exit(some_globals_variable) to sandcastle
  3. Sandcastle gets kicked over because the while(true){} timed out
  4. The new sandcastle runs exit(some_globals_variable), but now it has no globals so the script crashes
bcoe commented 9 years ago

@danslimmon thanks for the patch. I've added you as a contributor to the project, so that you can create branches on the canonical repo going forward.