addon SDK错误获取devtools模块 [英] Addon SDK error getting devtools module

查看:163
本文介绍了addon SDK错误获取devtools模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将这段代码添加到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行添加到这里: https://github.com/DavidBruant/usefulStackTrace/blob/master /lib/trackStack.js



在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模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆