Languages
[Edit]
EN

Google Chrome - stop infinite loop in JavaScript debug

17 points
Created by:
Kate_C
2860

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 freeze. 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. make action that contains infinity loop,
  4. make active focus on Chrome DevTools window,
  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.
Hey ūüĎč
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.