首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >火狐扩展开发firefox4

火狐扩展开发firefox4
EN

Stack Overflow用户
提问于 2010-10-22 21:15:21
回答 2查看 438关注 0票数 5

因此,我一直在更新用于FF4和Gecko 2的旧扩展,但我遇到了一些问题,我收到一个错误,说组件缺少classID或组件不正确……

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

代码语言:javascript
复制
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,所以我看不出有什么问题。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2010-10-24 05:09:08

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

票数 2
EN

Stack Overflow用户

发布于 2011-01-10 03:50:18

XPCOMUtils使用的特殊属性,如classID、contractID等,必须在Class.prototype上定义,而不是像您所做的那样在构造函数中定义:https://developer.mozilla.org/en/XPCOMUtils.jsm#Class_declaration

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3997134

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档