I'm building a toolbar button extension for Firefox. In my background script, I need to access the document
for the current tab when the toolbar button is clicked.
window
in this context is the window for the extension, not for the current tab. Other functions like browser.tabs.getCurrent()
don't work in background scripts.
I know it is possible since other extensions have access to the current document (e.g. 1Password will identify and fill input
elements.)
Note: All of the previous questions on SO about the same functionality from 2010, 2012, etc. are no longer value.