Manifest V3-compatible injection demo #1330
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a functional MV3 port (without the change to manifest.json) that works in both Chrome and Firefox without per-browser modification, i.e. slightly updated #921. There are a number of methods to do our main world script injection; this one uses bubbled custom events and moves the imported function bodies into their own files, using a cached dynamic import to load them for performance (this should be compared against simply setting a script element's
src
property, for example).I had to append the target element as the last argument to the injected function unconditionally; this means injected functions can't have optional arguments. We could do other stuff: make it the first argument, change the signature to take an object of named fields, whatever.
Testing steps
to write