'Firefox addon works normally as a temporary addon in the "DevTools" environment but doesn't when in a persistant profile

Background:

So. I'm currently working on a Firefox extension, and I've been testing it using web-ext, which clears the data on close. The extension has functionality across restarts, and in order to make sure it works I'd have to be able to have persistent local storage across restarts.

To test this:

  1. I made a testing profile and ran the --firefox-profile argument. The extension runs normally with the argument, but the storage doesn't carry over since web-ext makes a temp copy of the specified profile.

  2. This is where the --keep-profile-changes argument comes in. However, when I ran it (web-ext run --firefox-profile "[profile-directory]" --keep-profile-changes --browser-console) the extension button on the toolbar would continually disappear and reappear. Whatever was messing up the extension was also throwing lots of "sendRemoveListener on closed conduit" errors in the browser console.

Possible cause:

While looking for a solution, I found this Bugzilla report mentioning that browser.contextMenus.onClicked.addListener() (which I use in my extension) can cause that error to get thrown, but I can't seem to find a solution.

If parts of my code are needed to figure out how to fix this, let me know and I can edit the question to include it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source