@@ -44,7 +44,6 @@ use std::{
4444} ;
4545use tauri_macros:: default_runtime;
4646use url:: Url ;
47- use uuid:: Uuid ;
4847
4948const WINDOW_RESIZED_EVENT : & str = "tauri://resize" ;
5049const WINDOW_MOVED_EVENT : & str = "tauri://move" ;
@@ -72,8 +71,6 @@ pub struct InnerWindowManager<R: Runtime> {
7271 assets : Arc < dyn Assets > ,
7372 default_window_icon : Option < Vec < u8 > > ,
7473
75- /// A list of salts that are valid for the current application.
76- salts : Mutex < HashSet < Uuid > > ,
7774 package_info : PackageInfo ,
7875 /// The webview protocols protocols available to all windows.
7976 uri_scheme_protocols : HashMap < String , Arc < CustomProtocol > > ,
@@ -96,7 +93,6 @@ impl<R: Runtime> fmt::Debug for InnerWindowManager<R> {
9693 . field ( "state" , & self . state )
9794 . field ( "config" , & self . config )
9895 . field ( "default_window_icon" , & self . default_window_icon )
99- . field ( "salts" , & self . salts )
10096 . field ( "package_info" , & self . package_info ) ;
10197 {
10298 w = w
@@ -158,7 +154,6 @@ impl<R: Runtime> WindowManager<R> {
158154 config : Arc :: new ( context. config ) ,
159155 assets : context. assets ,
160156 default_window_icon : context. default_window_icon ,
161- salts : Mutex :: default ( ) ,
162157 package_info : context. package_info ,
163158 uri_scheme_protocols,
164159 menu_ids : {
@@ -444,37 +439,24 @@ impl<R: Runtime> WindowManager<R> {
444439 } else {
445440 ""
446441 } ,
447- event_initialization_script = self . event_initialization_script( key ) ,
442+ event_initialization_script = self . event_initialization_script( ) ,
448443 plugin_initialization_script = plugin_initialization_script
449444 )
450445 }
451446
452- fn event_initialization_script ( & self , key : u32 ) -> String {
447+ fn event_initialization_script ( & self ) -> String {
453448 return format ! (
454449 "
455- window['{function}'] = function (eventData, salt ) {{
450+ window['{function}'] = function (eventData) {{
456451 const listeners = (window['{listeners}'] && window['{listeners}'][eventData.event]) || []
457452
458- if (listeners.length > 0) {{
459- window.__TAURI_INVOKE__('tauri', {{
460- __tauriModule: 'Internal',
461- message: {{
462- cmd: 'validateSalt',
463- salt: salt
464- }}
465- }}, {key}).then(function (flag) {{
466- if (flag) {{
467- for (let i = listeners.length - 1; i >= 0; i--) {{
468- const listener = listeners[i]
469- eventData.id = listener.id
470- listener.handler(eventData)
471- }}
472- }}
473- }})
453+ for (let i = listeners.length - 1; i >= 0; i--) {{
454+ const listener = listeners[i]
455+ eventData.id = listener.id
456+ listener.handler(eventData)
474457 }}
475458 }}
476459 " ,
477- key = key,
478460 function = self . inner. listeners. function_name( ) ,
479461 listeners = self . inner. listeners. listeners_object_name( )
480462 ) ;
@@ -708,37 +690,14 @@ impl<R: Runtime> WindowManager<R> {
708690 ) -> EventHandler {
709691 self . inner . listeners . once ( event, window, handler)
710692 }
693+
711694 pub fn event_listeners_object_name ( & self ) -> String {
712695 self . inner . listeners . listeners_object_name ( )
713696 }
697+
714698 pub fn event_emit_function_name ( & self ) -> String {
715699 self . inner . listeners . function_name ( )
716700 }
717- pub fn generate_salt ( & self ) -> Uuid {
718- let salt = Uuid :: new_v4 ( ) ;
719- self
720- . inner
721- . salts
722- . lock ( )
723- . expect ( "poisoned salt mutex" )
724- . insert ( salt) ;
725- salt
726- }
727- pub fn verify_salt ( & self , salt : String ) -> bool {
728- // flat out ignore any invalid uuids
729- let uuid: Uuid = match salt. parse ( ) {
730- Ok ( uuid) => uuid,
731- Err ( _) => return false ,
732- } ;
733-
734- // HashSet::remove lets us know if the entry was found
735- self
736- . inner
737- . salts
738- . lock ( )
739- . expect ( "poisoned salt mutex" )
740- . remove ( & uuid)
741- }
742701
743702 pub fn get_window ( & self , label : & str ) -> Option < Window < R > > {
744703 self . windows_lock ( ) . get ( label) . cloned ( )
0 commit comments