3
votes

I have an issue with Firebug in Firefox. While my JavaScript produces an endless loop, a popup in Firefox comes up, which allows to continue the script or terminate it.

In earlier versions of Firefox there was an additional option allowing to debug the script, however it is not appearing anymore in the popup in current versions (I am using Firefox 31.0).

Using this option Firebug should stop somewhere in the JavaScript processed in the endless loop. Most likely this behavior can be again activated in Firebug/Firefox but I do not know where?

2
In Chrome you can just pause execution in debugger window and it show where the infinite loop is. In Firefox 80, pause does nothing, it will pause after popup and "Stop" to an unrelated stackframe, so it's useless. - cdalxndr
In my case, I have an infinite loop in Firefox JavaScript (run by PHP from HTML), probably in a while loop that I just added, that is causing my computer to overheat. I cannot break out of the loop in any obvious way, and closing the tab doesn't help. Can this please be fixed? I need a way to kill the looping process, or even better to force-breakpoint it to the Firefox debugger. I shouldn't have to kill the process in the OS (Windows). - David Spector

2 Answers

0
votes

While this button is not present in Firefox 31.0, it is there in version 32.0. Though instead of stopping in Firebug it now uses the built-in debugger to debug the script.

Background info: Before version 2.0 Firebug used Firefox' old debugger API called JSD. In Firefox up to version 31.0 the Debug script button is just displayed when that API is enabled, i.e. when Firebug (1.12.* and earlier) is opened for that page.

The debugger of the built-in devtools and Firebug 2.0 use a new debugger API, so as the button is bound to JSD it is not displayed.

In Firefox 32.0+ the button works together with the new API. Though as Firebug (2.0.*) doesn't hook into the logic for that button, it opens the built-in debugger.

0
votes

There is currently no way to stop the script execution on hanging scripts. There used to be a button to debug them, though it got removed in Firefox 45.

The enhancement request to re-add it is https://bugzil.la/1157820.

For what it's worth, here's a simple test script creating an infinite loop:

data:text/html,<script>while(true){x=1;}</script>

Edit:

There is still a Debug Script button in the Firefox Developer Edition, though it doesn't seem to work (at least in the tested version 81.0b9) trying it with the simple script above.