Fastest way to debug Firefox addons during development

前端 未结 7 842
一个人的身影
一个人的身影 2020-12-12 14:14

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 Firef

相关标签:
7条回答
  • 2020-12-12 14:40

    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).

    0 讨论(0)
提交回复
热议问题