Open compreg.dat in the profile directory with a text editor. Search the file for the UUIDs of your interfaces/components. If they aren't in the file,the registration code failed.

----- Original Message ----
From: alex
Sent: Tuesday, December 5, 2006 11:32:17 AM
Subject: How to have my xpcom component initialtes when mozilla is starting?


These days I'mtrying to build a simple xpcom component in c++ and package
it into xpi file, then install it as extention of firefox. This extension
will createan item on BrowserToolbarPalette and it will call method on my
componentthrough javascript.

The installation seems work, I can install my extension, but when I'm trying
to call it, there is error returned. Firstly,I can't find the component
with XPCOMViewer (should I?), and when I try to initialte the component in
javascript as:
const cid = ";1";
obj = Components.classes[cid].createInstance();

It returns error:
TypeError: Components.classes[cid] has no properties.

It seems the component doesn't initiated when mozilla is started.
Referencing weblock example on mozilla xpcom doc site, I have my component
implemented nsIObserver interface, and in the component cpp file I have

static NS_METHOD WebLockRegistration(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const char *componentType,
const nsModuleComponentInfo *info)

static NS_METHOD WebLockUnregistration(nsIComponentManager *aCompMgr,
nsIFile *aPath,
const char *registryLocation,
const nsModuleComponentInfo *info)

As weblock example said this method would be able to register the component
as xpcom-start observer, sowho's calling these methods?

Can I auto start my component packaged with xpi file?

Thanks in advance.

dev-extensions mailing list

__________________________________________________ __________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on