Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to debug Firefox addons during development

Debugging a Firefox addon is a slow process: (1) edit source code in a JS editor (2) package into XPI using a build script (3) drag into Firefox to install (4) restart Firefox (5) open the JavaScript Debugger

Can we speeden up the process? Like install it into Firefox without a restart, or configure the build script to install it into Firefox as well?

like image 487
Robin Rodricks Avatar asked Jul 03 '09 04:07

Robin Rodricks


People also ask

What is remote debugging in Firefox?

The answer is remote debugging, which will enable you to connect the android device to your workstation via a USB cable and debug your mobile webpage on your desktop. On a side note, you can debug multiple device sizes while performing responsiveness tests simultaneously.

How do I debug an extension?

Navigate to the chrome extensions management page at chrome://extensions and ensure developer mode is on. Click the Load Unpacked button and select the broken extension directory.


2 Answers

You'll want to locate your profile folder. Once you find it, go into the folder called 'extensions', and then locate the folder for the add-on you are working on. Replace that folder with a file of the same name (minus .xpi if that's part of the name), and inside the file place the full path to your source directory of the add-on.

In Linux and Mac, that'll look like:

/full/path/to/yourExtension/ 

And on Windows:

C:\full\path\to\yourExtension\ 

Remember the trailing slash and beware of extra whitespace.

As long as you don't use jar files inside your add-on, you will no longer have to rebuild (this is covered in a bit more depth here).

Additionally, you'll want to set nglayout.debug.disable_xul_cache to true. For edits to xul or js files, you'll just have to open up a new window to see your changes instead of restarting the application. There are other preferences here that you may find useful as well.

Extra tips:

  • Starting firefox with a certain profile (dev), while other firefox profile is open and with the debugger already on:

    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -no-remote -P dev -jsconsole

  • Check out the restart addon (saves time).

like image 105
sdwilsh Avatar answered Oct 10 '22 18:10

sdwilsh


i use Netbeans with the Foxbeans Plugin for addon development, there you just press the "run button", and firefox starts up with the addon installed (into a test profile). maybe you should give this a try!

like image 43
bizzy Avatar answered Oct 10 '22 18:10

bizzy