Access the Add-on SDK from within a traditional XUL-based add-on?

这一生的挚爱 提交于 2019-12-05 21:15:34

The following is the way devtools does it, but certain modules will choke (the obvious candidate being self). I think you will have better luck with low-level modules.

let {Loader} = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
let loader = new Loader.Loader({
  paths: {
    "": "resource://gre/modules/commonjs/"
  },
  globals: {},
});

let require = Loader.Require(loader, { id: "myaddon" })
// now you can require addon-sdk modules
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!