about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorHygna <hygna@proton.me>2022-10-13 22:09:24 +0100
committerHygna <hygna@proton.me>2022-10-13 22:09:24 +0100
commit11b42fb9dcb9497d77d6c7a1f3c0207fd3d44ae7 (patch)
tree373d4d6fb0a627574a15a78cb30ec5e62b549b37
parentUpdate fetch url for Libreddit instances. (diff)
downloadlibredirect-11b42fb9dcb9497d77d6c7a1f3c0207fd3d44ae7.zip
Fixed bug on chromium browsers where creating toggle redirects context menu would fail
-rw-r--r--src/pages/background/background.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 5416c12a..35deb8f9 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -164,11 +164,19 @@ browser.contextMenus.create({
 	contexts: ["browser_action"],
 })
 
-browser.contextMenus.create({
-	id: "toggleTab",
-	title: browser.i18n.getMessage("toggleTab"),
-	contexts: ["page", "tab"],
-})
+try {
+	browser.contextMenus.create({
+		id: "toggleTab",
+		title: browser.i18n.getMessage("toggleTab"),
+		contexts: ["page", "tab"],
+	})
+} catch {
+	browser.contextMenus.create({
+		id: "toggleTab",
+		title: browser.i18n.getMessage("toggleTab"),
+		contexts: ["page"],
+	})
+}
 
 browser.contextMenus.create({
 	id: "redirectLink",