From c3b49147e411b580b7d5b995b3bd8f21b1ce6bac Mon Sep 17 00:00:00 2001 From: kascit Date: Mon, 11 May 2026 16:28:03 +0530 Subject: [PATCH] Apply latest heavy updates cleanly --- templates/macros/head.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/templates/macros/head.html b/templates/macros/head.html index 65f9851..c566f4c 100644 --- a/templates/macros/head.html +++ b/templates/macros/head.html @@ -49,6 +49,29 @@ }); } catch(e) {} } + + function installFramePolicy(methodName) { + const original = Element.prototype[methodName]; + Element.prototype[methodName] = function(...args) { + const result = original.apply(this, args); + const node = args[0]; + if (node && node.tagName === 'IFRAME') { + try { + const win = node.contentWindow; + if (win && win.trustedTypes && !win.trustedTypes.defaultPolicy) { + win.trustedTypes.createPolicy('default', { + createHTML: s => s, + createScript: s => s, + createScriptURL: s => s + }); + } + } catch (err) {} + } + return result; + }; + } + installFramePolicy('appendChild'); + installFramePolicy('insertBefore'); })();