I started to make a simple js debugger, and I was wondering if there is a way to stop an already running script if either it isn't responding or I want to stop it's setInterval()
loop where we don't know the id of the loop.
I've noticed in the Chrome DevTools that every document has it's own script collection under document.scripts
, but I couldn't find anything like a list of intervals (eg:window.intervals
) or any response if any function is running,so I can't really determine if a function needs to be killed.
This could be useful when you want a webpage scanner extension or a debugger thet can refresh the page when the script is frozen.
Edit:
The list of intervals has already been asked and solved in How can I get all timers in javascript question.
Now the only question remains is: How can I determine if a script is frozen so it or the page can be killed?