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 error handling to contrainer removal #3424

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

bwaresiak
Copy link
Collaborator

Task/Issue URL: https://app.asana.com/0/856498667320406/1207976962313181/f

Description:

Make sure the containers created recently or the ones that fail to be removed are given another chance to be cleaned.

Steps to test this PR:

Open the app, navigate to site that sets cookies, refresh, press fire button.

Smoke test data clearing, auto clear - both on app restart and time based one.
Test fireproofing on usage and after restart.

Definition of Done (Internal Only):

OS Testing:

  • iOS 15
  • iOS 16
  • iOS 17

Theme Testing:

  • Light theme
  • Dark theme

Internal references:

Software Engineering Expectations
Technical Design Template

@bwaresiak bwaresiak requested a review from brindy October 10, 2024 13:13
// This should not be a problem as these containers are not supposed to be used anymore.
// If this fails, we are going to still clean them next time as WebKit keeps track of all stores for us.
if #available(iOS 17, *), !leftoverContainerIDs.isEmpty {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little worried about calling this on the main thread. This function doesn't need to. It will call back to the main thread, but the API suggests it can be called from any thread. Also, I think it'd be better if this was doing as a task rather than DispatchQueue, e.g.

        Task {
            try? await Task.sleep(interval: 3.0)
            for uuid in leftoverContainerIDs {
                try? await WKWebsiteDataStore.remove(forIdentifier: uuid)
            }
        }

That said, I'm going to approve because it does work so up to you if you want to tweak it.

Copy link
Contributor

@brindy brindy left a comment

Choose a reason for hiding this comment

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

One comment with alternative Task based implementation suggestion.

Copy link
Contributor

@brindy brindy left a comment

Choose a reason for hiding this comment

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

LGTM, thanks. Will merge.

@brindy brindy merged commit c9a486b into main Oct 14, 2024
13 checks passed
@brindy brindy deleted the bartek/improve-container-cleaning branch October 14, 2024 14:00
samsymons added a commit that referenced this pull request Oct 14, 2024
* main:
  Release 7.141.0-0 (#3435)
  Add error handling to contrainer removal (#3424)
  Prevent autofill prompt crash for edge case where a context menu is also visible on screen (#3417)
samsymons added a commit that referenced this pull request Oct 21, 2024
# By Daniel Bernal (4) and others
# Via Daniel Bernal (1) and others
* main:
  Pixel retrying (#3358)
  Remove `voiceSearchHelper` from `AppDependencyProvider` (#3452)
  Update AutoClearSettingsViewController to use DI for app settings (#3448)
  Bump BSK (#3441)
  Remove `SubscriptionFeatureAvailability` from `AppDependencyProvider` (#3447)
  Release 7.141.0-2 (#3451)
  Do not notify the FE on experiment activation (#3450)
  point to bsk branch (#3444)
  bump bsk for content blocker rules fix (#3445)
  speculative fix for set bars visibility crashes (#3442)
  Release 7.141.0-1 (#3443)
  Fix browsing menu bottom offset when bar location set to bottom (#3440)
  Properly handle responses that should trigger download action (#3407)
  Add Events Firing for Phishing Detection Settings: Point to BSK (#3423)
  DuckPlayer: Temporary Fix for Watch In Youtube (#3437)
  Add 'Open in New Tab' support for DuckPlayer (#3431)
  update BSK dependency (#3434)
  Release 7.141.0-0 (#3435)
  Add error handling to contrainer removal (#3424)
  Prevent autofill prompt crash for edge case where a context menu is also visible on screen (#3417)

# 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.

2 participants