Skip to content

Commit 03e7c11

Browse files
authored
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
1 parent e81635a commit 03e7c11

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

.changes/about-blank-ignore.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-runtime-wry": patch:bug
3+
"tauri": patch:bug
4+
---
5+
6+
Ignore initial navigation to `about:blank` so `on_new_window` does not give a warning on first navigation on macOS.

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tauri-runtime-wry/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rustc-args = ["--cfg", "docsrs"]
1717
rustdoc-args = ["--cfg", "docsrs"]
1818

1919
[dependencies]
20-
wry = { version = "0.53.1", default-features = false, features = [
20+
wry = { version = "0.53.2", default-features = false, features = [
2121
"drag-drop",
2222
"protocol",
2323
"os-webview",

crates/tauri-runtime-wry/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4578,13 +4578,16 @@ You may have it installed on another user account, but it is not available for t
45784578
let mut webview_builder = WebViewBuilder::new_with_web_context(&mut web_context.inner)
45794579
.with_id(&label)
45804580
.with_focused(webview_attributes.focus)
4581-
.with_url(&url)
45824581
.with_transparent(webview_attributes.transparent)
45834582
.with_accept_first_mouse(webview_attributes.accept_first_mouse)
45844583
.with_incognito(webview_attributes.incognito)
45854584
.with_clipboard(webview_attributes.clipboard)
45864585
.with_hotkeys_zoom(webview_attributes.zoom_hotkeys_enabled);
45874586

4587+
if url != "about:blank" {
4588+
webview_builder = webview_builder.with_url(&url);
4589+
}
4590+
45884591
#[cfg(target_os = "macos")]
45894592
if let Some(webview_configuration) = webview_attributes.webview_configuration {
45904593
webview_builder = webview_builder.with_webview_configuration(webview_configuration);

0 commit comments

Comments
 (0)