Will scripting.ExecutionWorld.MAIN be supported?

Hi! This is Mengdi from React Developer Tooling team.
Firefox is the only browser that does not support it

This is a major issue blocking us from migration the Firefox add-on to MV3.
Is there any plan to support this?

Thanks

I am in the same situation. I want to support FF with our extension, but this is a hold up.

Are you sure about that @cmonday ? https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/RegisteredContentScript clearly shows that Safari doesn’t support support world: MAIN either.

Safari obviously just released their RegisteredContentScript support, so maybe it will come at a later date (and the fact that it is usable on executeScript makes that seem at least possible) but from what I can tell (including testing), it definitely isn’t supported on registerContentScripts on Safari yet either.

Yes I believe we plan to add support for MAIN, though not sure about priority.

Can you please explain your use case, and what can’t be achieved using window.eval or other techniques available in mv2?

Hey Tomislav, this is Ruslan, I am working on React DevTools.

Our main use case is to inject content script in page environment, where we can patch window with React DevTools hook object. It is important for us to do it before React has loaded on the page. This is why we can’t use inspectedWindow.eval, unless we would reload the whole document once user has opened browser DevTools.

For Firefox currently we use XMLHttpRequest to load script before React - https://github.com/facebook/react/blob/main/packages/react-devtools-extensions/src/contentScripts/prepareInjection.js#L14-L30. Some applications might restrict us from doing so with CSP. This is only permitted in MV2.

The way we do it in Chrome - we just dynamically register content script, which runs at document_start and with ExecutionWorld.MAIN specified.

Follow https://bugzilla.mozilla.org/show_bug.cgi?id=1736575 if you’re interested in the progress on the ExecutionWorld.MAIN implementation.