@@ -362,16 +362,10 @@ impl<R: Runtime> WindowManager<R> {
362362 }
363363
364364 /// Get the origin as it will be seen in the webview.
365- fn get_browser_origin ( & self ) -> Cow < ' _ , str > {
365+ fn get_browser_origin ( & self ) -> String {
366366 match self . base_path ( ) {
367- AppUrl :: Url ( WindowUrl :: External ( url) ) => {
368- let mut url = url. to_string ( ) ;
369- if url. ends_with ( '/' ) {
370- url. pop ( ) ;
371- }
372- Cow :: Owned ( url)
373- }
374- _ => Cow :: Owned ( format_real_schema ( "tauri" ) ) ,
367+ AppUrl :: Url ( WindowUrl :: External ( url) ) => url. origin ( ) . ascii_serialization ( ) ,
368+ _ => format_real_schema ( "tauri" ) ,
375369 }
376370 }
377371
@@ -450,7 +444,7 @@ impl<R: Runtime> WindowManager<R> {
450444 if let Pattern :: Isolation { schema, .. } = self . pattern ( ) {
451445 webview_attributes = webview_attributes. initialization_script (
452446 & IsolationJavascript {
453- origin : & self . get_browser_origin ( ) ,
447+ origin : self . get_browser_origin ( ) ,
454448 isolation_src : & crate :: pattern:: format_real_schema ( schema) ,
455449 style : tauri_utils:: pattern:: isolation:: IFRAME_STYLE ,
456450 }
@@ -883,7 +877,7 @@ impl<R: Runtime> WindowManager<R> {
883877 #[ derive( Template ) ]
884878 #[ default_template( "../scripts/init.js" ) ]
885879 struct InitJavascript < ' a > {
886- origin : Cow < ' a , str > ,
880+ origin : String ,
887881 #[ raw]
888882 pattern_script : & ' a str ,
889883 #[ raw]
0 commit comments