OMG. I have been working on some code in the playground. I almost had just lost some hours of work because of a really stupid mistake that got me stuck in an infnite while-loop
Credits to this guy. But I do believe this is definitely worth sharing here too:
Open DevTools
Open the Sources panel
Click Pause. The button changes to Resume Script Execution.
Click and hold Resume Script Execution. Then choose Stop Current JavaScript Call. It is the little square in the drop-down.
This has happened to me a lot of times and unfortunately I was never able to open the dev tools (maybe it’s MacOS specific). It would be pretty cool to save the PG to localstorage before it is executed so in such cases it can be restored manually.
Thanks for the tip anyway! I bet it will save somene’s bacon for sure
If I open DevTools in advance, it works, but
when I open DevTools during an infinite loop, it doesn’t change from pause to Resume Script Execution.
in case window chrome (About the Lost PG )
maybe set the limit how many PGs can be stored (LIFO), defaulting to 20? Since this would be used just for recovery, maybe we don’t even need this input and we could hardcode this value.
Restoring the PG would be done manually. (docs)
We can upgrade the GUI later – to be nicer to the programmers and give them a more user friendly tool to browse/restore the stored PGs.
I’d like to add that I know about your policy to not store anything (or only the absolute minimum) in the user’s browser storage. This is an edge/emergency case and needs to be really considered to make an exception from this rule.