Javascript find.find()和browser.find.highlightResults()不适用于firefox 61扩展
我想使用和为firefox v61做一个扩展。我已经按照建议在我的manifest.json上添加了find作为权限部分的一部分,并且我尝试了在highlightResults上找到的示例脚本,但它似乎没有运行Javascript find.find()和browser.find.highlightResults()不适用于firefox 61扩展,javascript,firefox,firefox-addon,firefox-addon-webextensions,Javascript,Firefox,Firefox Addon,Firefox Addon Webextensions,我想使用和为firefox v61做一个扩展。我已经按照建议在我的manifest.json上添加了find作为权限部分的一部分,并且我尝试了在highlightResults上找到的示例脚本,但它似乎没有运行 { "manifest_version": 2, "name": "find words", "version": "1.0", "description": "highlights words found on random website", "icons": {
{
"manifest_version": 2,
"name": "find words",
"version": "1.0",
"description": "highlights words found on random website",
"icons": {
"48": "icons/border-48.png"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["test.js"]
}
],
"permissions": [
"webNavigation",
"webRequest",
"find"
]
}
我缺少什么?您应该使用背景脚本而不是内容脚本。尝试时运气不佳,如:“背景”:{“脚本”:[“test.js”]}
function found(results) {
console.log(`There were: ${results.count} matches.`);
if (results.count > 0) {
browser.find.highlightResults();
}
}
browser.find.find("banana").then(found);