Skip to content

Commit 57c2d72

Browse files
committed
Update UIWindow.js
1 parent 8e56ac5 commit 57c2d72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/gui/src/UI/UIWindow.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ async function UIWindow(options) {
313313
style="${!options.has_head ? ' height: 100%;' : ''}">`;
314314
// iframe, for apps
315315
if(options.iframe_url || options.iframe_srcdoc){
316+
let allow_str = `camera; encrypted-media; gamepad; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; fullscreen;`;
317+
if(window.co_isolation_enabled)
318+
allow_str += ' cross-origin-isolated;';
316319
// <iframe>
317320
// Important: we don't allow allow-same-origin when iframe_srcdoc is used because this would allow the iframe to access the parent window's DOM, localStorage, etc.
318321
// this is a security risk and must be avoided.
@@ -323,14 +326,13 @@ async function UIWindow(options) {
323326
${options.iframe_url ? 'src="'+ html_encode(options.iframe_url)+'"' : ''}
324327
${options.iframe_srcdoc ? 'srcdoc="'+ html_encode(options.iframe_srcdoc) +'"' : ''}
325328
${window.co_isolation_enabled
326-
? 'credentialless allow="cross-origin-isolated" '
329+
? 'credentialless '
327330
: ''
328331
}
329-
allow = "accelerometer; camera; encrypted-media; gamepad; display-capture; geolocation; gyroscope; microphone; midi; clipboard-read; clipboard-write; fullscreen;"
332+
allow = "${allow_str}"
330333
allowtransparency="true"
331334
allowpaymentrequest="true"
332335
allowfullscreen="true"
333-
allow="microphone"
334336
webkitallowfullscreen="webkitallowfullscreen"
335337
mozallowfullscreen="mozallowfullscreen"
336338
sandbox="allow-forms allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox ${options.iframe_srcdoc ? '' : 'allow-same-origin'} allow-scripts allow-top-navigation-by-user-activation allow-downloads allow-presentation allow-storage-access-by-user-activation"></iframe>`;

0 commit comments

Comments
 (0)