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

Get script injection working for Chrome MV3 builds of the extension #1389

Merged

Conversation

kzar
Copy link
Collaborator

@kzar kzar commented Sep 5, 2022

Get script injection working for Chrome MV3 builds of the extension

Chrome Manifest V3 introduces the new scripting API[1] that can inject
scripts directly into the "main world" of a website. Along with that,
Manifest V3 prevents the old pattern of injecting a script element
into the DOM. Adjust to those changes here, to get our injected
protections working again.

Note: about:blank frame script injection is not yet working[2].

1 - https://developer.chrome.com/docs/extensions/reference/scripting
2 - https://crbug.com/1360392

Reviewer: @jonathanKingston

Steps to test this PR:

  1. Navigate to the storage blocking test page.
  2. Click "Store data", then "Retrieve data", expand the results, and note which are blocked.
  3. Build MV3 extension: npm install && npm run dev-chrome-mv3
  4. Install that in Chrome.
  5. Load the test page again and retry the test in step 2.
  6. Ensure that more third party cookies are blocked.

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

@kzar kzar force-pushed the mv3-script-injection-register branch from db41bfc to 9dace78 Compare September 5, 2022 15:24
@kzar kzar force-pushed the mv3-script-injection-register branch from 9dace78 to 24a94d8 Compare September 5, 2022 15:37
@kzar kzar force-pushed the mv3-script-injection-register branch 5 times, most recently from 4f19a1a to 25e6d6e Compare September 6, 2022 13:12
@kzar kzar force-pushed the mv3-script-injection-register branch 2 times, most recently from 50688a5 to 75c4286 Compare September 7, 2022 11:35
Chrome Manifest V3 introduces the new scripting API[1] that can inject
scripts directly into the "main world" of a website. Along with that,
Manifest V3 prevents the old pattern of injecting a script element
into the DOM. Adjust to those changes here, to get our injected
protections working again.

Note: about:blank frame script injection is not yet working[2].

1 - https://developer.chrome.com/docs/extensions/reference/scripting
2 - https://crbug.com/1360392
@kzar kzar force-pushed the mv3-script-injection-register branch from 75c4286 to 5f573fa Compare September 7, 2022 11:50
@jonathanKingston jonathanKingston merged commit e921e6a into duckduckgo:develop Sep 7, 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