Skip to content
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

Add Chrome MV3 support for "surrogate script" redirections #1398

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

kzar
Copy link
Collaborator

@kzar kzar commented Sep 9, 2022

The extension redirects requests to common third-party scripts to subbed out "surrogate scripts". We do that instead of simply blocking the third-party scripts since this way, we avoid breaking websites that assume the APIs provided by the third-party scripts will always be present.

Reviewer: @jonathanKingston

Steps to test this PR:

  1. Build the chrome-mv3 extension: npm install && npm run dev-chrome-mv3
  2. Install that
  3. Browse to https://www.theguardian.com/
  4. Open the developer tools, switch to the "Network" panel and ensure that the following surrogate scripts are redirected: gpt.js and analytics.js.

Note: It is expected that some redirections will fail with an "net::ERR_UNSAFE_REDIRECT" error. See https://crbug.com/1361350

Automated tests:

  • Unit tests
  • Integration tests
Reviewer Checklist:
  • Ensure the PR solves the problem
  • Review every line of code
  • Ensure the PR does no harm by testing the changes thoroughly
  • Get help if you're uncomfortable with any of the above!
  • Determine if there are any quick wins that improve the implementation
PR Author Checklist:
  • Get advice or leverage existing code
  • Agree on technical approach with reviewer (if the changes are nuanced)
  • Ensure that there is a testing strategy (and documented non-automated tests)
  • Ensure there is a documented monitoring strategy (if necessary)
  • Consider systems implications

Makefile Outdated Show resolved Hide resolved
@kzar kzar force-pushed the mv3-surrogate-scripts branch 3 times, most recently from b8959a7 to cc5fc6b Compare October 10, 2022 11:34
The extension redirects requests to common third-party scripts to
subbed out "surrogate scripts". We do that instead of simply blocking
the third-party scripts since this way, we avoid breaking websites
that assume the APIs provided by the third-party scripts will always
be present.
@kzar kzar marked this pull request as ready for review October 10, 2022 12:33
@jonathanKingston
Copy link
Collaborator

LGTM thanks for making the changes :)

@kzar kzar merged commit 23e7b92 into duckduckgo:develop Oct 10, 2022
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.

None yet

2 participants