mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
committed by
GitHub
parent
8f259f4ef8
commit
022eed4667
5
.changes/fix-nested-isolation-iframe.md
Normal file
5
.changes/fix-nested-isolation-iframe.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch
|
||||
---
|
||||
|
||||
Fixes nested isolation iframe injection.
|
||||
@@ -3,13 +3,15 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
let style = document.createElement('style')
|
||||
style.textContent = __TEMPLATE_style__
|
||||
document.head.append(style)
|
||||
if (window.location.origin.startsWith(__TEMPLATE_origin__)) {
|
||||
let style = document.createElement('style')
|
||||
style.textContent = __TEMPLATE_style__
|
||||
document.head.append(style)
|
||||
|
||||
let iframe = document.createElement('iframe')
|
||||
iframe.id = '__tauri_isolation__'
|
||||
iframe.sandbox.add('allow-scripts')
|
||||
iframe.src = __TEMPLATE_isolation_src__
|
||||
document.body.append(iframe)
|
||||
let iframe = document.createElement('iframe')
|
||||
iframe.id = '__tauri_isolation__'
|
||||
iframe.sandbox.add('allow-scripts')
|
||||
iframe.src = __TEMPLATE_isolation_src__
|
||||
document.body.append(iframe)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -39,6 +39,7 @@ pub(crate) struct IpcJavascript<'a> {
|
||||
#[derive(Template)]
|
||||
#[default_template("../scripts/isolation.js")]
|
||||
pub(crate) struct IsolationJavascript<'a> {
|
||||
pub(crate) origin: &'a str,
|
||||
pub(crate) isolation_src: &'a str,
|
||||
pub(crate) style: &'a str,
|
||||
}
|
||||
|
||||
@@ -438,6 +438,7 @@ impl<R: Runtime> WindowManager<R> {
|
||||
if let Pattern::Isolation { schema, .. } = self.pattern() {
|
||||
webview_attributes = webview_attributes.initialization_script(
|
||||
&IsolationJavascript {
|
||||
origin: &self.get_browser_origin(),
|
||||
isolation_src: &crate::pattern::format_real_schema(schema),
|
||||
style: tauri_utils::pattern::isolation::IFRAME_STYLE,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user