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 = {
24
24
view : WebviewView ;
25
25
preserveFocus ?: boolean ;
26
26
additionalOptions ?: WebviewPanelOptions & WebviewOptions ;
27
+ allowWasmEval ?: boolean ;
27
28
} ;
28
29
29
30
export abstract class AbstractWebview <
@@ -116,6 +117,7 @@ export abstract class AbstractWebview<
116
117
config . view ,
117
118
{
118
119
allowInlineStyles : true ,
120
+ allowWasmEval : config . allowWasmEval ?? false ,
119
121
} ,
120
122
) ;
121
123
this . push (
Original file line number Diff line number Diff line change @@ -129,10 +129,13 @@ export function getHtmlForWebview(
129
129
view : WebviewView ,
130
130
{
131
131
allowInlineStyles,
132
+ allowWasmEval,
132
133
} : {
133
134
allowInlineStyles ?: boolean ;
135
+ allowWasmEval ?: boolean ;
134
136
} = {
135
137
allowInlineStyles : false ,
138
+ allowWasmEval : false ,
136
139
} ,
137
140
) : string {
138
141
const scriptUriOnDisk = Uri . file ( ctx . asAbsolutePath ( "out/webview.js" ) ) ;
@@ -172,7 +175,9 @@ export function getHtmlForWebview(
172
175
<html>
173
176
<head>
174
177
<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 ${
176
181
webview . cspSource
177
182
} ;">
178
183
${ stylesheetsHtmlLines . join ( ` ${ EOL } ` ) }
Original file line number Diff line number Diff line change @@ -221,6 +221,8 @@ export class ResultsView extends AbstractWebview<
221
221
viewColumn : this . chooseColumnForWebview ( ) ,
222
222
preserveFocus : true ,
223
223
view : "results" ,
224
+ // Required for the graph viewer which is using d3-graphviz WASM module
225
+ allowWasmEval : true ,
224
226
} ;
225
227
}
226
228
You can’t perform that action at this time.
0 commit comments