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

feat!: support manifest v3 #313

Merged
merged 18 commits into from
Jun 13, 2024
Merged

feat!: support manifest v3 #313

merged 18 commits into from
Jun 13, 2024

Conversation

sidvishnoi
Copy link
Member

@sidvishnoi sidvishnoi commented Jun 7, 2024

Context

Closes #23

Changes proposed in this pull request

Changes proposed in this pull request

  • Use updated manifestv3.json, and modify it as needed for Firefox/Chrome support.
  • As MV3 doesn't enable hosts permissions on install (automatically or manually), show an error message that permissions are required, along with a button to request permission. No other part of UI is shown until we've the permissions.
  • Make Webpack generate self-contained bundles. Otherwise, it uses dynamic script loading with document.createElement('script'), and document isn't defined in MV3 background service workers, which causes a fatal crash.
  • Clear all install-time warnings in Firefox as well as Chrome.
  • In MV3, production extension will only work on https:// websites. (See comment)

Questions:

  • Should I get rid of manifest v2 stuff? I tested it works fine in Firefox 110 even.
    • Decided to retain functionality, with a --mv2 flag during build.
    • Decided later in meeting to remove v2 stuff.
  • Should I show the permission error/prompt on all screens?
    • Decided in meeting we'll show only the error if we don't have the permissions.

@github-actions github-actions bot added the area: background Improvements or additions to extension background script label Jun 7, 2024
@raducristianpopa
Copy link
Member

raducristianpopa commented Jun 7, 2024

Extension builds preview

Name Link
Latest commit ea9ee33
Latest job logs Run #9495986026
BadgeDownload
BadgeDownload

webpack/plugins.ts Show resolved Hide resolved
webpack/plugins.ts Show resolved Hide resolved
src/manifestv3.json Outdated Show resolved Hide resolved
@github-actions github-actions bot added the area: popup Improvements or additions to extension popup label Jun 8, 2024
@sidvishnoi sidvishnoi marked this pull request as ready for review June 8, 2024 11:28
src/popup/components/ConnectWalletForm.tsx Outdated Show resolved Hide resolved
src/manifestv3.json Outdated Show resolved Hide resolved
src/manifestv3.json Outdated Show resolved Hide resolved
src/manifestv3.json Outdated Show resolved Hide resolved
src/popup/components/ConnectWalletForm.tsx Outdated Show resolved Hide resolved
@raducristianpopa
Copy link
Member

1. Should I get rid of manifest v2 stuff? I tested it works fine in Firefox 110 even.

I would keep them for now. We can probably default to using MV3 (renaming manifestv3.json to manifest.json) and keep the old manifest for the moment.

2. Should I show the permission error/prompt on all screens?

i don't think so, since the button will be disabled and we check the permission when the user submits the form.

@sidvishnoi
Copy link
Member Author

Should I show the permission error/prompt on all screens?

i don't think so, since the button will be disabled and we check the permission when the user submits the form.

So, content script also won't be injected if current URL isn't doesn't have the permission. We ask for the permission only on connect screen, but if some has connected before, and they update the extension, they won't see that they haven't given the permissions.
Also valid in case the permission is removed later (for some reason - like mistake or browsers being more strict in future with privacy considerations, like removing permission after N days).

dianafulga
dianafulga previously approved these changes Jun 11, 2024
that was a leftover from previous attempt (adding a route for missing permission)
@sidvishnoi sidvishnoi added the area: scripts Improvements or additions to custom scripts label Jun 12, 2024
@sidvishnoi sidvishnoi merged commit b4a19b1 into main Jun 13, 2024
8 checks passed
@sidvishnoi sidvishnoi deleted the manifest-v3 branch June 13, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: background Improvements or additions to extension background script area: popup Improvements or additions to extension popup area: scripts Improvements or additions to custom scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move to MV3 as MV2 is going to be deprecated
3 participants