fix(tauri-runtime-wry): ignore about:blank initial URL (#14080)

* fix(tauri-runtime-wry): ignore about:blank initial URL

fixes a macOS warning when a navigation handler is registered and you choose to create a new window on the on_new_window hook - in this case we shouldn't perform the initial navigation since the URL is provided by the webview configuration from the hook

* change tag

* bump min wry
This commit is contained in:
Lucas Fernandes Nogueira
2025-08-25 10:03:35 -03:00
committed by GitHub
parent e81635aa3d
commit 03e7c11932
4 changed files with 14 additions and 5 deletions

View File

@@ -0,0 +1,6 @@
---
"tauri-runtime-wry": patch:bug
"tauri": patch:bug
---
Ignore initial navigation to `about:blank` so `on_new_window` does not give a warning on first navigation on macOS.

6
Cargo.lock generated
View File

@@ -5816,7 +5816,7 @@ dependencies = [
"aes-gcm",
"aes-kw",
"argon2",
"base64 0.21.7",
"base64 0.22.1",
"bitfield",
"block-padding",
"blowfish",
@@ -10943,9 +10943,9 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "wry"
version = "0.53.1"
version = "0.53.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5698e50a589268aec06d2219f48b143222f7b5ad9aa690118b8dce0a8dcac574"
checksum = "e3b6763512fe4b51c80b3ce9b50939d682acb4de335dfabbdb20d7a2642199b7"
dependencies = [
"base64 0.22.1",
"block2 0.6.0",

View File

@@ -17,7 +17,7 @@ rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
wry = { version = "0.53.1", default-features = false, features = [
wry = { version = "0.53.2", default-features = false, features = [
"drag-drop",
"protocol",
"os-webview",

View File

@@ -4578,13 +4578,16 @@ You may have it installed on another user account, but it is not available for t
let mut webview_builder = WebViewBuilder::new_with_web_context(&mut web_context.inner)
.with_id(&label)
.with_focused(webview_attributes.focus)
.with_url(&url)
.with_transparent(webview_attributes.transparent)
.with_accept_first_mouse(webview_attributes.accept_first_mouse)
.with_incognito(webview_attributes.incognito)
.with_clipboard(webview_attributes.clipboard)
.with_hotkeys_zoom(webview_attributes.zoom_hotkeys_enabled);
if url != "about:blank" {
webview_builder = webview_builder.with_url(&url);
}
#[cfg(target_os = "macos")]
if let Some(webview_configuration) = webview_attributes.webview_configuration {
webview_builder = webview_builder.with_webview_configuration(webview_configuration);