因此,我一直在更新用于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;为此,在原型上调用generateNSGetFactory时,它会在FF4的error Console中给出一个错误,抱怨classID。我非常确定没有其他的GUID使用相同的GUID,所以我看不出有什么问题。
发布于 2010-10-24 05:09:08
Fx4中JS组件的一个重要变化是,它们现在需要在chrome.manifest中注册,请参阅documentation on the changes的此页面。
发布于 2011-01-10 03:50:18
XPCOMUtils使用的特殊属性,如classID、contractID等,必须在Class.prototype上定义,而不是像您所做的那样在构造函数中定义:https://developer.mozilla.org/en/XPCOMUtils.jsm#Class_declaration
至于另一个问题,你在评论中发布了,如果它仍然相关,请在另一个问题中发布它,并提供必要的代码。
https://stackoverflow.com/questions/3997134
复制相似问题