meta-quest / immersive-web-emulator

Browser extension that emulates Meta Quest devices for WebXR development. Lead: Felix Zhang (fe1ix@meta.com)
https://developer.oculus.com/blog/webxr-development-immersive-web-emulator/
MIT License
296 stars 34 forks source link

Firefox Support #7

Open msub2 opened 1 year ago

msub2 commented 1 year ago

I've been a long time user of Firefox, and for a while I was able to load this extension as a temporary add-on (I assume this was before aligning it with Manifest V3). As someone with no experience in WebExtensions development, what exactly is the primary issue preventing this from working on Firefox now? From a quick skim of resources Mozilla seems to declare that they're supporting V3, but maybe you can shed some more light on the subject.

msub2 commented 1 year ago

Per discussion on Discord, it appears the blocker in Firefox is support for background service workers for Manifest V3 https://bugzilla.mozilla.org/show_bug.cgi?id=1573659

mrxz commented 1 year ago

Besides the lack of background service worker support in Firefox, there is another issue. The MAIN ExecutionWorld isn't supported by Firefox yet, which the extension uses to inject the webxr-polyfill. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1736575

It's relatively straightforward to get something working as the background service worker can be swapped out for a background event page/script (I believe that is Firefox only when used with Manifest v3) and injecting the webxr-polyfill.js into the document from a content script instead of as as content script.

I created a fork with the above two changes and it seems to work surprisingly well. :slightly_smiling_face: There is only one minor inconvenience. The execution of the polyfill script isn't guaranteed to be before the other scripts on a page, so a page might conclude that WebXR isn't supported. Setting dom.vr.webxr.enabled to true in about:config effectively works around this issue as the page either detects the "real" WebXR API or the polyfill, but once you enter an immersive session it uses the polyfill Link to the fork: https://github.com/mrxz/immersive-web-emulator

ralyodio commented 9 months ago

any idea when this will happen?