duckduckgo / duckduckgo-privacy-extension

DuckDuckGo Privacy Essentials browser extension for Firefox, Chrome.
https://duckduckgo.com/app
Apache License 2.0
1.21k stars 242 forks source link

Wait for user allowlisting to apply before reloading the website #2515

Closed kzar closed 2 months ago

kzar commented 2 months ago

The popup UI (e.g. privacy dashboard) lets users disable protections for a website. When the user clicks the toggle button, the website is allowlisted and reloaded. With MV3, this requires a declarativeNetRequest rule update which doesn't happen instantly. We need to take care for that rule update to finish before reloading the page, because otherwise some requests might still be blocked after the reload.

Reviewer: @sammacbeth

Steps to test this PR:

  1. Navigate to https://privacy-test-pages.site/privacy-protections/request-blocking/
  2. Click to allowlist the website using the popup UI
  3. Immediately click to run the tests after the page reloads
  4. Ensure that the requests are now allowed.

Automated tests:

Reviewer Checklist:
PR Author Checklist: