Debugging JavaScript in Mozilla Firefox
June 29th, 2009 by Nikolay ChashnikovIntelliJ IDEA 9M1 supports debugging of JavaScript code in Mozilla Firefox. Just create a JavaScript Debug configuration, select Firefox from the Browser list and click OK:
IntelliJ IDEA automatically installs plugin for Mozilla Firefox and executes the configuration.
Note that you need to clear Make option under Before launch group before starting debugger to work around a bug that will be fixed in next Maia EAP.
Tags: debugger, Firefox, javascript, maia
June 29th, 2009 at 12:04 pm
Folks, could you please clarify whether only-JS breakpoints are honored, or mixed-type (e.g. JS inside a JSP) too?
June 29th, 2009 at 6:49 pm
Can you also kindly explain how remote JavaScript debugging is configured with an example? The “Remote URLS of local files” section in the dialog is quite confusing.
June 30th, 2009 at 1:17 am
You cannot set breakpoints directly in JSP files because IDEA cannot automatically map such breakpoints to html files generated for JSPs. However after staring Remote JavaScript debug configuration you can select “Open Source in IDEA” from popup menu in Firefox and put breakpoints in html file which will be opened in IDEA.
July 2nd, 2009 at 6:05 pm
Can I also debug js in jsp pages? The dialog just lets you pick .html files…
July 7th, 2009 at 2:20 pm
I a run/debug configuration, as shown in the above screenshot, the plugin installed successfully, but every time I start the debugging from IntelliJ, all I see is “Waiting for a connection on port 7,814″. In the meantime Firefox started, but doesn’t seem to connect to IntelliJ.
With netstat, I see IntelliJ is listening on port 7814. So it looks like the Firefox extension does not connect. What triggers the Firefox extension to connect to IntelliJ?
July 10th, 2009 at 2:38 am
When you run a JavaScript debug configuration IDEA starts firefox.exe with a special command line parameter. Firefox Extension handles that parameter and connects to IDEA.
Which version of Firefox are you using? Are there any errors in Firefox Error Console? Does it help if you close all Firefox windows before starting JavaScript debugger?
July 12th, 2009 at 2:12 pm
Nikolay,
Maybe the issue is that my instance of Firefox wasn’t started by IntelliJ. I always have Firefox running, so it would be inconvenient to have to quit it, just to have IntelliJ start it again when I want to debug something. I would make more sense for the plugin to provide a way for me to connect to IntelliJ when I want to debug something. Does this make sense?
July 22nd, 2009 at 1:25 pm
When i click on “Open Source in IDEA” i get our login page instead of the page i’m trying to debug. Does it not pass in the session cookies of the browser?
November 4th, 2009 at 12:16 am
I use OSX (10.6.1) and cannot select my Firefox executable. The selection dialog appears when I first try to run the “debug local javascript” configuration. In OS X applications are actually folders. When I navigate to my Firefox.app in the “Select Firefox Executable” dialog the “OK” button is disabled. I tried creating an alias, which is selectable in this dialog. But, after IDEA tries to install the plugin I get this error: “Error running : Cannot start Firefox: : cannot execute” + “OK”.
Perhaps debugging JavaScript is only available on Windows/Linux?
Maia-IU-90.137 (also seen in 122).
Kevin
November 13th, 2009 at 11:28 pm
I’ve tried all the workarounds I can think of plus some that have been suggested but I still can’t seem to get IDEA (Idea IU-90.193) to find Firefox. I can continue using Firebug, which is a great plugin, but I’d like to see what IDEA has to offer in this area.
Thanks,
Kevin
December 14th, 2009 at 6:48 pm
Tried everything, the JS debugger never breaks in a breakpoint. IntelliJ (IU-93.13, Dec 8 build) launches the URL in FireFox correctly. I can see the plugin from JetBrains is installed as expected. Yet no breakpoints work.
My initial remote URL is a JSP page that loads JS files. Breakpoints were all in JS files.
Firebug works as expected.
December 21st, 2009 at 9:24 pm
I installed IntelliJ hoping (desperately) to debug FireFox, but have found no path to the dialog you so optimistically display. I relearn from this experience that I must consider any statement being “Just ….” suspect before meriting my attention or effort. But given Firefox’s current state, I _am_ desperate.
December 22nd, 2009 at 9:50 am
kibbylop, have you tried the Run menu?
I think Edit Configurations will help you with that.
December 31st, 2009 at 8:39 am
I was having the same situation with Bubble on Idea 9.0. Debugger was never braking in a breakpoint.
I have Firefox 3.5 and Firebug installed…
My Solution: When i active the firebug (firebug icon shown in yellow) idea debugger started to break at all breakpoints