开发者

XPJS (Javascript XPCOM) Documentation?

开发者 https://www.devze.com 2023-04-04 19:19 出处:网络
Anyone know where is some usable XPJS, or XPCOM in JS, documentation for recent versions of Firefox/Gecko? And sample code/ tutorials would be great too.

Anyone know where is some usable XPJS, or XPCOM in JS, documentation for recent versions of Firefox/Gecko? And sample code/ tutorials would be great too.

I need to write my own Component, but without .IDL (no C++ compiled interface), so I could access it via

Components.classes['@com.mareksebera/compname;1']
                                .getService().wrappedJSObject;

or this way is not supported anymore? I can't use

Components.classes['@com.mareksebera/compname;1']  
                                .createInstance(Components.interfaces.nsICompName);

Because of missing compiled interface nsICompName

And yes, I know that NSGetModule is deprecated, and I use NSGetFactory and XPCOMUtils.jsm

I know these, but those are not usable with up to date browsers versions

https://developer.mozilla.org/en/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System

https://developer.mozilla.org/en/Using_XPCOM_in_JavaScript_without_leaking

https://developer.mozilla.org/en/how_to_build_an_xpcom_component_in_java开发者_Go百科script


The third link you mentioned is pretty good. Another way to get examples though is to actually download the Mozilla source code and look in the /tests subdirectories. There are some examples there of javascript created XPCOM objects.

One example that comes to mind can be found at:

<mozilla-central>\content\xtf\test\unit

But there are a ton of examples throughout the codebase.

If you prefer you can also browse the code online via mxr.

0

精彩评论

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