In the 'stuff I should have done earlier' category: this sets a stack quota for JS scripts. Infinite loops, instead of segfaulting weirdly, will now throw JS exceptions, making them eminently more debuggable.
The function seems to expect an actual stack size, and from what I've found 1MB is standard on windows, so I've picked 900KB.
This needs testing on all platforms.