Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firefox扩展开发firefox4_Firefox_Firefox Addon_Xpcom - Fatal编程技术网

Firefox扩展开发firefox4

Firefox扩展开发firefox4,firefox,firefox-addon,xpcom,Firefox,Firefox Addon,Xpcom,所以我一直在努力更新旧的扩展,以便与FF4和Gecko 2一起使用,但我遇到了一些问题,其中我得到了一个错误,即classID缺失或组件不正确 有没有其他人有过类似的问题,或者知道如何解决这个问题 function jsshellClient() { this.classDescription = "sdConnector JavaScript Shell Service"; this.classID = Components.ID("{54f7f162-35d9-524d-9021-9

所以我一直在努力更新旧的扩展,以便与FF4和Gecko 2一起使用,但我遇到了一些问题,其中我得到了一个错误,即classID缺失或组件不正确

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

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;

为此在原型上调用GeneratesGetFactory时,FF4中的错误控制台中会出现一个错误,抱怨classID。我很确定没有其他东西使用相同的GUID,所以我看不出问题所在。

Fx4中JS XPCOM组件的一个重要变化是,它们现在需要在chrome.manifest中注册,请参见本页。

XPCOMUtils使用的特殊属性,如classID、Constract等,必须在Class.prototype上定义,不在构造函数中,正如您所做的:


至于另一个问题,您发表了评论,如果仍然相关,请在另一个问题中发表,并提供必要的代码。

为什么不发表导致错误的代码?我知道。我已经在chrome.manifest文件中注册了这个文件。问题是当我尝试创建NSGetFactory.var NSGetFactory=XPCOMUtils.generateNSGetFactory([jsshellclient])时;尝试创建此工厂,但它抱怨CID不正确。您对chrome.manifest进行了必要的更改吗?您确定这些更改都正确完成了吗?如果没有,那么你能发布你的chrome.manifest吗?我现在已经解决了这个问题(我犯了一个愚蠢的错误,忘记了应用函数),但是我的扩展将不会运行,它只是初始化js文件,什么也不做。我是否需要指定一个应用程序启动或其他什么,以便调用扩展名.start()?