-
Notifications
You must be signed in to change notification settings - Fork 423
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
support local storage fireproofing #3612
support local storage fireproofing #3612
Conversation
Core/WebCacheManager.swift
Outdated
/// | ||
/// The migration code removes the key that is used to check for the isConsumed flag so will only be | ||
/// true if the data needs to be migrated. | ||
public func consumeCookies(intoHTTPCookieStore httpCookieStore: WKHTTPCookieStore) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
httpCookieStore is strongly typed, so I believe it should be consumeCookies(into httpCookieStore: WKHTTPCookieStore) async {
Core/DataStoreIdManager.swift
Outdated
|
||
/// Supports an existing ID set in previous versions of the app, but moving forward does not allocate an ID. We have gone back to using the default | ||
/// peristence for the webview storage so that we can fireproof types that don't have an API for accessing their data. (e.g. localStorage) | ||
public protocol DataStoreIdManaging { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick; I think we should be using ID (not Id) just like Apple uses it in their libs, e.g. UUID or https://developer.apple.com/documentation/swiftui/scrollposition/viewid(type:)
Core/Fireproofing.swift
Outdated
@@ -51,15 +54,19 @@ public class UserDefaultsFireproofing: Fireproofing { | |||
} | |||
} | |||
|
|||
var allowedDomainsIncludingDuckDuckGo: [String] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
static func cookieDomain(_ cookieDomain: String, matchesTestDomain testDomain: String) -> Bool { | ||
return testDomain == cookieDomain | ||
|| ".\(testDomain)" == cookieDomain | ||
|| (cookieDomain.hasPrefix(".") && testDomain.hasSuffix(cookieDomain)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you provide a piece of documentation what do we test here for and possible e.g of what matches means for us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comment and note to look at some unit tests
/// Called after consuming cookies but migration has not happened. | ||
/// This can happen in the following flow | ||
/// * User presses fire button on container based app and then backgrounds it/switches to another app | ||
/// * Installs update to this version of the app without using the browser | ||
/// * Starts browsing | ||
func setConsumed() { | ||
resetStore() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im a bit confused, should anything else happen here besides "resetStore"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just wanted an API that made sense from where it was used. This is "behinds the scenes" behaviour related to migration.
|
||
var uuids = await WKWebsiteDataStore.allDataStoreIdentifiers | ||
// Check version here rather than on function so that we don't need complicated logic related to verison in the calling function | ||
guard #available(iOS 17, *) else { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor optimisation - < iOS 17 no migration is needed. Will add comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
* main: Release 7.148.0-2 (#3676) Merge hotfix changes from 7.147.1 (#3674) Add `install` pixel (#3656) AI Chat browsing menu (#3635) Release 7.147.1-0 (#3672) Use actor isolation for `SubscriptionFeatureMappingCache` (#3670) cherry picked - already approved in #3666 fix suggestion scrolling (#3654) Update autoconsent to v12.1.0 (#3650) Malware protection: bump BSK (#3617) Release 7.148.0-1 (#3661) Make a simple state machine to identify incorrect transitions (#3660) support local storage fireproofing (#3612) Make NTP Grid layout adaptive for various screen sizes (#3657) Release 7.148.0-0 (#3659) Bump BSK, add Free Trials Feature Flag (#3655)
Task/Issue URL: https://app.asana.com/0/392891325557410/1204888209490842/f
Tech Design URL:
CC: @samsymons, @bwaresiak
Description:
Revert to using default persistence container for website data storage.
Also various refactoring to make future singleton slaying quests a bit easier.
Steps to test this PR:
release_tests/local-storage
UI test and validate it worksDefinition of Done (Internal Only):
Copy Testing:
’
rather than'
Device Testing:
OS Testing:
Internal references:
Software Engineering Expectations
Technical Design Template