Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest V3-compatible injection demo #1330

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcustyphoon
Copy link
Collaborator

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

@marcustyphoon
Copy link
Collaborator Author

  • file names and locations are arbitrary/little thought was put into them
  • injected function bodies in their current positions are block-commented (would be removed if merging this; this just makes for easier comparison/lower risk of merge conflicts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant