Use new scripting API for message display scripts
This commit is contained in:
parent
b2341b1382
commit
a29a6299ef
1 changed files with 18 additions and 2 deletions
|
@ -228,11 +228,27 @@ async function clearCacheForMessages(idsInput) {
|
|||
browser.messageDisplayAction.setLabel({ label: "Classify" });
|
||||
}
|
||||
}
|
||||
if (browser.messageDisplayScripts) {
|
||||
if (browser.scripting && browser.scripting.messageDisplay) {
|
||||
try {
|
||||
const scripts = [
|
||||
{
|
||||
id: "clear-cache-button",
|
||||
js: [browser.runtime.getURL("resources/clearCacheButton.js")],
|
||||
},
|
||||
{
|
||||
id: "reason-button",
|
||||
js: [browser.runtime.getURL("resources/reasonButton.js")],
|
||||
},
|
||||
];
|
||||
await browser.scripting.messageDisplay.registerScripts(scripts);
|
||||
} catch (e) {
|
||||
logger.aiLog("failed to register message display script", { level: 'warn' }, e);
|
||||
}
|
||||
} else if (browser.messageDisplayScripts) {
|
||||
try {
|
||||
const scripts = [
|
||||
{ js: [browser.runtime.getURL("resources/clearCacheButton.js")] },
|
||||
{ js: [browser.runtime.getURL("resources/reasonButton.js")] }
|
||||
{ js: [browser.runtime.getURL("resources/reasonButton.js")] },
|
||||
];
|
||||
if (browser.messageDisplayScripts.registerScripts) {
|
||||
await browser.messageDisplayScripts.registerScripts(scripts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue