Moz-extension protocol is not accepted by Firebase. Any workarounds?

I’m creating Firefox Addon that will replace default “new tab page” with custom html page stored locally. I plan to sync data with web app hosted in Firebase. Unfortunately, I’m stuck, because there is a problem with implementing Firebase Google sign-in.

This is a message I see when I connect to Firebase in order to display login popup:

This operation is not supported in the environment this application is running on. “location.protocol” must be http, https or chrome-extension and web storage must be enabled

My current “location.protocol” is moz-extension since I’m displaying HTML page hosted locally using Firefox addon.

Are there any workarounds on that? Can I somehow “simulate” http or chrome-extension?

This seems like an OAuth or OpenID flow, so https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/identity/getRedirectURL or an unused URL you control may work too.

1 Like

If they allow “location.protocol” to be chrome-extension, there probably isn’t a reason for them not to allow moz-extension as well. Just ask them!

Even though the “and web storage must be enabled” part is … concerning. You can not execute remote code on an extension page (And if they don’t require their own code to run, why would they require “web storage”?).


an unused URL you control may work too

That may be a better option. If you don’t have a domain or hosting, just get a free account for DynamicDNS somewhere (e.g. mydummy.somedyndns.com), put in a static A record that points at some simple websites server (e.g. example.com, it doesn’t really matter what the server replies) and use the former subdomain e.g. in a (hidden) iframe.

2 Likes

for some reason, I am unable to load anything in iframe in firefox,
any ideas why It might be failing ?

You are probably missing host permission for the page you are trying to load.
Second reason could be that the target page CSP blocks your iframe. In that case, you need to load your own addon page in the iframe and inside that page load the target iframe.