There is a big difference between a script going into a loop or waiting upon a server on the Web. Normally it is the second case which causes "Script not responding" errors.
Firefox has got no way of knowing the difference between a Web server not responding or just being slow. So it has a couple of dumb guillotine-type cut-off mechanisms like dom.max_script_run_time and dom.max_chrome_script_run_time, which specify how long it is willing to wait before canceling the script and any connection it might be waiting upon at the moment.
These sort of mechanisms are very dangerous to use. For example, while buying an item on the Web, the online payment site may be slow to react, so Firefox will just cancel the script and connection with unknown results as regarding your bank account.
What I am trying to say is that getting rid of these "Script not responding" errors may be worse than the errors themselves. You might be better off using an extension like NoScript to disallow all javascript on all websites you visit except for the ones you trust (or at least disallow third-party javascript). This is actually a defense mechanism that you and everyone should be using against drive-by-browser viruses.