我想用js-ctypes的Firefox附加组件来访问本地DLL的方法,但它不工作。Firefox附加SDK和js-ctypes
的main.js代码:
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "mysite.com",
contentScriptFile: data.url("myjs.js")
});
的myjs.js代码只是:
Components.utils.import("resource://gre/modules/ctypes.jsm");
alert("hello world");
在Firefox的控制台,我得到了这些消息:
The Components object is deprecated. It will soon be removed.
TypeError: Components.utils is undefined
否“你好世界“警报被解雇。
有什么问题?谢谢!
你的答案让我走上正轨。我也不能在内容脚本中“要求”。我必须在main.js中使用ctypes并使脚本进行通信。更多信息:https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts/Communicating_With_Other_Scripts –