Christoph,

I have no idea if this might be the cause but for the last few Firefox and Thunderbird builds I have had major headaches registering new JS components, my understanding is because they have started adding some stuff into user profiles as well.

My process is now as follows:

In /components/

Delete 'compreg.dat' & 'xpti.dat'

In the userprofile directory

Delete 'compreg.dat' & 'xpti.dat'

Drop the component and XPT files into /components/

Then run 'regxpcom -a'

BTW. Component Viewer although so slow it hurts is a great XPCOM utility for checking out your components and interfaces are registering correctly. It's up on mozdev somewhere.

Cheers,

Neil




Christoph Rupp wrote:
dear list,

i am not able to register my pyxpcom component successfully. at first i have copied the xpi- and the py-file to the /components-directory and ran ./regxpcom. but whenever i tried to load it with xpcshell, i got the message that my component (@umc/nsIUmcTest;1) is not registered ("Invalid ClassID or ContractID").

(btw: i had no troubles registering and using a c++ and a js-component).

so i checked the registry-files (components/*.dat) and compared to the files in the Komodo-directory (Komodo also uses pyxpcom), and it seemed that regxpcom was not able to register the python library. that's not really a problem as i can register the components manually, so i added the following lines:

components/compreg.dat:

[CLASSIDS]
{ce32e3ff-36f8-425f-94be-d85b26e634ee},,script/python,,rel:nsIUmcTest.py

[CONTRACTIDS]
@umc/nsIUmcTest;1,{ce32e3ff-36f8-425f-94be-d85b26e634ee}

in components/xpti.dat there's the following line (generated by regxpcom, i guess):

[Interfaces,989]
630,nsIUmcTest,{ce32e3ff-36f8-425f-94be-d85b26e634ee},120,-1,1

now when i run xpcshell, i no longer get the "Invalid ClassID or ContractID" error message, but the following error:

[EMAIL PROTECTED]:~/umclaw/mozilla> ./run-mozilla.sh ./xpcshell
js> const Simple=new Components.Constructor("@umc/nsIUmcTest;1", "nsIUmcTest");
js> var s=Simple();
:2: Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]
js>


i have no idea what this error means, maybe one of you has a hint? i really want to get this working...

thanks,
Chris

PS: here are the sources of the idl- and the python-file:

---------------------------------------------------------
#include "nsISupports.idl"
[scriptable, uuid(ce32e3ff-36f8-425f-94be-d85b26e634ee)]
interface nsIUmcTest : nsISupports
{
    attribute string yourName;
    void write( );
    void change(in string aValue);
};

---------------------------------------------------------
import xpcom
from xpcom import components

class nsIUmcTest:
    _com_interfaces_ = xpcom.components.interfaces.nsIUmcTest
    _reg_clsid_ = "{ce32e3ff-36f8-425f-94be-d85b26e634ee}"
    _reg_contractid_ = "@umc/nsIUmcTest;1"
    _reg_desc_ = "umc simple test"

    def __init__(self):
        self.m_name='default name'

    def get_yourName( self ):
        return self.m_name

    def set_yourName( self, param0 ):
        self.m_name=param0

    def write( self ):
        print self.m_name

    def change( self, param0 ):
        self.set_yourName(param0)
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to