If I add a background script that adds a context menu item using chrome.contextMenus.create()
that menu item will be created again every time the web extension gets auto reloaded by web-ext or if I manually reload it with the reload button in about:debugging.
How can I prevent this from happening? Is it a bug? I’ve tried calling chrome.contextMenus.removeAll()
and chrome.contextMenus.remove('id')
before I create any context menu items but the functions doesn’t remove any of the old menu items that were added on previous reloads.
It also seems like the click event for the menu item will only get called if I click the last menu item in the context menu but I suppose the reason for that is that they all have the same id?
I’m using Firefox Developer Edition 49.0a2 (2016-07-21) when I’m testing this.
Thanks!