在Firefox中调试扩展代码(javascript debugger / venkman) [英] Debugging extension code in firefox (javascript debugger/venkman)

查看:169
本文介绍了在Firefox中调试扩展代码(javascript debugger / venkman)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Firefox的一个简单的扩展工作。现在我想在扩展上下文中的控制台中发出一些命令。



我已经安装了Javascript Debugger插件(venkman),但遵循以下说明: / p>


  • 取消选中排除应用程序文件

  • 选择文件,然后右键单击设置为评估对象



从来没有设置上下文,我总是在venkman.xul上下文(或者更保留)。



我将切换到另一个调试器,但到目前为止,还没有运行chromebug:




  • 安装chromebug 1.08a2和匹配的firebug

  • 启动firefox with -chromebug -P dev(作为单独的'firefox'用于开发)



然后在自己的窗口上的chromebug不让我选择一个上下文,实际上它甚至不显示任何上下文,所有面板都被停用。



我真的没有任何想法再去看看,而且希望有一个解决方案。
现在,我甚至不需要所有的花哨调试器的东西,比如设置断点,只需要在chrome级别发布命令。

解决方案

Firefox现在有一个内置的调试器,可以轻松的竞争对手,也许超过了firebug,chromebug或者venkman。



您需要在中启用(或创建)2个特定选项 :config 用于扩展调试工作:

  devtools.chrome.enabled:true 
devtools.debugger.remote-enabled:true

然后点击新的浏览器调试器条目Web Developer菜单。 浏览器控制台也非常有用。



官方文档提到这将从Firefox 19工作,但实际上它将仅适用于所有来自Firefox 23的扩展代码。 (如果您在Firefox 22发布之前尝试这样做,只需安装最新的夜间版本。)



另请注意,如果您直接编辑扩展代码,您将需要使Firefox更新,例如在调试器将列出更新的代码之前,使用此答案中提到的提示使用重新加载所有chrome扩展名。



更新: Firefox v32及更高版本内置调试支持 restartless 基于SDK的加载项。作为在Mozilla的文档中所述,提到的远程调试上面现在在Web Developer窗格的设置中有一个复选框:





然后,您可以转到附加组件 - >扩展选项卡,然后单击扩展名旁边的调试。


I'm currently working on a simple extension for Firefox. Now I would like to be able to issue some commands in a console in the extensions context.

I have installed the Javascript Debugger addon (venkman) but following the instructions:

  • uncheck "Exclude Application Files"
  • choose file and right-click "Set as Evaluation Object"

never sets the context, I always end up (or rather stay) in the venkman.xul context.

I would switch to another debugger, but so far had no luck with chromebug either:

  • installed chromebug 1.08a2 and matching firebug
  • started firefox with -chromebug -P dev (as a seperate 'firefox' for development)

then chromebug on its own window doesn't let me choose a context, in fact it doesn't even show ANY context, all panels are deactivated.

I really don't have any idea where to look any more and would love to have a solution. For now I don't even need all the 'fancy' debugger stuff like setting breakpoints, just need to issue commands at chrome level.

解决方案

Firefox now has a built-in debugger that easy rivals, and perhaps surpasses firebug, chromebug or venkman.

You need to enable (or create) 2 particular options in about:config for extension debugging to work:

devtools.chrome.enabled: true
devtools.debugger.remote-enabled: true

And then click the new "Browser Debugger" entry in the Web Developer menu. The "Browser Console" is also very useful.

The official documentation mentions that this will work from Firefox 19, but actually it will only work well on all extension code from Firefox 23 onwards. (If you try this before Firefox 22 is released, just install the latest nightly build.)

Also note that if you're editing extension code directly you will need get Firefox to refresh e.g. by using the reload all chrome extension using the tips mentioned in this answer before the debugger will list the updated code.

Update: Firefox v32 and later has built-in debugging support for restartless and SDK-based add-ons. As stated in Mozilla's documentation, the "remote debug" mentioned above now has a checkbox in the Web Developer pane's settings:

You can then go to the add-ons -> extensions tab and click "debug" alongside the name of you extension.

这篇关于在Firefox中调试扩展代码(javascript debugger / venkman)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆