convert wBlock Advanced to shared web extension#282
Conversation
replaces the macOS-only Safari App Extension with a Safari Web Extension that shares all JS/HTML resources with the iOS extension. adds declarativeNetRequest rules to strip CSP headers on YouTube for scriptlet injection. fixes MainActor deadlock in checkForUpdates that froze the app during apply changes. removes broken refresh button from element zapper popup, clear now reloads the page.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the macOS extension by migrating it from a traditional Safari App Extension to a modern Safari Web Extension. This change streamlines development by allowing code sharing between macOS and iOS platforms, addresses critical functional issues like update deadlocks, and enhances web compatibility by dynamically modifying CSP headers for specific sites. The user interface for the element zapper also received minor improvements for clarity and responsiveness. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
This also fixes #144 (wBlock Advanced not working in web apps/PWAs). Safari App Extensions couldn't run in PWAs, but Web Extensions can. One tradeoff: the toolbar badge showing blocked element count is gone. That was tied to |
There was a problem hiding this comment.
Code Review
This pull request is a significant and well-executed refactoring that successfully unifies the macOS and iOS web extensions, which will greatly improve maintainability by reducing code duplication. The fix for the MainActor deadlock in checkForUpdates is particularly noteworthy, demonstrating a solid understanding of Swift concurrency by pre-fetching and deferring MainActor-bound operations. The UI and functionality improvements to the popup are also positive changes. I have one suggestion to enhance error logging to prevent silent failures.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 137fd60b7d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Replaces the macOS Safari App Extension (wBlock Advanced) with a Safari Web Extension that shares all JS, HTML, and Swift handler code with the iOS extension. Fixes #223.
wBlock Scripts (iOS)/Resources/directly, no code duplicationdeclarativeNetRequestrules to strip CSP headers on youtube.com so scriptlets can injectcheckForUpdatesthat caused "Checking for updates..." to hang forever during Apply Changes (pre-fetch validators before entering task group, defer writes until after)tabspermission to manifest for popup-to-content-script messaging on macOS