Notes for issues and gotchas encountered when developing and testing Firefox extensions.
-
If the test machine does not have the correct time set, attempting to install a recent version of an extension from addons.mozilla.org may show an error "this addon may be corrupt" and won't install it even if the addon does work and installs successfully from the debugging menu.
Takeaway: Take care to make sure the time is synced correctly in VM snapshots when testing.
-
Firefox for Android browserAction popup extensions will not open when the active tab is on addons.mozilla.org . The addon should be tested with another website or file tab open.
- There are three main ways of creating context menus:
menus
manifest permission andbrowser.menus.create({})
+activeTab
permission (Example: hashzilla 0.1.6)contextMenus
permission andchrome.contextMenus.create({})
+activeTab
permission (Example: hashzilla 0.2.0)contextMenus
permission andbrowser.contextMenus.create({})
+tabs
permission (Example: open-in-cyberchef-firefox)
The last two constructs have examples that are tested and working in older versions of Firefox, like 48.0 (the minimum for WebExtensions support) and 52esr.
The first construct works in recent (mv2) versions of Firefox, but not earlier versions like 48.0 and 52: browser.menus is undefined
Takeaway: use of chrome.contextMenus.create
is preferred, and also works with mv3 chrome extensions.
The permissions error "Missing host permissions for the tab"
is present on view-source
, PDF view (pdf.js), and reader view pages when trying to run {scripting|tabs}.executeScript()
.
The "missing host permissions" error has also been observed when using the tabs
permission and loading executeScript
on a local file (file://
) URI.
Using the activeTab
manifest permission instead of tabs
was found to fix host permissions errors on file://
pages.
Takeaway: activeTab
is preferred, but view-source, PDF viewer, and reader view pages still won't load executeScript
behaviors.
In MV3, host_permissions
access is "optional", meaning host permissions do not run by default, and must be set by the user, requested by the addon or enabled using activeTab
with a user input handler.
<all_urls>
host_permission has no effect, whether or not this is by design.
permissions.request
cannot be called via chrome.runtime.onInstalled.AddListener
, and must be called from a user input handler.