Skip to content

Migrate to Manifest V3 #365

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Migrate to Manifest V3 #365

wants to merge 2 commits into from

Conversation

neavns
Copy link

@neavns neavns commented Jun 5, 2025

JSON Viewer Migration to Manifest V3

Overview

As you’re likely aware, the current extension has stopped working due to its reliance on an outdated manifest version, which is no longer supported on the Chrome Web Store. This PR updates the extension to Manifest V3.

Key Changes

Manifest File Updates

  • Changed manifest_version from 2 to 3
  • Replaced background.scripts with background.service_worker
  • Restructured web_accessible_resources to use the new object format with resources and matches properties
  • Replaced permissions that are now considered host permissions with entries in the new host_permissions array

Background Script Changes

  • Converted background page to a service worker
  • Updated message handling to properly support asynchronous responses
  • Added return true to message listeners to keep the message channel open for async responses

Storage API Usage

  • Updated Storage API usage to handle the asynchronous nature of Chrome storage in MV3
  • Implemented proper callback handling for storage operations
  • Added fallback mechanisms when storage is not immediately available

Content Security Policy

  • Removed inline scripts to comply with stricter CSP rules
  • Moved inline event handlers to proper JavaScript event listeners
  • Ensured all CSS is loaded via proper resource references

Theme Loading

  • Updated theme CSS loading mechanism to work with MV3's stricter resource access rules
  • Added all theme CSS files to web_accessible_resources list
  • Fixed paths for theme resources to ensure proper loading

Omnibox Functionality

  • Updated omnibox handling to work with MV3's service worker model
  • Fixed scratch pad functionality to work with the new extension structure

Build Process Changes

  • Updated webpack configuration to support MV3 requirements
  • Ensured proper copying of theme CSS files to the correct locations

Housekeeping

  1. Updated most dependencies to their latest version
  2. Removed redundant deps such as promise
  3. Updated the syntax in the files touched
  4. Fixed the alwaysFold typo 😉

Thanks for this amazing extension @tulios 🙂

@neavns
Copy link
Author

neavns commented Jun 5, 2025

@tulios could this be reviewed please?

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.

1 participant