diff options
Diffstat (limited to 'src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html')
-rw-r--r-- | src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html b/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html index ec2b7281a65..6469cf31e74 100644 --- a/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html +++ b/src/vs/workbench/contrib/webview/browser/pre/index-no-csp.html @@ -919,14 +919,21 @@ sandboxRules.add('allow-forms'); } newFrame.setAttribute('sandbox', Array.from(sandboxRules).join(' ')); - if (!isFirefox) { - newFrame.setAttribute('allow', options.allowScripts ? 'clipboard-read; clipboard-write;' : ''); + + const allowRules = ['cross-origin-isolated;'] + if(!isFirefox && options.allowScripts) { + allowRules.push('clipboard-read;','clipboard-write;') } + newFrame.setAttribute('allow', allowRules.join(' ')); // We should just be able to use srcdoc, but I wasn't // seeing the service worker applying properly. // Fake load an empty on the correct origin and then write real html // into it to get around this. - newFrame.src = `./fake.html?id=${ID}`; + const fakeUrlParams = new URLSearchParams({id: ID}); + if(globalThis.crossOriginIsolated) { + fakeUrlParams.set('vscode-coi', '3') /*COOP+COEP*/ + } + newFrame.src = `./fake.html?${fakeUrlParams.toString()}`; newFrame.style.cssText = 'display: block; margin: 0; overflow: hidden; position: absolute; width: 100%; height: 100%; visibility: hidden'; document.body.appendChild(newFrame); |