如何使用 Firebug 扩展调试 Greasemonkey 脚本? [英] How to debug Greasemonkey script with the Firebug extension?
问题描述
我没有找到使用 Firebug 扩展来调试 Greasemonkey 脚本的方法.
I didn't find a way to debug Greasemonkey scripts with the Firebug extension.
有人知道怎么做吗?
谢谢.
推荐答案
更新程序: Mene+Shuman 修复程序现在被 Firefox 30 和 Firebug 2 破坏.Firefox 31 可能 提供解决方法(将进行调查).同时,请使用下面列出的一般解决策略".
Updatier: The Mene+Shuman fix now is busted with Firefox 30 and Firebug 2. Firefox 31 may provide workarounds (will investigate). In the meantime, use the "General workaround strategies" listed below.
更新:此答案现已过时.
如果你打开about:config
和
将 extensions.firebug.filterSystemURLs
设置为 false
然后你就可以像使用其他工具一样使用 Firebug 调试 Greasemonkey 脚本了.
If you open about:config
and
set extensions.firebug.filterSystemURLs
to false
then you can use Firebug to debug the Greasemonkey script just like any other.
这与 @grant
模式无关.
旧答案:
因为 Greasemonkey 在沙箱中运行,Firebug 看不到它.没有简单的方法可以解决这个问题.
Because Greasemonkey operates in a sandbox, Firebug cannot see it. There is no easy way around this.
一般变通策略:
首先在 Firebug 的 JavaScript 控制台中测试不使用
GM_
函数的 GM 脚本的所有部分.尽量减少使用GM_
函数,根本不要使用GM_log()
.
Test all parts of a GM script that don't use
GM_
functions, in Firebug's JavaScript console first. Minimize use ofGM_
functions and don't useGM_log()
at all.
所有 Firebug 的 控制台
功能在 GM 脚本中工作得很好.
All of Firebug's console
functions work great from within a GM script.
这篇关于如何使用 Firebug 扩展调试 Greasemonkey 脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!