Using nsIClassInfo

What is nsIClassInfo good for?

If you use a C++ class which implements nsIClassInfo from JavaScript, then you don't have to explicitly call QueryInterface on the JavaScript object to access the object's interfaces.

nsIClassInfo is good for other things too, but they're dark XPCOM magic.

How do I use it?

If you're writing JavaScript code which uses a C++ class implementing nsIClassInfo, you don't need to do anything to activate the auto-interface magic which makes calling QueryInterface unnecessary.  It just happens.

How do I make my C++ class implement nsIClassInfo?

See nsIClassInfoImpl.h for instructions.

How does nsIClassInfo work?

That's also detailed in nsIClassInfoImpl.h.

Original Document Information

  • Authors: Mike Shaver, Justin Lebar
  • Last Updated Date: July 25, 2011
  • Copyright Information: Portions of this content are © 1998–2011 by individual mozilla.org contributors; content available under a Creative Commons license | Details.

Document Tags and Contributors

Tags:
Contributors to this page: jlebar, Jorend
Last updated by: jlebar,