Write on the margins of the internet. Powered by the AT Protocol.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

firefox: Ensure context menus register on startup

Fixes context menus not showing when the temp extension is reloaded in
Firefox.

+17 -9
+17 -9
extension/background/service-worker.js
··· 75 75 updateBaseUrls("https://margin.at"); 76 76 } 77 77 78 + await ensureContextMenus(); 79 + 80 + if (hasSidebarAction) { 81 + try { 82 + await browser.sidebarAction.close(); 83 + } catch { 84 + /* ignore */ 85 + } 86 + } 87 + }); 88 + 89 + chrome.runtime.onStartup.addListener(async () => { 90 + await ensureContextMenus(); 91 + }); 92 + 93 + async function ensureContextMenus() { 78 94 await chrome.contextMenus.removeAll(); 79 95 80 96 chrome.contextMenus.create({ ··· 100 116 title: "Open Margin Sidebar", 101 117 contexts: ["page", "selection", "link"], 102 118 }); 103 - 104 - if (hasSidebarAction) { 105 - try { 106 - await browser.sidebarAction.close(); 107 - } catch { 108 - /* ignore */ 109 - } 110 - } 111 - }); 119 + } 112 120 113 121 chrome.action.onClicked.addListener(async () => { 114 122 const stored = await chrome.storage.local.get(["apiUrl"]);