问题描述
我将这段代码添加到Addon-SDK插件中:
$ p $ var $ devtools = Cu.import( resource://gre/modules/devtools/Loader.jsm,{});
var {WebConsoleFrame} = devtools.require(devtools / webconsole / webconsole);
虽然这个工作在一个普通的(老式)插件中,用 cfx run 我得到:
$ b $ pre $ ModuleNotFoundError:无法满足:require(devtools / webconsole / webconsole)from
(thefilename.js)
为了澄清,我试图将这2行添加到这里:
在Addon SDK的无重启插件系统中,这是不可能的?
var {WebConsoleFrame } = devtools [require](devtools / webconsole / webconsole);
I'm adding this code to a Addon-SDK addon:
var {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); var {WebConsoleFrame} = devtools.require("devtools/webconsole/webconsole");
Although this works in a normal (old style) addon, with cfx run I get:
ModuleNotFoundError: unable to satisfy: require(devtools/webconsole/webconsole) from (thefilename.js)
To clarify, I'm trying to add those 2 lines into here: https://github.com/DavidBruant/usefulStackTrace/blob/master/lib/trackStack.js
Is this not possible within the Addon SDK's restartless addon system?
A quick-and-not-so-dirty workaround
var {WebConsoleFrame} = devtools["require"]("devtools/webconsole/webconsole");
这篇关于addon SDK错误获取devtools模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!