So what changed, you wonder? Well, obviously we fixed some bugs. I’d like to briefly discuss just one of them, because it has some repercussions for how you use Venkman:
We no longer start the debugger service when the browser starts (by default)
There were several bugs on file about how Venkman and Firebug made Firefox slower. On top of that, there were recent changes in how components were handled, which meant we could no longer start Venkman (and ask for the debugger service to start) as early as we used to. In fact, the native support from the debugger service to start “really early” was removed by some of the Firefox/Gecko developers as part of this effort. Venkman relied on this support (Firebug doesn’t, they do something similar from their own code).
Why was it important to start the debugger service early?
Because the debugger service only “knew” about functions, variables and script that was loaded when it was started. In other words, if you loaded a script, and then loaded the debugger service after doing so, you wouldn’t be able to debug those files.
So if you no longer start the debugger service early, how does this work?
Thanks to some great work by Wladimir Palant (of AdblockPlus fame), as of Firefox 3.5 we can also get the debug information about functions when they are called. So, when you start Venkman, we will start the debugger service, and for every JS function call, it will tell Venkman about the new code.
I don’t see my scripts or functions when I open Venkman. How do I debug my code?
You have two options:
- You can load the file (if it’s not shown in the scripts view, try File > Open File (local files) or Open Web Location (urls)) and then set a “future” breakpoint. Venkman will stop there when the code is executed. Instead of loading the file manually, keep in mind any call into a function in the file will make it appear in the scripts list. It shouldn’t be hard to load the file.
- You can reload the page, and Venkman will see all the scripts appear just like it used to.
Can I get the old behaviour back?
We would prefer it if you tried to work with Venkman the way it is now and let us know about things you think we should do differently or improve. If you’re unable to debug code now that you could debug fine before, please let us know!
If you really need to start the debugger service early, just enter “
/startup-init true” (without quotes) at the Venkman console, and we will start the debugger service early (specifically, at the ‘profile-after-change’ notification – slightly later than before, but for most usecases this should not matter).
What about Firebug?
There’s a Firebug 1.6a20 alpha release that is compatible with Firefox 4. I don’t know if they still start the debugger service early if that pane is enabled.
Here’s the story on the Firebug side:
Since Web page JS can’t arrive until the page opens, Firebug does not have the same set of issues as Venkman. We don’t start the jsd engine until the user opens the first Web page they have enabled for debugging. So, for example, if they only have debugging enabled for foo.com and they have 25 tabs open but not foo.com, then we don’t start jsd.
Once we start jsd there is some overhead we can’t turn off. (Bug 506149 I think). But every time you switch tabs to a page you did not want to debug, we turn off as much as we can (jsd.pause()).
Chromebug (Firebug for Chrome) however has the same issues as Venkman, and we have a similar solution. We have very early component (hooked to profile-after-change) that starts jsd and records information. (I don’t have a command line switch, it’s just always on. With more and more module code I think most extensions will need the startup-time compilation information so I’m not planning to make it optional.)
Bill: That’s a good suggestion. I’ve filed bug 589587 for it. Feel free to come up with a patch! It shouldn’t be hard, just copy the XUL overlay stuff we have and make it apply to the “Developer” submenu, I’m pretty sure…
I installed venkman 9.88.1 in Firefox 3.8.6 on my Mac. I tried the “/startup-init true” command, but it did not do anything.
I installed Firefox 4.0b3 with venkman 9.88.1, and the “/startup-init true” works
I have submitted a the overlay changes required for bug 589587.
I don’t know if you are the right person for this. I saw this strange error message while using Venkman today (firefox 3.6.8/WinXP).
Operation Failed: BadMojo 2: Invalid value for parameter value ((null)) @ line 575 (ValueRecord)
Would you have a clue? I thought I will ask you first before I dig into it.
On FF3.6.8 I’m still not getting all my js chrome files, even after methods have been called.
But I’m getting many crashes, only when debugger is opened…
I have to switch back to previous release.