gpt4 book ai didi

javascript - Firefox SDK page-mod 任意停止工作

转载 作者:行者123 更新时间:2023-11-30 06:29:52 25 4
gpt4 key购买 nike

我使用 Add-on 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 停止工作?

最佳答案

这可能是你的问题:

A page mod does not modify its pages until those pages are loaded or reloaded. In other words, if your add-on is loaded while the user’s browser is open, the user will have to reload any open pages that match the mod for the mod to affect them.

字体:http://blog.mozilla.org/addons/2012/09/12/introducing-page-mods-attachto

关于javascript - Firefox SDK page-mod 任意停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18407344/

25 4 0
文章推荐: javascript - 将谷歌地图复制到页面上单独的
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com