I am trying to do this, but I can not make it works. I have problems with the initialization. Can you post here a complete example?

Thanks

Phil McLachlan escribió:

For each foo, you should initialize before running any JS, with a call to the following. (One gotcha is that keepAliveFooName must be kept alive as long as the DOM needs it, so I suggest putting it in a static variable.)

    domSOFactory->RegisterDOMClassInfo( keepAliveFooName.get(),
                                        &GetClassInfoFor,
                                        NULL,
                                        interfaces,
                                        DOM_DEFAULT_SCRIPTABLE_FLAGS,
                                        PR_TRUE,
                                        &fooCID );

Where GetClassInfoFor returns the nsIClassInfo object. If you have many objects to register, then you can use one GetClassInfoFor function that looks up the proper CID in a map. In any event, a call to the following is the key part of the module I called GetClassInfoFor. (Another gotcha is that although GetClassInfoFor may seem like a getter, it is not XPCOM-compliant, so you should not AddRef, unless you want a memory leak. This means calling Release on classInfo, after calling GetClassObject and before returning.)

  componentManager->GetClassObject( fooCID,
                                    NS_GET_IID( nsIClassInfo ),
reinterpret_cast< void** >( &classInfo ) );

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to