Skip to content

Commit 3afe828

Browse files
authored
refactor!: change Webview::navigate to return result (#10134)
closes #9935
1 parent 77d4421 commit 3afe828

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.changes/webview-navigate-result.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": "patch:breaking"
3+
---
4+
5+
Changed `WebviewWindow::navigate` and `Webview::navigate` method signature to return a `Result`

core/tauri/src/webview/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,8 @@ fn main() {
10841084
}
10851085

10861086
/// Navigates the webview to the defined url.
1087-
pub fn navigate(&mut self, url: Url) {
1088-
self.webview.dispatcher.navigate(url).unwrap();
1087+
pub fn navigate(&mut self, url: Url) -> crate::Result<()> {
1088+
self.webview.dispatcher.navigate(url).map_err(Into::into)
10891089
}
10901090

10911091
fn is_local_url(&self, current_url: &Url) -> bool {

core/tauri/src/webview/webview_window.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1665,8 +1665,8 @@ impl<R: Runtime> WebviewWindow<R> {
16651665
}
16661666

16671667
/// Navigates the webview to the defined url.
1668-
pub fn navigate(&mut self, url: Url) {
1669-
self.webview.navigate(url);
1668+
pub fn navigate(&mut self, url: Url) -> crate::Result<()> {
1669+
self.webview.navigate(url)
16701670
}
16711671

16721672
/// Handles this window receiving an [`crate::webview::InvokeRequest`].

0 commit comments

Comments
 (0)