【发布时间】:2013-12-18 04:04:36
【问题描述】:
我使用插件 sdk 创建了一个扩展,它部分依赖于 page-mod。它一直运行良好。
但是,在某些时候(我不确定确切的时间,因为当它发生时我正在处理扩展的不同部分)页面模块停止工作。但是,代码没有改变。
我在运行我的扩展程序时使用 cfx 的 -p 选项(启动它时,我输入 cfx -p firefox_development_profile run(更多信息请参见 the cfx documentation)
当我包含配置文件目录时,我的内容脚本不起作用。当我不包含它时,它会包含它。所以配置文件中有一些东西导致 page-mod 停止工作。
我制作了一个非常基本的 page-mod 插件,以查看我的代码中是否存在导致问题的东西,但它也有同样的问题。我的测试代码(在main.js是)
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*.org",
contentScript: "alert('OPENED A MATCHING PAGE')",
onAttach: function(worker) {
console.log("Been attached")
}
});
我的package.json如下:
{
"name": "test_firefox",
"fullName": "Test Plugin",
"id": "jid1-0yzmDwetD2My3g",
"description": "An addon on to work with the Dalhousie Glossary System",
"author": "Daniel Yule",
"license": "MIT 2.0",
"version": "0.1.0"
}
需要说明的是:此扩展在与cfx run 一起运行时有效,但在与配置文件目录命令cfx -p firefox_development_profile run 一起使用时无效
firefox 配置文件中是否存在会导致 page-mod 停止工作的内容(我不记得对其进行过任何更改)?
【问题讨论】:
-
即使使用全新的个人资料也会发生这种情况吗?
标签: javascript firefox firefox-addon firefox-addon-sdk