I don't see anything in the code you posted that would be
registering the contractid "@PowerlanUSA/webterm;1". How would
you expect the JS code to find your component using that
contractid? Are you trying to register that string in some other
code?

Does you code actaully rely on the plugin mimetype style
contractid that appears in the code you posted?

If so then I'd say you should change your JS code to use the
string to which
"NS_INLINE_PLUGIN_CONTRACTID_PREFIX PLUGIN_MIME_TYPE" resolves.

That would be "@mozilla.org/inline-plugin/" plus whatever you've
locally #defined PLUGIN_MIME_TYPE to be in your code.

Or, you *should* be able to add an *additional* block to your
gComponentInfo...

>     { "Webterm Plugin",
>       NS_WEBTERMPLUGIN_CID,
>       NS_INLINE_PLUGIN_CONTRACTID_PREFIX PLUGIN_MIME_TYPE,
>       WebtermPluginInstance::Create,
>       WebtermPluginInstance::RegisterSelf,
>       WebtermPluginInstance::UnregisterSelf },
>     { "Webterm Plugin",
>       NS_WEBTERMPLUGIN_CID,
>       "@PowerlanUSA/webterm;1",
>       WebtermPluginInstance::Create,
>       WebtermPluginInstance::RegisterSelf,
>       WebtermPluginInstance::UnregisterSelf },

As I read the code in the component manager, this will shadow the
cid -> factory mapping (with an identical entry) while supplying
an additional contractid -> cid mapping. This is supposed to work
- though I have not tested it myself.

There *ought* to be a better way to just add an additional
contractid -> cid mapping  - without other side effects - using
the generic module system. But I don't think here is.

If the plugin mimetype stuff does not matter to your code, then
it seems to me you might want to just change:

  NS_INLINE_PLUGIN_CONTRACTID_PREFIX PLUGIN_MIME_TYPE,
...to... 
 "@PowerlanUSA/webterm;1",

...in the code you have. But that would be good only if you are
*not* relying on the plugin system to activate your plugin based
on the mimetype scheme.

John.

Patrick McHale wrote:
> 
> Hi John,
> 
> When I started this project I based everything on the npsimple example in
> the Mozilla directory. I used the same routines used in order to register
> the
> component - because this is an example that works.
> 
> The Mozilla debug output says:
> 
> nsNativeComponentLoader: autoregistering begins.
> ***Registering WebtermPlugin components <all right -- a generic module!>
> nsPluginHostImpl ctor
> nsNativeComponentLoader: autoregistering succeeded
> 
> Then later on in the debug window it then says
> 
> Components.classes['@PowerlanUSA/webterm;1'] has no properties
> 
> I have the register / unregister routines in the C code and defined in the
> class WebtermPluginInstance.
> I have the component info stated as:
> 
> static nsModuleComponentInfo gComponentInfo[] = {
>     { "Webterm Plugin",
>       NS_WEBTERMPLUGIN_CID,
>       NS_INLINE_PLUGIN_CONTRACTID_PREFIX PLUGIN_MIME_TYPE,
>       WebtermPluginInstance::Create,
>       WebtermPluginInstance::RegisterSelf,
>       WebtermPluginInstance::UnregisterSelf },
> };
> NS_IMPL_NSGETMODULE(WebtermPlugin, gComponentInfo);
> 
> I am not sure about all the requiremements needed to register a component
> either from
> native code or Javascript. I hoped by following the exiting examples I could
> include everything
> I needed to do this. Is there anything written somewhere that outlines all
> the items necessary to
> do this from both Javascript or from Native code. Is there something that I
> have missed in the
> registering process.?
> 
> Thank you in advance for any help you can give me.
> 
> Patrick McHale
> Powerlan.
> 
> "John Bandhauer" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > Patrick McHale wrote:
> > >
> > > Hi,
> > >
> > > I have been trying to find the answer to why a javascript error occurs
> > > because of this line.
> > >
> > > The HTML line in question is:
> > > var webterm =
> Components.classes["@PowerlanUSA/webterm;1"].createInstance();
> > >
> > > The javascript error is:
> Components.classes['@PowerlanUSA/webterm;1']
> > > has no properties
> > >                                         Source File:
> > > file:///C:/Mozilla/Locations/NS6AHollis.htm
> > >                                         Line: 7
> > >
> > > Everything works - except I get this javascript error for some reason.
> > >
> > > Can anyone help?
> >
> > This means that there is no factory registered for the contractID
> > string "@PowerlanUSA/webterm;1" at the time that you run the code
> > above. I would not expect you to be able to create an instance
> > from C++ code for that contractID string either.
> >
> > Do you have code to register it from native code or JS? Are you
> > not doing something to force xpcom autoregistration?
> >
> > John.
> >
> > >
> > > Regards
> > >
> > > Patrick McHale
> > > Powerlan.

Reply via email to