Skip to content

Commit aa55e03

Browse files
authored
fix: set window origin default to null (#9899)
1 parent 3f1c59d commit aa55e03

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'tauri': 'patch:bug'
3+
---
4+
5+
Set default window origin to `null`. Prevent window crash when loading `about:blank`.

core/tauri/src/manager/webview.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,18 @@ impl<R: Runtime> WebviewManager<R> {
253253
&& window_url.scheme() != "https"
254254
{
255255
format!("http://{}.localhost", window_url.scheme())
256-
} else {
256+
} else if let Some(host) = window_url.host() {
257257
format!(
258258
"{}://{}{}",
259259
window_url.scheme(),
260-
window_url.host().unwrap(),
260+
host,
261261
window_url
262262
.port()
263263
.map(|p| format!(":{p}"))
264264
.unwrap_or_default()
265265
)
266+
} else {
267+
"null".into()
266268
};
267269

268270
if !registered_scheme_protocols.contains(&"tauri".into()) {

0 commit comments

Comments
 (0)