Skip to content

Fix Chrome MV3 blocking, add proxy detection, switch to per-site permissions#6

Open
adriaandotcom wants to merge 1 commit intomainfrom
fix-chrome-bug
Open

Fix Chrome MV3 blocking, add proxy detection, switch to per-site permissions#6
adriaandotcom wants to merge 1 commit intomainfrom
fix-chrome-bug

Conversation

@adriaandotcom
Copy link
Copy Markdown
Contributor

Summary

Closes #5

  • Fixes Chrome breakage. IS_FIREFOX detection no longer trips on Chrome's new browser global; Chrome stays on the declarativeNetRequest path.
  • Proxy detection. On Block, detects and blocks */simple.gif beacons (via performance.getEntriesByType) and same-origin .js proxy scripts (via /* Simple Analytics body signature). Added "image" to DNR resource types.
  • Removes the counter. Badge count and per-script timesBlocked never worked reliably under DNR; all related code and UI copy is gone.
  • Permission model: "selected websites". host_permissions: ["<all_urls>"]optional_host_permissions: ["*://*/*"]. No more "on all sites" warning; users grant access per site.
  • Popup-dies-on-permission-dialog fix. The popup now stores a pendingBlock intent and a new chrome.permissions.onAdded listener in the background finishes detection + storage + icon refresh. First-click Block now works.
  • Migration UX. On upgrade, if saved blocked sites have no host access, the options page opens automatically and shows a banner with a Re-enable button per site.
  • Options page polish. Max width, card + shadow, SA logo, dark mode, updated copy.
  • Popup polish. Link to the options page.
  • DNR reliability. Real error messages (no more [object Object]), dedup + empty-filter guards, storage.onChanged is the single source of truth (killed a rule-id race), non-blocklist keys no longer crash the listener.
  • Noise removal. Silenced No tab with id errors.
  • Docs. README rewritten with build + release steps (Simple Analytics Google account).
  • Version bump. 1.81.9.

Security implications

  • No security impact
  • Has security impact - described as:

Testing

Locally in Google Chrome.

Test plan

  • Standard SA site: Block → allow → reload → icon gray, SA script blocked.
  • Proxy site: Block → allow → reload → */simple.gif + detected proxy .js blocked.
  • Upgrade from 1.8 with existing sites: options page opens, Re-enable per site restores blocking.
  • Popup "the options page" link opens options and closes popup.

Checklist

  • Linked to an issue
  • Tested
  • Asked for a review

Recent Chrome MV3 versions expose a `browser` global alias, which caused
`IS_FIREFOX` to incorrectly evaluate to `true` in Chrome. The extension
then tried to register a blocking `chrome.webRequest.onBeforeRequest`
listener that doesn't exist in the Chrome MV3 manifest, throwing
"Cannot read properties of undefined (reading 'onBeforeRequest')".

Switch to feature-detecting `declarativeNetRequest` vs. blocking
`webRequest` so Chrome uses dynamic rules and Firefox keeps using
webRequest. Also guard `updateListeners` against a missing
`chrome.webRequest.onBeforeRequest` as a defensive fallback.
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.

Extension does not work on chrome

2 participants