Skip to content

Conversation

daisuke8000
Copy link

@daisuke8000 daisuke8000 commented Dec 23, 2024

Summary

Issue180

  1. Update Manifest File

    • Update manifest.json to follow the MV3 format.
    • Adjust necessary APIs and permissions to be compatible with MV3.
  2. Address MV3-Specific Changes

    • Adapt to the use of service workers and address API removals or deprecations introduced in MV3.
    • Add public/external-script.js to replace inline scripts, ensuring compliance with Content Security Policy (CSP).

Problem description

  1. Warning Message
    The Chrome Web Store displays a warning indicating that the extension does not align with the "best practices for Chrome extensions" because it is still using Manifest Version 2.

    • There is a risk that this extension may soon cease to be supported by Google.
  2. MV2 Deprecation Timeline
    Google has officially announced the deprecation of Manifest Version 2, and starting in 2024, support for extensions using MV2 will be discontinued.

  3. CSP Restrictions
    Due to restrictions imposed by Content Security Policy (CSP), the execution of inline scripts is blocked.

    • In response, inline scripts were extracted into an external file, external-script.js, that is now referenced externally.
  4. Impact on the Project
    If this extension is not updated to Manifest Version 3, it may cease to function properly in the near future.

Pros/cons of approach implemented

[Pros]

  • Improved Readability: More meaningful constant names and cleaner structure make the code easier to understand.
  • Reduced Duplication: Common logic, like window.postMessage, is extracted into reusable functions, following the DRY principle.
  • CSP Compliance: By extracting inline scripts to an external file, the implementation adheres to CSP restrictions, reducing the risk of security issues.

[Cons]

  • Increased Complexity: Introducing new utility functions and abstractions might make the code harder to understand for first-time readers, as it adds more layers of indirection.
  • Maintenance Overhead: Managing separate external script files may add an additional maintenance burden.

Checklist

  • Is this PR a reasonable size?

Code Review Guidelines for Reviewers

  • Try to review in a timely manner. Opinions/nitpicks should not be blockers. Pair on a call for non-trivial feedback.
  • Overall design and approach should follow established patterns. Don't try to make the PR perfect.
  • Try to identify edge cases, race conditions, over-engineering, lack of test coverage and complexity.
  • If you don't feel qualified to review the code, pass it on to someone who is.

@daisuke8000 daisuke8000 marked this pull request as ready for review December 23, 2024 18:15
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