I'm trying to make firebase-auth work in a chrome extension with manifest v3.
The biggest problem is that this code would need to run as a service worker, and as such can't access the main window for security reasons. Assuming that that will not change, I tried to modify the firebase libraries, such that on startup, I create a new Chrome window with chrome.windows.create() and then replace all calls to window in the firebase libraries with the newly created window. My current theory is that this should work (more or less, modulo service worker restarts etc). It required downloading the libraries and using webpack or rollup to create a single .js bundle.
HOWEVER: I'm currently stuck because even after chrome.windows.create(), I need to update the global javascript window and document variables (that for service workers are undefined by default). How do I go about this? The object returned from chrome.windows.create is not the same as the global javascript window, and I have no idea on how to get to document.
Sorry for the noob questions, and many thanks in advance for any help!