Consider the following silly example:
<!doctype html>
<meta charset="utf-8">
<title>dumb snippet</title>
<script>
var i = 0;
while (i < 100) {
console.log(i);
debugger;
i += 1;
}
</script>
If I run this code using Google Chrome's DevTools, the debugger dutifully stops execution at the debugger
statement, but I have not found any way to immediately abort (and restart) the script. AFAICT, pressing Ctrl-R
or even Shift-Ctrl-R
, rather than reloading the page, merely causes the execution to continue.
The only recourse I've found is obvious, but unnecessarily inconvenient: kill the tab/window altogether, and open up a new one.
Does the Google Chrome DevTools provide some way to immediately abort a script that is stopped at a debugger
statement?
(If the answer happens to be "no", please do not post work-arounds. I can think of plenty of them, e.g. holding F-8 until the loop exits, although this won't work, of course, if the loop turns out to be an infinite loop. In any case, here I am only interested in whether there is an "official" way to abort and restart such a script.)