mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 21:06:57 +00:00
Auto rewrite vscode-resource entries in csp in web iframe based webviews
This commit is contained in:
parent
e44d9a2888
commit
e37d0e7e43
2 changed files with 7 additions and 1 deletions
|
@ -289,6 +289,11 @@
|
|||
const csp = newDocument.querySelector('meta[http-equiv="Content-Security-Policy"]');
|
||||
if (!csp) {
|
||||
host.postMessage('no-csp-found');
|
||||
} else {
|
||||
// Rewrite vscode-resource in csp
|
||||
if (data.endpoint) {
|
||||
csp.setAttribute('content', csp.getAttribute('content').replace(/vscode-resource:/g, data.endpoint));
|
||||
}
|
||||
}
|
||||
|
||||
// set DOCTYPE for newDocument explicitly as DOMParser.parseFromString strips it off
|
||||
|
|
|
@ -202,7 +202,8 @@ export class IFrameWebview extends Disposable implements Webview {
|
|||
this._send('content', {
|
||||
contents: this.content.html,
|
||||
options: this.content.options,
|
||||
state: this.content.state
|
||||
state: this.content.state,
|
||||
endpoint: this.endpoint,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue