I'm writing plugin for firefox and I need a way to debug it. Plugin written in javascript. So is there is a elegant way how I can debug it?
Update 2014: There's a builtin Firefox debugger
The Mozilla Developer Center has plenty of useful information on this topic (as well as many others).
I would recommend Setting up an extension development environment as a good place to start.
Chromebug is a useful tool which allows JavaScript debugging and inspecting XUL elements. You can take a look at a few screenshots here.