March 28, 2024, 05:23:24 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Problem in Registration of XPCOM Component  (Read 4332 times)

Offline niteshkumar

  • New Member
  • Posts: 2
Problem in Registration of XPCOM Component
« on: January 05, 2010, 05:56:19 AM »
The component which i was built with gecko-sdk 1.9 (xulrunner-1.9.0.14.en-US.linux-i686.sdk.tar.bz2) on firefox 3.5 But when I tried my component with gecko-sdk 1.9 it fails to register (entry is not appeared in compreg.dat but appears in xpti.dat) on linux.
i take the sample example given in the http://www.iosart.com/firefox/xpcom

but the problem is when i tried to run the application fails with a "TypeError: Components.classes[cid] is undefined" error.


if any suggestion come i will appreciate it.
thanks in advance .

Offline niteshkumar

  • New Member
  • Posts: 2
Re: Problem in Registration of XPCOM Component
« Reply #1 on: January 06, 2010, 01:00:06 PM »
 The component which i was built with gecko-sdk 1.9 (xulrunner-1.9.0.14.en-US.linux-i686.sdk.tar.bz2) on firefox 3.5.6 But when I tried my component with gecko-sdk 1.9 it fails to register (entry is not appeared in compreg.dat but appears in xpti.dat) on linux.(fedora)
i take the sample example given in the http://www.iosart.com/firefox/xpcom

but the problem is when i tried to run the application fails with a "TypeError: Components.classes[cid] is undefined" error.



I am followed the same example given in http://www.iosart.com/firefox/xpcom and  able to make MyComponent.so file using make file
i also copied my .so and .xpt file to /usr/lib/firefox-3.5.6/components folder.
after that i registered through regxpcom command .but it entry appears in xpti.dat (here interface and .xpt file i found ) but  the .so and Components not appeared in compreg.dat)

This is MyComponentTest.js file

function MyComponentGo() {

   try {

      netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

      const cid = "@nitesh.org/MyComponent;1";

      obj = Components.classes[cid].createInstance();

      obj = obj.QueryInterface(Components.interfaces.IMyComponent);

   } catch (err) {

      alert(err);

      return;

   }

   var res = obj.Add(3, 4);

   alert('Performing 3+4. Returned ' + res + '.');

}


This is my html file
<HTML>

<SCRIPT SRC="MyComponentTest.js"></SCRIPT>

<BODY>

<BUTTON ONCLICK="MyComponentGo();">Go</BUTTON>

</BODY>

</HTML>

when i m trying to run my html file it is saying
JavaScript Application
TypeError: Components.classes[cid] is undefined