开发者

Firefox extension development firefox4

开发者 https://www.devze.com 2023-01-22 01:47 出处:网络
So I\'ve been working on updating old extensions for use with FF4 and Gecko 2 but I am having some issues where I am getting an error that says, classID missing or incorrect for component....

So I've been working on updating old extensions for use with FF4 and Gecko 2 but I am having some issues where I am getting an error that says, classID missing or incorrect for component....

Has anyone else had a similar issue or know of how to get around this?

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;

When calling 开发者_JS百科generateNSGetFactory on the prototype for this it gives an error in the Error Console in FF4 complaining about the classID. I'm pretty sure that nothing else is using the same GUID so I don't see the problem.


An important change in JS XPCOM components in Fx4 is that they now need to be registered in the chrome.manifest, see this page of documentation on the changes.


The special properties used by XPCOMUtils, like classID, contractID, and so on, have to be defined on Class.prototype, not in the constructor function, as you did: https://developer.mozilla.org/en/XPCOMUtils.jsm#Class_declaration

As for the other question, you posted in a comment, please post it in a different question, if it's still relevant, with the necessary code provided.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号