Skip to content
This repository has been archived by the owner on Jan 25, 2025. It is now read-only.

feat: handle session persistence for manifest version 3 #9

Merged
merged 7 commits into from
Jan 14, 2023
Merged

Conversation

rohan-chaturvedi
Copy link
Member

@rohan-chaturvedi rohan-chaturvedi commented Jan 12, 2023

♻️ Current situation

The current implementation of session persistence leverages persistent background scripts. However manifest version 3 deprecates persistent background scripts in favor of service workers. As a result, session persistence does not work on Chrome and Chromium based browsers

💡 Proposed solution

Leverage chrome.storage.session, newly added in MV3 to persist user sessions. The session storage is held in memory and never written to disk, preserving the same threat model as persistent background scripts. Ref: https://developer.chrome.com/docs/extensions/reference/storage/#property-session

📋 : Release Notes

  • Cleaned up unused permissions from the manifest
  • Added a util to determine the manifest version of the current build
  • Added logic to handle storing, getting and clearing session data to session storage for MV3 builds.
  • Update webpack config to handle builds separately for no manifest version env var, manifest 2 and 3 (manifest file is no longer bundled for standard web builds)
  • Update build scripts. The app can now be built in 3 different ways:
    • yarn build does a standard webapp build without any manifest
    • yarn build:mv2 does a plugin build for manifest version 2 for Firefox
    • yarn build:mv3 does a plugin build for manifest version 3 for Chrome and Chromium browsers

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 12, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2d1f056
Status: ✅  Deploy successful!
Preview URL: https://21d9f498.app-keyspace-cloud.pages.dev
Branch Preview URL: https://mv3-fixes.app-keyspace-cloud.pages.dev

View logs

@rohan-chaturvedi rohan-chaturvedi changed the title refactor: handle session persistence for manifest version 3 feat: handle session persistence for manifest version 3 Jan 12, 2023
@rohan-chaturvedi rohan-chaturvedi added the enhancement New feature or request label Jan 12, 2023
@nimish-ks nimish-ks merged commit 2d6aa15 into main Jan 14, 2023
@nimish-ks nimish-ks deleted the mv3-fixes branch January 17, 2023 16:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants