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
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)