2010-10-22 90 views
5

所以我一直在更新FF4和Gecko 2使用的旧扩展,但我有一些问题,我得到一个错误,说classID缺失或不正确的组件....Firefox扩展开发firefox4

有没有其他人有类似的问题或知道如何解决这个问题?

function jsshellClient() { 
    this.classDescription = "sdConnector JavaScript Shell Service"; 
    this.classID = Components.ID("{54f7f162-35d9-524d-9021-965a3ba86366}"); 
    this.contractID = "@activestate.com/SDService?type=jsshell;1" 
    this._xpcom_categories = [{category: "sd-service", entry: "jsshell"}]; 
    this.name = "jsshell"; 
    this.prefs = Components.classes["@mozilla.org/preferences-service;1"] 
     .getService(Components.interfaces.nsIPrefService) 
     .getBranch("sdconnector.jsshell."); 
    this.enabled = this.prefs.getBoolPref("enabled"); 
    this.port = this.prefs.getIntPref("port"); 
    this.loopbackOnly = this.prefs.getBoolPref("loopbackOnly"); 
    this.backlog = this.prefs.getIntPref("backlog"); 
} 
jsshellClient.prototype = new session(); 
jsshellClient.prototype.constructor = jsshellClient; 

当原型为这个调用generateNSGetFactory它给在FF4抱怨的classID错误控制台的错误。我很确定没有其他人使用相同的GUID,所以我没有看到问题。

+1

为什么不发布导致错误的代码? – 2010-10-22 13:37:14

回答

2

Fx4中JS XPCOM组件的一个重要变化是它们现在需要在chrome.manifest中注册,请参阅documentation on the changes的这一页。

+0

我知道。我在chrome.manifest文件中注册了这个问题,当我尝试创建NSGetFactory时。 – 2010-10-24 17:30:14

+0

var NSGetFactory = XPCOMUtils.generateNSGetFactory([jsshellclient]);试图创建这个工厂,它抱怨CID不正确。 – 2010-10-24 17:31:37

+0

并且您对chrome.manifest进行了必要的更改?你确定这些更改是正确完成的?如果没有,那么你可以请张贴你的chrome.manifest? – erikvold 2010-10-24 20:48:08