When you get an infinite loop in jsfiddle in Chrome, your only choice (that I know of) is to close the tab. Of course, this means you lose all your work in the current wind
I couldn't start Chrome's Task Manager while the looping tab was active. I had to select another tab. Then I pressed Shift-Escape to launch the Task Manager, kill the JSFiddle process, re-select the tab, and hit the back button to display the page without running the script.
JSFiddle loads the "result" panel using an iframe. As of June 2016, the URL for the frame is the Fiddle URL plus "/show/". I inspected the source code of the iframe and discovered that it loads yet another URL with "/light/". One of these URLs should contain your source code.
If your browser supports the view-source URI scheme, you may access your fiddle's source code as follows:
With the developer mode, go into resources and find your script and copy and paste it into a text document or a new window. If you can't find it in resources, do a search for a variable or line of code you used.
How to do it without Developer Mode:
Or on MacOS,
Run Process Explorer and kill the chrome process that's using lots of CPU...it will "crash" the page and let you reload...
Same problem came up here, I opened up the javascript console in a script paused state. (Paused it using the Developer Tools)
Then I changed the variable value so that the while loop would end.
One way of breaking the infinite loop is to throw an unhandled exception, which will stop the execution of current call stack. To do so:
foo.bar(args)
foo.bar=function(){throw 42;}
worked for me. I haven't tried, but I believe that by overloading getter or setter you can use the trick described above also for assignments and reads, not only for function calls. Also, by setting a variable to undefined, you may cause fatal error (and thus break the loop) if the field of this variable is used in the loop. For example delete foo.tab
will break foo.tab[42]
or foo.tab.bar
. For some reason, simply writting foo=undefined
in the console, will not do (perhaps it defines a variable local to the console window named foo).