diff --git a/Sources/BrowserServicesKit/SecureVault/PartialFormSaveManager.swift b/Sources/BrowserServicesKit/SecureVault/PartialFormSaveManager.swift index 41e94ab8d..c497bf86d 100644 --- a/Sources/BrowserServicesKit/SecureVault/PartialFormSaveManager.swift +++ b/Sources/BrowserServicesKit/SecureVault/PartialFormSaveManager.swift @@ -24,6 +24,12 @@ final class PartialFormSaveManager { private static var accounts: [String: WebsiteAccount] = .init() + private let tld: TLD + + init(tld: TLD) { + self.tld = tld + } + func partialAccount(forDomain domain: String) -> WebsiteAccount? { guard let tldPlus1 = TLD().eTLDplus1(domain) else { return nil diff --git a/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift b/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift index 303272961..ed9c69168 100644 --- a/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift +++ b/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift @@ -123,7 +123,7 @@ public class SecureVaultManager { private var autogeneratedCredentials: Bool { return autogeneratedUserName || autogeneratedPassword } - private let partialFormSaveManager = PartialFormSaveManager() + private let partialFormSaveManager: PartialFormSaveManager public lazy var autofillWebsiteAccountMatcher: AutofillWebsiteAccountMatcher? = { guard let tld = tld else { return nil } @@ -141,6 +141,11 @@ public class SecureVaultManager { self.includePartialAccountMatches = includePartialAccountMatches self.shouldAllowPartialFormSaves = shouldAllowPartialFormSaves self.tld = tld + if let tld { + partialFormSaveManager = PartialFormSaveManager(tld: tld) + } else { + partialFormSaveManager = PartialFormSaveManager(tld: TLD()) + } } }