Languages
[Edit]
EN

Google Chrome - stop infinite loop in JavaScript debug

20 points
Created by:
Marcin
17530

Using Google Chrome, there are few ways to stop JavaScript debugging.

1. Stop button in Chrome DevTools example

Note: to use this approach DevTools should be turned on before JavaScript code will be executed. In other case we will be not able to open the tools with F12 because of Chrome window gets freezes. It will be still possible to turn on the tools with browser menu but tools will not get connection with executed source code to stop it - in this case code executing can be stopped only via closing tab or window. Sometimes for small amount of RAM or big amount of opened tabs DevTools can have problem to stop infinity script.

Steps:

  1. open Chrome┬áDevTools┬áwith F12, Ctrl+Shift+i┬áor from menu Main menuÔćĺMore toolsÔćĺDeveloper tools,
  2. open web page that you want to debug,
  3. run some code that has infinity loop,
  4. click Chrome DevTools window to get focus on it,
  5. pause script with F8, Ctrl+\ or by clicking Pause script execution button,
  6. press mouse button for 1-3 seconds on the button again to see more options,
  7. move click action to square stop button on expanded menu to stop permanently script execution.
Explanation, how to open Google Chrome DevTools from menu.
Explanation, how to open Google Chrome DevTools from menu.

 

Explanation, how to pause infinity JavaScript loop using Google Chrome DevTools.
Explanation, how to pause infinity JavaScript loop using Google Chrome DevTools.

 

Explanation, how to stop JavaScript loop using Google Chrome DevTools.
Explanation, how to stop JavaScript loop using Google Chrome DevTools.

2. End process by closing tab or window example

Use close button to stop process. If it does not help use Task manager described in next approach of this post.

3. End process button in Task manager example 

Steps:

  1. open Chrome┬áTask manager┬áwith Shift+Esc┬áor from menu Main menuÔćĺMore toolsÔćĺTask manager,
  2. find process on list by tab name or biggest CPU load (use column sort option),
  3. select process and click End process button.

References

Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join