2

I wrote a binary XPCOM component. It compiled successfully with XULRunner SDK 12.0 (Gecko 12.0) but registering it in Firefox failed! The message is:

WARN addons.updates: Update manifest for testxp@meilijie.com did not contain an updates property

My install.rdf looks like this:

<?xml version="1.0"?>

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <Description about="urn:mozilla:install-manifest">
   <em:id>testxp@meilijie.com</em:id>
   <em:unpack>true</em:unpack>
   <em:name>CTestXP</em:name>
   <em:description>Welcome to meilijie!</em:description>
   <em:version>0.1</em:version>
   <em:creator>wanyunxiao</em:creator>
   <em:homepageURL>https://meilijie.com/testxp</em:homepageURL>
   <em:type>2</em:type>
   <!-- Mozilla Firefox -->
   <em:targetApplication>
     <Description>
       <em:id>{9f748727-57a0-4f2d-8d24-b71212c18d32}</em:id> 
       <em:minVersion>4.0</em:minVersion>
       <em:maxVersion>12.*</em:maxVersion>
     </Description>
   </em:targetApplication>
 </Description>

And my chrome.manifest:

binary-component components/TestXP.so

interfaces components/CTestXP.xpt

contract  @meilijie.com/newedu/CTestXP;1 {9f748727-57a0-4f2d-8d24-b71212c18d32}

I check the componet with firefox tool: error console.
when I input these codes:

Components.classes["@meilijie.com/newedu/CTestXP;1"].createInstance();

error message is :

时间戳: 2012年05月16日 13时14分16秒 错误: Components.classes['@meilijie.com/newedu/CTestXP;1'] is undefined 源文件:javascript:%20Components.classes["@meilijie.com/newedu/CTestXP;1"].createInstance(); 行:1

and I check it with html and js code, html code is:
<html>
  <SCRIPT SRC="MyComponentTest.js"></SCRIPT>
  <BODY>
    <BUTTON ONCLICK="MyComponentTestGo();">Go</BUTTON>
  </BODY>
</html>

and js file MyComponentTest.js below:

function MyComponentTestGo() {
try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    const cid = "@meilijie.com/newedu/CTestXP;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 + '.');
flyonok
  • 46
  • 4
  • The error message you quote has nothing to do with the binary component but rather with Firefox attempting to find an update for your extension. How did you check that the component wasn't registered? – Wladimir Palant May 15 '12 at 10:15
  • to Wladimir Palant: thanks very much. I check the componet with firefox tool: error console. when i input these codes: Components.classes["@meilijie.com/newedu/CTestXP;1"].createInstance(); error message is : Components.classes['@meilijie.com/newedu/CTestXP;1'] is undefined source file javascript: Components.classes["@meilijie.com/newedu/CTestXP;1"].createInstance(); line:1 – flyonok May 16 '12 at 06:12
  • I check it with html and js code, html code is: and js code is:function MyComponentTestGo() { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); const cid = "@meilijie.com/newedu/CTestXP;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 + '.'); } – flyonok May 16 '12 at 07:49

0 Answers0