Programming » Firefox Addons

Debug Addons

I. Debug Preparation

1. Press Ctrl+Shift+I or go to Tools -> Web Developer -> Toggle Tools

2. Press Toolbox Options in the right corner

3. In the Advanced settings group check

Enable chrome and add-on debugging
Enable remote debugging

Debug Toolbox options

4. Close the toolbox

II. Starting Debugger

II.1 PC Debugging

II.1.1. Restartless addons

1. Press Ctrl+Shift+A or go to Tools -> Add-ons

2. Press Debug for an addon you need

Debug Addon manager

3. In Incoming Connection dialog press OK

Debug Incoming connection

4. Go to Debugger tab

Debug Restartless, Debugger tab

5. Set breakpoints and work

II.1.2. All addons (XUL and restartless)

1. Go to Tools -> Web Developer -> Browser Toolbox (Alt+T+W+E)

Debug Toolbox menu item

2. In Incoming Connection dialog press OK

Debug Incoming connection

3. Go to Debugger tab

4. Wait until all scripts are loaded

5. Find your addon id in the left panel (they are organized alphabetically) or type a script name (main.js) in the search box and select a file with your addon in the path

Rebug Toolbox left panel [sm]

Debug Toolbox search file

6. Set breakpoints and work

II.2. Android Debugging

1. On Android go to Settings -> Developer options

Debug Android Developer options

2. If no Developer options menu go to Settings -> About and tap Build number 7 times. It should reveal Developer options menu.

3. Check USB debugging in the Developer options

Debug Android, USB debugging

4. Connect device with USB

5. On PC install Android SDK from the direct link for Windows or go to SDK Tools Only section of the SDK page.

Debug aSDK setup

6. Install the Android Platform Tools leaving the checkbox on after the SDK installation or running the file to start SDK Manager

C:\Users\[username]\AppData\Local\Android\android-sdk\tools\android.bat

Debug aSDK -tools- folder

7. Go to the folder

C:\Users\[username]\AppData\Local\Android\android-sdk\platform-tools

Debug aSDK -platform-tools- folder

8. Add the folder path to the PATH system variable.

  1. Win+R -> “sysdm.cpl”
  2. Go to Advanced tab -> Environment Variables -> System variables -> Path
  3. Press Edit, copy the text and insert it into a text editor
  4. Check the path to platform-tools is in the text, if not copy the path from the folder
  5. Paste edited path text from the editor to the Path edit dialog and confirm.

9. Check all is correct, Win+R -> “cmd”, type the command

adb devices

It will output the list of attached devices.

Debug ADB check

10. On Android open Firefox

11. Go to Settings -> Developer tools

12. Check Remote debugging

Debug Android, Firefox Settings, Remote debugging

13. On PC do Win+R -> “cmd” and type command to set up the port

adb forward tcp:6000 localfilesystem:/data/data/org.mozilla.firefox/firefox-debugger-socket

14. Open Firefox and go to Tools -> Web Developer -> Connect…

Debug Remote connection request

15. Press Connect

Debug Remote connection established

16. On Android confirm the Incoming connection

Debug Android Incoming connection

17. On PC Firefox select addon to debug and set breakpoint in the Debugger window.

Debug Android Toolbox on Remote connection

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>