mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Strip meta http-equiv tags from webview content updates
This commit is contained in:
@@ -130,6 +130,13 @@ window.addEventListener('message', async event => {
|
||||
const parser = new DOMParser();
|
||||
const newContent = parser.parseFromString(event.data.content, 'text/html');
|
||||
|
||||
// Strip out meta http-equiv tags
|
||||
for (const metaElement of Array.from(newContent.querySelectorAll('meta'))) {
|
||||
if (metaElement.hasAttribute('http-equiv')) {
|
||||
metaElement.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (event.data.source !== documentResource) {
|
||||
root.replaceWith(newContent.querySelector('.markdown-body')!);
|
||||
documentResource = event.data.source;
|
||||
|
||||
Reference in New Issue
Block a user