@@ -24,6 +24,7 @@ use tauri_runtime::{
2424#[ cfg( target_os = "macos" ) ]
2525use tauri_utils:: TitleBarStyle ;
2626use tauri_utils:: { config:: WindowConfig , Theme } ;
27+ use url:: Url ;
2728use uuid:: Uuid ;
2829
2930#[ cfg( windows) ]
@@ -116,7 +117,7 @@ impl<T: UserEvent> RuntimeHandle<T> for MockRuntimeHandle {
116117 id,
117118 context : self . context . clone ( ) ,
118119 last_evaluated_script : Default :: default ( ) ,
119- url : pending. url ,
120+ url : Arc :: new ( Mutex :: new ( pending. url ) ) ,
120121 } ,
121122 menu_ids : Default :: default ( ) ,
122123 } )
@@ -190,7 +191,7 @@ impl<T: UserEvent> RuntimeHandle<T> for MockRuntimeHandle {
190191pub struct MockDispatcher {
191192 id : WindowId ,
192193 context : RuntimeContext ,
193- url : String ,
194+ url : Arc < Mutex < String > > ,
194195 last_evaluated_script : Arc < Mutex < Option < String > > > ,
195196}
196197
@@ -383,7 +384,12 @@ impl<T: UserEvent> Dispatch<T> for MockDispatcher {
383384 }
384385
385386 fn url ( & self ) -> Result < url:: Url > {
386- self . url . parse ( ) . map_err ( |_| Error :: FailedToReceiveMessage )
387+ self
388+ . url
389+ . lock ( )
390+ . unwrap ( )
391+ . parse ( )
392+ . map_err ( |_| Error :: FailedToReceiveMessage )
387393 }
388394
389395 fn scale_factor ( & self ) -> Result < f64 > {
@@ -528,7 +534,7 @@ impl<T: UserEvent> Dispatch<T> for MockDispatcher {
528534 id,
529535 context : self . context . clone ( ) ,
530536 last_evaluated_script : Default :: default ( ) ,
531- url : pending. url ,
537+ url : Arc :: new ( Mutex :: new ( pending. url ) ) ,
532538 } ,
533539 menu_ids : Default :: default ( ) ,
534540 } )
@@ -554,6 +560,11 @@ impl<T: UserEvent> Dispatch<T> for MockDispatcher {
554560 Ok ( ( ) )
555561 }
556562
563+ fn navigate ( & self , url : Url ) -> Result < ( ) > {
564+ * self . url . lock ( ) . unwrap ( ) = url. to_string ( ) ;
565+ Ok ( ( ) )
566+ }
567+
557568 fn maximize ( & self ) -> Result < ( ) > {
558569 Ok ( ( ) )
559570 }
@@ -788,7 +799,7 @@ impl<T: UserEvent> Runtime<T> for MockRuntime {
788799 id,
789800 context : self . context . clone ( ) ,
790801 last_evaluated_script : Default :: default ( ) ,
791- url : pending. url ,
802+ url : Arc :: new ( Mutex :: new ( pending. url ) ) ,
792803 } ,
793804 menu_ids : Default :: default ( ) ,
794805 } )
0 commit comments