zen wrote:
I am currently using javascript Components.results.NS_BINDING_ABORTED.
Now, how can I use this constant in c++?
I could not find this constant from any of the header files.
Please advice.

You should search using http://lxr.mozilla.org

As you can see with the search...

http://lxr.mozilla.org/mozilla/search?string=NS_BINDING_ABORTED

...NS_BINDING_ABORTED is #defined at:

http://lxr.mozilla.org/mozilla/source/netwerk/base/public/nsNetError.h#71

So, including that file in C++ ought to do the trick.

You should also note that Components.results.NS_BINDING_ABORTED does *not* show up anywhere in the tree except in a comment:

http://lxr.mozilla.org/mozilla/source/extensions/xmlterm/ui/xmlterm-service.js#223

As it happens, all the members of Components.results are built using the data in:

http://lxr.mozilla.org/mozilla/source/js/src/xpconnect/src/xpc.msg

NS_BINDING_ABORTED does not appear in that file and thus is not actually a property of Components.results.

I think you'll find that Components.results.NS_BINDING_ABORTED evaluates to undefined and not the constant you imagine.

That initial lxr search I suggested shows that scripters have explicitly declared the NS_BINDING_ABORTED const in their .js files using a hardcoded value in various places.

It is unfortunate that these (and other) constants were not exposed via the Components.results mechanism. There is a bug somewhere that outlines a scheme for extending xpidl, typelibs, and xpconnect so that such constants could be single sourced for C++, JS, and any other xpcom language. But, it seems unlikely anyone will ever bother.

It has always been possible to petition the xpconnect owner to add new constants to Components.results. But, that creates build time dependencies which make xpconnect depend on the header files that define such constants.

John.
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to