开发者

Firefox extension : toSource not working with Firebug.Console.log

On FF 4.0.1; and trying to develop my first FF extension.

Need to find where the user right clicked. From MDN it seems "gContextMenu.target" wo开发者_JAVA技巧uld have the information.

Trying to do the following and it doesn't show anything :

let targetClicked = gContextMenu.target;

Firebug.Console.log("targetClicked : " + targetClicked.toSource());

Nothing shows up, other .log statements are working correctly.

Wanted to use the Venkman JS Debugger, but its not compatible with 4.0.1.

Any ideas how to get that information ?


Learned that gContextMenu.target returns a DOM object, hence .toString() would work.

Note : The .target returns a DOM object wrapped in a XrayWrapper. Use XPCNativeWrapper.unwrap() to unwrap it before use.

oh yes, include this in your code so the object is available :
<script type="application/x-javascript" src="chrome://global/content/XPCNativeWrapper.js"/>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜