improvement(Autofill): Skip localhost-ed web page hint if it is not a browser

This commit is contained in:
Artem Chepurnoy 2024-05-07 23:38:05 +03:00
parent bb028c666e
commit 70a69d0ce9
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 14 additions and 3 deletions

View File

@ -523,11 +523,22 @@ class AutofillStructureParser {
) )
items += item items += item
} }
// It it is a web view that renders localhost,
// then ignore the webview hint -- a user is probably
// not supposed to know that anyway.
val isInSelfHostedServer = kotlin.run {
val webDomain = autofillStructure?.webDomain
val webView = autofillStructure?.webView == true
webView &&
(webDomain == "127.0.0.1" ||
webDomain == "localhost")
}
return AutofillStructure2( return AutofillStructure2(
applicationId = applicationId, applicationId = applicationId,
webDomain = autofillStructure?.webDomain, webDomain = autofillStructure?.webDomain.takeUnless { isInSelfHostedServer },
webScheme = autofillStructure?.webScheme, webScheme = autofillStructure?.webScheme.takeUnless { isInSelfHostedServer },
webView = autofillStructure?.webView, webView = autofillStructure?.webView.takeUnless { isInSelfHostedServer },
items = items, items = items,
) )
} }