File tree 4 files changed +17
-8
lines changed
4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " tauri " : patch
3
+ ---
4
+
5
+ Fixes nested isolation iframe injection.
Original file line number Diff line number Diff line change 3
3
// SPDX-License-Identifier: MIT
4
4
5
5
window . addEventListener ( 'DOMContentLoaded' , ( ) => {
6
- let style = document . createElement ( 'style' )
7
- style . textContent = __TEMPLATE_style__
8
- document . head . append ( style )
6
+ if ( window . location . origin . startsWith ( __TEMPLATE_origin__ ) ) {
7
+ let style = document . createElement ( 'style' )
8
+ style . textContent = __TEMPLATE_style__
9
+ document . head . append ( style )
9
10
10
- let iframe = document . createElement ( 'iframe' )
11
- iframe . id = '__tauri_isolation__'
12
- iframe . sandbox . add ( 'allow-scripts' )
13
- iframe . src = __TEMPLATE_isolation_src__
14
- document . body . append ( iframe )
11
+ let iframe = document . createElement ( 'iframe' )
12
+ iframe . id = '__tauri_isolation__'
13
+ iframe . sandbox . add ( 'allow-scripts' )
14
+ iframe . src = __TEMPLATE_isolation_src__
15
+ document . body . append ( iframe )
16
+ }
15
17
} )
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ pub(crate) struct IpcJavascript<'a> {
39
39
#[ derive( Template ) ]
40
40
#[ default_template( "../scripts/isolation.js" ) ]
41
41
pub ( crate ) struct IsolationJavascript < ' a > {
42
+ pub ( crate ) origin : & ' a str ,
42
43
pub ( crate ) isolation_src : & ' a str ,
43
44
pub ( crate ) style : & ' a str ,
44
45
}
Original file line number Diff line number Diff line change @@ -438,6 +438,7 @@ impl<R: Runtime> WindowManager<R> {
438
438
if let Pattern :: Isolation { schema, .. } = self . pattern ( ) {
439
439
webview_attributes = webview_attributes. initialization_script (
440
440
& IsolationJavascript {
441
+ origin : & self . get_browser_origin ( ) ,
441
442
isolation_src : & crate :: pattern:: format_real_schema ( schema) ,
442
443
style : tauri_utils:: pattern:: isolation:: IFRAME_STYLE ,
443
444
}
You can’t perform that action at this time.
0 commit comments