Fix contextMenus not working on chromium

This commit is contained in:
ManeraKai 2022-04-14 02:53:47 +03:00
parent 0ac4e71445
commit a2c9d1f50c
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
2 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,7 @@
"webRequestBlocking", "webRequestBlocking",
"storage", "storage",
"cookies", "cookies",
"menus", "contextMenus",
"<all_urls>" "<all_urls>"
], ],
"browser_action": { "browser_action": {

View File

@ -253,19 +253,19 @@ browser.commands.onCommand.addListener(
} }
) )
browser.menus.create({ browser.contextMenus.create({
id: "settings", id: "settings",
title: browser.i18n.getMessage("Settings"), title: browser.i18n.getMessage("Settings"),
contexts: ["browser_action"] contexts: ["browser_action"]
}); });
browser.menus.create({ browser.contextMenus.create({
id: "switchInstance", id: "switchInstance",
title: chrome.i18n.getMessage("switchInstance"), title: chrome.i18n.getMessage("switchInstance"),
contexts: ["browser_action"] contexts: ["browser_action"]
}); });
browser.menus.onClicked.addListener((info, tab) => { browser.contextMenus.onClicked.addListener((info, tab) => {
if (info.menuItemId == 'switchInstance') { if (info.menuItemId == 'switchInstance') {
let url; let url;
try { url = new URL(tab.url); } try { url = new URL(tab.url); }