chore: update tao, wry, windows, webview2-com (#13163)

* chore: update tao, wry, windows, webview2-com

* update docs

* Use `impl Into<String>`

* More docs

---------

Co-authored-by: Tony <legendmastertony@gmail.com>
This commit is contained in:
Lucas Fernandes Nogueira
2025-04-09 08:15:31 -03:00
committed by GitHub
parent b32153b437
commit bb5faa21f4
13 changed files with 167 additions and 88 deletions

5
.changes/update-tao.md Normal file
View File

@@ -0,0 +1,5 @@
---
"tauri-runtime-wry": minor:deps
---
Update tao to 0.33.

View File

@@ -0,0 +1,6 @@
---
"tauri": minor:deps
"tauri-runtime-wry": minor:deps
---
Update webview2-com to 0.37.

View File

@@ -0,0 +1,7 @@
---
"tauri": minor:deps
"tauri-runtime": minor:deps
"tauri-runtime-wry": minor:deps
---
Update windows to 0.61.

5
.changes/update-wry.md Normal file
View File

@@ -0,0 +1,5 @@
---
"tauri-runtime-wry": minor:deps
---
Update wry to 0.51.

114
Cargo.lock generated
View File

@@ -8310,9 +8310,9 @@ dependencies = [
[[package]]
name = "tao"
version = "0.32.8"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63c8b1020610b9138dd7b1e06cf259ae91aa05c30f3bd0d6b42a03997b92dec1"
checksum = "1e59c1f38e657351a2e822eadf40d6a2ad4627b9c25557bc1180ec1b3295ef82"
dependencies = [
"bitflags 2.7.0",
"core-foundation 0.10.0",
@@ -8341,8 +8341,8 @@ dependencies = [
"tao-macros",
"unicode-segmentation",
"url",
"windows 0.60.0",
"windows-core 0.60.1",
"windows 0.61.1",
"windows-core 0.61.0",
"windows-version",
"x11-dl",
]
@@ -8438,7 +8438,7 @@ dependencies = [
"webkit2gtk",
"webview2-com",
"window-vibrancy",
"windows 0.60.0",
"windows 0.61.1",
]
[[package]]
@@ -8759,7 +8759,7 @@ dependencies = [
"tauri-utils 2.3.1",
"thiserror 2.0.10",
"url",
"windows 0.60.0",
"windows 0.61.1",
]
[[package]]
@@ -8784,7 +8784,7 @@ dependencies = [
"url",
"webkit2gtk",
"webview2-com",
"windows 0.60.0",
"windows 0.61.1",
"wry",
]
@@ -10098,15 +10098,15 @@ dependencies = [
[[package]]
name = "webview2-com"
version = "0.36.0"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0d606f600e5272b514dbb66539dd068211cc20155be8d3958201b4b5bd79ed3"
checksum = "b542b5cfbd9618c46c2784e4d41ba218c336ac70d44c55e47b251033e7d85601"
dependencies = [
"webview2-com-macros",
"webview2-com-sys",
"windows 0.60.0",
"windows-core 0.60.1",
"windows-implement",
"windows 0.61.1",
"windows-core 0.61.0",
"windows-implement 0.60.0",
"windows-interface",
]
@@ -10123,13 +10123,13 @@ dependencies = [
[[package]]
name = "webview2-com-sys"
version = "0.36.0"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfb27fccd3c27f68e9a6af1bcf48c2d82534b8675b83608a4d81446d095a17ac"
checksum = "8ae2d11c4a686e4409659d7891791254cf9286d3cfe0eef54df1523533d22295"
dependencies = [
"thiserror 2.0.10",
"windows 0.60.0",
"windows-core 0.60.1",
"windows 0.61.1",
"windows-core 0.61.0",
]
[[package]]
@@ -10214,12 +10214,12 @@ dependencies = [
[[package]]
name = "windows"
version = "0.60.0"
version = "0.61.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddf874e74c7a99773e62b1c671427abf01a425e77c3d3fb9fb1e4883ea934529"
checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419"
dependencies = [
"windows-collections",
"windows-core 0.60.1",
"windows-core 0.61.0",
"windows-future",
"windows-link",
"windows-numerics",
@@ -10227,11 +10227,11 @@ dependencies = [
[[package]]
name = "windows-collections"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5467f79cc1ba3f52ebb2ed41dbb459b8e7db636cc3429458d9a852e15bc24dec"
checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
dependencies = [
"windows-core 0.60.1",
"windows-core 0.61.0",
]
[[package]]
@@ -10249,33 +10249,33 @@ version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce"
dependencies = [
"windows-implement",
"windows-implement 0.59.0",
"windows-interface",
"windows-result 0.3.1",
"windows-result 0.3.2",
"windows-strings 0.3.1",
"windows-targets 0.53.0",
]
[[package]]
name = "windows-core"
version = "0.60.1"
version = "0.61.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca21a92a9cae9bf4ccae5cf8368dce0837100ddf6e6d57936749e85f152f6247"
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
dependencies = [
"windows-implement",
"windows-implement 0.60.0",
"windows-interface",
"windows-link",
"windows-result 0.3.1",
"windows-strings 0.3.1",
"windows-result 0.3.2",
"windows-strings 0.4.0",
]
[[package]]
name = "windows-future"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a787db4595e7eb80239b74ce8babfb1363d8e343ab072f2ffe901400c03349f0"
checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32"
dependencies = [
"windows-core 0.60.1",
"windows-core 0.61.0",
"windows-link",
]
@@ -10291,10 +10291,21 @@ dependencies = [
]
[[package]]
name = "windows-interface"
version = "0.59.0"
name = "windows-implement"
version = "0.60.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb26fd936d991781ea39e87c3a27285081e3c0da5ca0fcbc02d368cc6f52ff01"
checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.95",
]
[[package]]
name = "windows-interface"
version = "0.59.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
dependencies = [
"proc-macro2",
"quote",
@@ -10303,17 +10314,17 @@ dependencies = [
[[package]]
name = "windows-link"
version = "0.1.0"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3"
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
[[package]]
name = "windows-numerics"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "005dea54e2f6499f2cee279b8f703b3cf3b5734a2d8d21867c8f44003182eeed"
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
dependencies = [
"windows-core 0.60.1",
"windows-core 0.61.0",
"windows-link",
]
@@ -10335,7 +10346,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c44a98275e31bfd112bb06ba96c8ab13c03383a3753fdddd715406a1824c7e0"
dependencies = [
"windows-link",
"windows-result 0.3.1",
"windows-result 0.3.2",
"windows-strings 0.3.1",
]
@@ -10350,9 +10361,9 @@ dependencies = [
[[package]]
name = "windows-result"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06374efe858fab7e4f881500e6e86ec8bc28f9462c47e5a9941a0142ad86b189"
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
dependencies = [
"windows-link",
]
@@ -10376,6 +10387,15 @@ dependencies = [
"windows-link",
]
[[package]]
name = "windows-strings"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
dependencies = [
"windows-link",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
@@ -10796,9 +10816,9 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
[[package]]
name = "wry"
version = "0.50.5"
version = "0.51.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b19b78efae8b853c6c817e8752fc1dbf9cab8a8ffe9c30f399bd750ccf0f0730"
checksum = "7c6bf9f41e2585a730fa981b40592ac22d5ca4c3fea549a21f2f97a648ad34f4"
dependencies = [
"base64 0.22.1",
"block2 0.6.0",
@@ -10833,8 +10853,8 @@ dependencies = [
"webkit2gtk",
"webkit2gtk-sys",
"webview2-com",
"windows 0.60.0",
"windows-core 0.60.1",
"windows 0.61.1",
"windows-core 0.61.0",
"windows-version",
"x11-dl",
]

View File

@@ -17,13 +17,13 @@ rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
wry = { version = "0.50.5", default-features = false, features = [
wry = { version = "0.51", default-features = false, features = [
"drag-drop",
"protocol",
"os-webview",
"linux-body",
] }
tao = { version = "0.32.8", default-features = false, features = ["rwh_06"] }
tao = { version = "0.33", default-features = false, features = ["rwh_06"] }
tauri-runtime = { version = "2.5.1", path = "../tauri-runtime" }
tauri-utils = { version = "2.3.1", path = "../tauri-utils" }
raw-window-handle = "0.6"
@@ -33,12 +33,12 @@ tracing = { version = "0.1", optional = true }
log = "0.4.21"
[target."cfg(windows)".dependencies]
webview2-com = "0.36"
webview2-com = "0.37"
softbuffer = { version = "0.4", default-features = false }
once_cell = "1.20"
[target."cfg(windows)".dependencies.windows]
version = "0.60"
version = "0.61"
features = ["Win32_Foundation", "Win32_Graphics_Dwm"]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]

View File

@@ -4557,7 +4557,7 @@ fn create_webview<T: UserEvent>(
for script in webview_attributes.initialization_scripts {
webview_builder = webview_builder
.with_initialization_script_for_main_only(&script.script, script.for_main_frame_only);
.with_initialization_script_for_main_only(script.script, script.for_main_frame_only);
}
for (scheme, protocol) in uri_scheme_protocols {

View File

@@ -38,7 +38,7 @@ dpi = { version = "0.1", features = ["serde"] }
cookie = "0.18"
[target."cfg(windows)".dependencies.windows]
version = "0.60"
version = "0.61"
features = ["Win32_Foundation", "Win32_System_WinRT"]
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]

View File

@@ -203,8 +203,13 @@ pub struct WebviewAttributes {
///
/// ## Platform-specific
///
/// - **Android on Wry:** The Android WebView does not provide an API for initialization scripts,
/// so we prepend them to each HTML head. They are only implemented on custom protocol URLs.
/// - **Windows:** scripts are always added to subframes.
/// - **Android:** When [addDocumentStartJavaScript] is not supported,
/// we prepend initialization scripts to each HTML head (implementation only supported on custom protocol URLs).
/// For remote URLs, we use [onPageStarted] which is not guaranteed to run before other scripts.
///
/// [addDocumentStartJavaScript]: https://developer.android.com/reference/androidx/webkit/WebViewCompat#addDocumentStartJavaScript(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E)
/// [onPageStarted]: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
pub initialization_scripts: Vec<InitializationScript>,
pub data_directory: Option<PathBuf>,
pub drag_drop_handler_enabled: bool,
@@ -323,15 +328,18 @@ impl WebviewAttributes {
/// This is executed only on the main frame.
/// If you only want to run it in all frames, use [Self::initialization_script_on_all_frames] instead.
///
///
/// ## Platform-specific
///
/// - **Android on Wry:** The Android WebView does not provide an API for initialization scripts,
/// so we prepend them to each HTML head. They are only implemented on custom protocol URLs.
/// - **Android on Wry:** When [addDocumentStartJavaScript] is not supported,
/// we prepend initialization scripts to each HTML head (implementation only supported on custom protocol URLs).
/// For remote URLs, we use [onPageStarted] which is not guaranteed to run before other scripts.
///
/// [addDocumentStartJavaScript]: https://developer.android.com/reference/androidx/webkit/WebViewCompat#addDocumentStartJavaScript(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E)
/// [onPageStarted]: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
#[must_use]
pub fn initialization_script(mut self, script: &str) -> Self {
pub fn initialization_script(mut self, script: impl Into<String>) -> Self {
self.initialization_scripts.push(InitializationScript {
script: script.to_string(),
script: script.into(),
for_main_frame_only: true,
});
self
@@ -347,12 +355,16 @@ impl WebviewAttributes {
///
/// ## Platform-specific
///
/// - **Android on Wry:** The Android WebView does not provide an API for initialization scripts,
/// so we prepend them to each HTML head. They are only implemented on custom protocol URLs.
/// - **Android on Wry:** When [addDocumentStartJavaScript] is not supported,
/// we prepend initialization scripts to each HTML head (implementation only supported on custom protocol URLs).
/// For remote URLs, we use [onPageStarted] which is not guaranteed to run before other scripts.
///
/// [addDocumentStartJavaScript]: https://developer.android.com/reference/androidx/webkit/WebViewCompat#addDocumentStartJavaScript(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E)
/// [onPageStarted]: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
#[must_use]
pub fn initialization_script_on_all_frames(mut self, script: &str) -> Self {
pub fn initialization_script_on_all_frames(mut self, script: impl Into<String>) -> Self {
self.initialization_scripts.push(InitializationScript {
script: script.to_string(),
script: script.into(),
for_main_frame_only: false,
});
self
@@ -552,12 +564,3 @@ pub struct InitializationScript {
/// Whether the script should be injected to main frame only
pub for_main_frame_only: bool,
}
impl InitializationScript {
pub fn new(script: &str, for_main_frame_only: bool) -> Self {
Self {
script: script.to_owned(),
for_main_frame_only,
}
}
}

View File

@@ -120,9 +120,9 @@ window-vibrancy = "0.6"
# windows
[target."cfg(windows)".dependencies]
webview2-com = { version = "0.36", optional = true }
webview2-com = { version = "0.37", optional = true }
window-vibrancy = "0.6"
windows = { version = "0.60", features = [
windows = { version = "0.61", features = [
"Win32_Foundation",
"Win32_UI",
"Win32_UI_WindowsAndMessaging",

View File

@@ -640,6 +640,13 @@ impl<R: Runtime> WebviewBuilder<R> {
/// This is executed only on the main frame.
/// If you only want to run it in all frames, use [Self::initialization_script_for_all_frames] instead.
///
/// ## Platform-specific
///
/// - **Windows:** scripts are always added to subframes.
/// - **Android:** When [addDocumentStartJavaScript] is not supported,
/// we prepend initialization scripts to each HTML head (implementation only supported on custom protocol URLs).
/// For remote URLs, we use [onPageStarted] which is not guaranteed to run before other scripts.
///
/// # Examples
///
#[cfg_attr(
@@ -669,13 +676,16 @@ fn main() {
```
"####
)]
///
/// [addDocumentStartJavaScript]: https://developer.android.com/reference/androidx/webkit/WebViewCompat#addDocumentStartJavaScript(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E)
/// [onPageStarted]: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
#[must_use]
pub fn initialization_script(mut self, script: &str) -> Self {
pub fn initialization_script(mut self, script: impl Into<String>) -> Self {
self
.webview_attributes
.initialization_scripts
.push(InitializationScript {
script: script.to_string(),
script: script.into(),
for_main_frame_only: true,
});
self
@@ -687,8 +697,14 @@ fn main() {
/// Since it runs on all top-level document navigations and also child frame page navigations,
/// it's recommended to check the `window.location` to guard your script from running on unexpected origins.
///
/// This is executed on all frames, main frame and also sub frames.
/// If you only want to run it in the main frame, use [Self::initialization_script] instead.
/// This is executed on all frames (main frame and also sub frames).
/// If you only want to run the script in the main frame, use [Self::initialization_script] instead.
///
/// ## Platform-specific
///
/// - **Android:** When [addDocumentStartJavaScript] is not supported,
/// we prepend initialization scripts to each HTML head (implementation only supported on custom protocol URLs).
/// For remote URLs, we use [onPageStarted] which is not guaranteed to run before other scripts.
///
/// # Examples
///
@@ -719,13 +735,16 @@ fn main() {
```
"####
)]
///
/// [addDocumentStartJavaScript]: https://developer.android.com/reference/androidx/webkit/WebViewCompat#addDocumentStartJavaScript(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E)
/// [onPageStarted]: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
#[must_use]
pub fn initialization_script_for_all_frames(mut self, script: &str) -> Self {
pub fn initialization_script_for_all_frames(mut self, script: impl Into<String>) -> Self {
self
.webview_attributes
.initialization_scripts
.push(InitializationScript {
script: script.to_string(),
script: script.into(),
for_main_frame_only: false,
});
self

View File

@@ -765,12 +765,19 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> {
/// Adds the provided JavaScript to a list of scripts that should be run after the global object has been created,
/// but before the HTML document has been parsed and before any other script included by the HTML document is run.
///
/// Since it runs on all top-level document navigations (and also child frame page navigations, if you set `run_only_on_main_frame` to false),
/// Since it runs on all top-level document navigations,
/// it's recommended to check the `window.location` to guard your script from running on unexpected origins.
///
/// This is executed only on the main frame.
/// If you only want to run it in all frames, use [Self::initialization_script_for_all_frames] instead.
///
/// ## Platform-specific
///
/// - **Windows:** scripts are always added to subframes.
/// - **Android:** When [addDocumentStartJavaScript] is not supported,
/// we prepend initialization scripts to each HTML head (implementation only supported on custom protocol URLs).
/// For remote URLs, we use [onPageStarted] which is not guaranteed to run before other scripts.
///
/// # Examples
///
/// ```rust
@@ -795,7 +802,7 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> {
/// }
/// ```
#[must_use]
pub fn initialization_script(mut self, script: &str) -> Self {
pub fn initialization_script(mut self, script: impl Into<String>) -> Self {
self.webview_builder = self.webview_builder.initialization_script(script);
self
}
@@ -803,11 +810,18 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> {
/// Adds the provided JavaScript to a list of scripts that should be run after the global object has been created,
/// but before the HTML document has been parsed and before any other script included by the HTML document is run.
///
/// Since it runs on all top-level document navigastions (and also child frame page navigations, if you set `run_only_on_main_frame` to false),
/// Since it runs on all top-level document navigations and also child frame page navigations,
/// it's recommended to check the `window.location` to guard your script from running on unexpected origins.
///
/// This is executed on all frames, main frame and also sub frames.
/// If you only want to run it in the main frame, use [Self::initialization_script] instead.
/// This is executed on all frames (main frame and also sub frames).
/// If you only want to run the script in the main frame, use [Self::initialization_script] instead.
///
/// ## Platform-specific
///
/// - **Android:** When [addDocumentStartJavaScript] is not supported,
/// we prepend initialization scripts to each HTML head (implementation only supported on custom protocol URLs).
/// For remote URLs, we use [onPageStarted] which is not guaranteed to run before other scripts.
///
/// # Examples
///
/// ```rust
@@ -832,7 +846,7 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> {
/// }
/// ```
#[must_use]
pub fn initialization_script_for_all_frames(mut self, script: &str) -> Self {
pub fn initialization_script_for_all_frames(mut self, script: impl Into<String>) -> Self {
self.webview_builder = self
.webview_builder
.initialization_script_for_all_frames(script);

View File

@@ -42,7 +42,7 @@ fn handle_file_associations(app: AppHandle, files: Vec<PathBuf>) {
.join(",");
tauri::WebviewWindowBuilder::new(&app, "main", Default::default())
.initialization_script(&format!("window.openedFiles = [{files}]"))
.initialization_script(format!("window.openedFiles = [{files}]"))
.build()
.unwrap();
}