Skip to content

Commit

Permalink
fix: set window origin default to null (#9899)
Browse files Browse the repository at this point in the history
  • Loading branch information
pewsheen committed May 28, 2024
1 parent 3f1c59d commit aa55e03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/tauri-window-origin-default-to-null.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'patch:bug'
---

Set default window origin to `null`. Prevent window crash when loading `about:blank`.
6 changes: 4 additions & 2 deletions core/tauri/src/manager/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit aa55e03

Please sign in to comment.