banli ga wrote:
In the cxc book, the weblock component implements self-defined
interface, IWebLock.

Yes, but more importantly, it also implements nsIObserver.


And the component registers itself to observe
"xpcom-startup" event so that each time a mozilla is launched, one
weblock instance is created.

Indeed. This is done by adding the category entry in the xpcom-startup category. That causes XPCOM to create the service during startup, and call the Observe method on it (if it implements nsIObserver). Being a service, it only gets released on XPCOM Shutdown.


So I don't understand that when the weblock registers as a "service".
Or calling "getService" here means return a reference to the already
created weblock instance, which is created when the mozilla starts.
So in this case, only one weblock instance exists in the mozilla

I'm not sure where the question is in this paragraph? It seems to correctly describe how things work, as far as I can tell...
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to