调试 Firefox 插件是一个缓慢的过程:(1) 在 JS 编辑器中编辑源代码 (2) 使用构建脚本打包成 XPI (3) 拖入 Firefox 进行安装 (4) 重新启动 Firefox (5) 打开JavaScript 调试器
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
我们可以加快进程吗?喜欢在不重启的情况下将其安装到 Firefox 中,还是配置构建脚本以将其安装到 Firefox 中?
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?
推荐答案您需要找到您的 个人资料文件夹.找到后,进入名为扩展"的文件夹,然后找到您正在处理的附加组件的文件夹.将该文件夹替换为同名文件(减去 .xpi,如果这是名称的一部分),并在文件中放置加载项源目录的完整路径.
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.
在 Linux 和 Mac 中,这看起来像:
In Linux and Mac, that'll look like:
/full/path/to/yourExtension/在 Windows 上:
And on Windows:
C:fullpath oyourExtension记住结尾的斜杠并注意多余的空格.
Remember the trailing slash and beware of extra whitespace.
只要您不在加载项中使用 jar 文件,您将不再需要重新构建 (这里有更深入的介绍).
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).
此外,您需要设置 nglayout.debug.disable_xul_cache 为真.对于 xul 或 js 文件的编辑,您只需打开一个新窗口即可查看更改,而无需重新启动应用程序.还有此处的其他首选项,您可能也会觉得有用.
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.
额外提示:
使用特定配置文件 (dev) 启动 Firefox,而其他 Firefox 配置文件已打开且调试器已打开:
Starting firefox with a certain profile (dev), while other firefox profile is open and with the debugger already on:
"C:Program Files (x86)Mozilla Firefoxfirefox.exe" -no-remote -P dev -jsconsole
"C:Program Files (x86)Mozilla Firefoxfirefox.exe" -no-remote -P dev -jsconsole
查看重启插件(节省时间).
更多推荐
在开发过程中调试 Firefox 插件的最快方法
发布评论