File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export type WebviewPanelConfig = {
2424 view : WebviewView ;
2525 preserveFocus ?: boolean ;
2626 additionalOptions ?: WebviewPanelOptions & WebviewOptions ;
27+ allowWasmEval ?: boolean ;
2728} ;
2829
2930export abstract class AbstractWebview <
@@ -116,6 +117,7 @@ export abstract class AbstractWebview<
116117 config . view ,
117118 {
118119 allowInlineStyles : true ,
120+ allowWasmEval : config . allowWasmEval ?? false ,
119121 } ,
120122 ) ;
121123 this . push (
Original file line number Diff line number Diff line change @@ -129,10 +129,13 @@ export function getHtmlForWebview(
129129 view : WebviewView ,
130130 {
131131 allowInlineStyles,
132+ allowWasmEval,
132133 } : {
133134 allowInlineStyles ?: boolean ;
135+ allowWasmEval ?: boolean ;
134136 } = {
135137 allowInlineStyles : false ,
138+ allowWasmEval : false ,
136139 } ,
137140) : string {
138141 const scriptUriOnDisk = Uri . file ( ctx . asAbsolutePath ( "out/webview.js" ) ) ;
@@ -172,7 +175,9 @@ export function getHtmlForWebview(
172175<html>
173176 <head>
174177 <meta http-equiv="Content-Security-Policy"
175- content="default-src 'none'; script-src 'nonce-${ nonce } ' 'wasm-unsafe-eval'; font-src ${ fontSrc } ; style-src ${ styleSrc } ; connect-src ${
178+ content="default-src 'none'; script-src 'nonce-${ nonce } '${
179+ allowWasmEval ? " 'wasm-unsafe-eval'" : ""
180+ } ; font-src ${ fontSrc } ; style-src ${ styleSrc } ; connect-src ${
176181 webview . cspSource
177182 } ;">
178183 ${ stylesheetsHtmlLines . join ( ` ${ EOL } ` ) }
Original file line number Diff line number Diff line change @@ -221,6 +221,8 @@ export class ResultsView extends AbstractWebview<
221221 viewColumn : this . chooseColumnForWebview ( ) ,
222222 preserveFocus : true ,
223223 view : "results" ,
224+ // Required for the graph viewer which is using d3-graphviz WASM module
225+ allowWasmEval : true ,
224226 } ;
225227 }
226228
You can’t perform that action at this time.
0 commit comments