fix: set window origin default to null (#9899)

This commit is contained in:
Jason Tsai 2024-05-28 22:34:36 +08:00 committed by GitHub
parent 3f1c59d684
commit aa55e03354
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'tauri': 'patch:bug'
---
Set default window origin to `null`. Prevent window crash when loading `about:blank`.

View File

@ -253,16 +253,18 @@ impl<R: Runtime> WebviewManager<R> {
&& window_url.scheme() != "https"
{
format!("http://{}.localhost", window_url.scheme())
} else {
} else if let Some(host) = window_url.host() {
format!(
"{}://{}{}",
window_url.scheme(),
window_url.host().unwrap(),
host,
window_url
.port()
.map(|p| format!(":{p}"))
.unwrap_or_default()
)
} else {
"null".into()
};
if !registered_scheme_protocols.contains(&"tauri".into()) {