android: Use location_bar_input_to_url instead of re-implementing (#32586)

We can use the same function as the desktop version

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
This commit is contained in:
Jonathan Schwender 2024-06-24 17:25:07 +02:00 committed by GitHub
parent 26bbfe9b55
commit 7d7574373b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 14 deletions

View file

@ -60,6 +60,10 @@ pub fn get_default_url(
new_url.or(pref_url).or(blank_url).unwrap()
}
/// Interpret an input URL.
///
/// If this is not a valid URL, try to "fix" it by adding a scheme or if all else fails,
/// interpret the string as a search term.
pub fn location_bar_input_to_url(request: &str) -> Option<ServoUrl> {
let request = request.trim();
ServoUrl::parse(request)