且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Addon可以在jpm run上附加脚本,但不能在实际的xpi上附加脚本

更新时间:2023-12-05 17:49:52

好吧,我设法解决了这个问题.

Well, I managed to fix this problem.

现在,我不再使用手动将脚本附加到打开的选项卡上,而是在打开选项页面时使用pagemod附加脚本.

Instead of manually attaching the script to the opened tab, I now use pagemod to attach the script whenever the the options page is opened.

var pageMod = require("sdk/page-mod");
pageMod.PageMod({
    include: "resource://protector/data/privacyProtector/options.html",
    contentScriptFile: "./privacyProtector/js/internalOptions.js",
    contentScriptWhen: "end",
    onAttach: sendSettings
});

这样,选项页面可以正常工作. 我遇到了一个新问题,但是我会问一个新问题,这样它可以是一个独立的问题.

This way, the options page works perfectly fine. I've encountered a new problem, but I'll ask a new question for it, so that this can be a stand-alone problem.