If you are at all interested in how things get registered in XPCOM, this 
is a Must read.

I checked in an interface which exclusively does component registration 
(see bug 115853).

http://lxr.mozilla.org/seamonkey/source/xpcom/components/nsIComponentRegistrar.idl

This interface is primarily for populating the component manager with 
existing nsIFactory objects or for the nsIModule generic module code.

This interfaces was not designed to complete replace the obsolete 
component manager API.  For *some* callers, migration will not occur 
until some later date.

First group is the component loaders.  They are still privy to some 
internal knowledge of how the component manager works.  Until we need to 
define the interface between a loader and the component manager, I feel 
that we can leave these call sites alone.

I also left the plugin code alone.  For whatever historical reason, this 
code reaches behind the component managers back and accesses the 
component registry directly.  This is bad and will break as soon as I 
change the registry format.  I didn't fix this because I was too worried 
about regressions prior to mozilla 1.0.

The last item I did not convert was the python connect code.  I have 
contacted the owner regarding this matter.

An overview of the changes include:

1.  Removal of the references to the internal registry name/path from 
methods.  These strings are now commented such that they are to be 
passed from the nsIModule callbacks back to this new interface.

2.  Removal |replace| flag. Clients can, if they need, query for 
existence of a CID/ContractID before trying to register.  Most cases 
clients pass true today.

3.  Removal |persist| flag. Clients can, if they need, unregister.

4.  registerComponentSpec is now registerFactoryLocation.  Including 
changes (2), (3).

5.  registerComponentWithType,  registerComponentLib were removed 
because equivalently functionally can be obtained with 
registerFactoryLocation.  Furthermore, registerComponentLib was a native 
specific shortcut API which is not widely used anymore.

6.  autoRegister is still autoRegister, but it no longer has a time id. 
  Autoregistration is performed when autoRegister is called.   XPCOM 
does not need to have hooks to call autoregister at specific times; 
client code can call autoRegister when registration is needed.  In 
practice, this value abused the loader code.

7.  the enumerate functions now return nsISimpleEnumerator.

This interface is marked UNDER_REVIEW.  Please post your comments to 
either the newsgroup or the bug.  We can take comments and make changes 
up until Mozilla 1.0 (I would prefer .99), but by that time, what we 
have must be frozen.

-- 
Doug Turner


Reply via email to