File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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 33// SPDX-License-Identifier: MIT
44
55window . 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 )
910
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+ }
1517} )
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ pub(crate) struct IpcJavascript<'a> {
3939#[ derive( Template ) ]
4040#[ default_template( "../scripts/isolation.js" ) ]
4141pub ( crate ) struct IsolationJavascript < ' a > {
42+ pub ( crate ) origin : & ' a str ,
4243 pub ( crate ) isolation_src : & ' a str ,
4344 pub ( crate ) style : & ' a str ,
4445}
Original file line number Diff line number Diff line change @@ -438,6 +438,7 @@ impl<R: Runtime> WindowManager<R> {
438438 if let Pattern :: Isolation { schema, .. } = self . pattern ( ) {
439439 webview_attributes = webview_attributes. initialization_script (
440440 & IsolationJavascript {
441+ origin : & self . get_browser_origin ( ) ,
441442 isolation_src : & crate :: pattern:: format_real_schema ( schema) ,
442443 style : tauri_utils:: pattern:: isolation:: IFRAME_STYLE ,
443444 }
You can’t perform that action at this time.
0 commit comments