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 AMP links protection #488

Merged
merged 8 commits into from
Apr 1, 2022
Merged

Add AMP links protection #488

merged 8 commits into from
Apr 1, 2022

Conversation

jaceklyp
Copy link
Contributor

Task/Issue URL: https://app.asana.com/0/72649045549333/1201716942816245/f
Tech Design URL: https://app.asana.com/0/481882893211075/1201948311080451/f
CC: @tomasstrba

Description:
AMP Protection introduced to macOS browser.

Steps to test this PR:

  1. Run tests.
  2. Go through https://privacy-test-pages.glitch.me/privacy-protections/amp/ test pages.

Testing checklist:

  • Test with Release configuration
  • Test proper deallocation of tabs
  • Make sure committed submodule changes are desired

@jaceklyp jaceklyp requested a review from SlayterDev March 29, 2022 13:57
@jaceklyp jaceklyp changed the title Add AMP links protection to Tab Add AMP links protection Mar 29, 2022
Copy link
Contributor

@SlayterDev SlayterDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the implementation guidelines for this feature. I do not see where we're attaching ampUrl to breakage reports. As well we need to attach urlParametersRemoved when this is set as well.

onLinkRewrite: { [weak self] url, navigationAction in
let navigationActionPolicy = await linkProtection.requestTrackingLinkRewrite(initiatingURL: webView.url,
navigationAction: navigationAction,
onExtracting: { isAMPProtectionExtracting = true },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great if isAMPProtectionExtracting is handled only in this callback. The reason is you are setting it to false every time webview finishes loading (often unnecessary). Then isAMPProtectionExtracting publishes unnecessary events and triggers unnecessary recompilations of properties in ViewModel than may trigger unnecessary redrawing of View

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ;)

Copy link
Contributor

@SlayterDev SlayterDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Please be sure to use the appropriate BSK version and check CI passes before merging.

@jaceklyp jaceklyp merged commit 3d7a808 into develop Apr 1, 2022
@jaceklyp jaceklyp deleted the jacek/amp-protection branch April 1, 2022 09:13
samsymons added a commit that referenced this pull request Apr 4, 2022
# By Tomas Strba (5) and others
# Via GitHub
* develop:
  Refresh the Autofill panel after importing (#496)
  Require authentication for login export (#494)
  Observations database clearing improvements (#495)
  Fix handling external schemes in address bar (#493)
  New autoconsent rules and move tab cleanup out of onCommitted (#489)
  Safari CSV Passwords import +LastPass, 1Password (#483)
  Split preferences into multiple screens and add an option to show full URL (#487)
  Color of hover label fixed (#497)
  Add AMP links protection (#488)
  Enhancements of fire button options (#484)
  Rename Logins+ to Autofill (#492)
  new tab page low hanging fruit (#491)
  Fix threading issues in Autoconsent (#478)
  Navigation bar improvement: CMD + back or CMD + forward opens a new tab (#486)
  TextField refactored to TextView in order to make it scrollable (#481)
  More Xcode cleaning (#485)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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.

3 participants