提交 ceb8f18f 编写于 作者: M Matt Bierner

Adding pinning test for webview scripts disabled

上级 7b8e4630
......@@ -42,6 +42,21 @@ suite('Webview tests', () => {
assert.strictEqual((await firstResponse).value, 2);
});
test('webviews should not have scripts enabled by default', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { }));
const response = Promise.race<any>([
getMesssage(webview),
new Promise<{}>(resolve => setTimeout(() => resolve({ value: '🎉' }), 1000))
]);
webview.webview.html = createHtmlDocumentWithBody(/*html*/`
<script>
const vscode = acquireVsCodeApi();
vscode.postMessage({ value: '💉' });
</script>`);
assert.strictEqual((await response).value, '🎉');
});
test('webviews should update html', async () => {
const webview = _register(vscode.window.createWebviewPanel(webviewId, 'title', { viewColumn: vscode.ViewColumn.One }, { enableScripts: true }));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册