@@ -182,30 +182,6 @@ async function webviewPreloads(ctx: PreloadContext) {
182
182
183
183
document . body . addEventListener ( 'click' , handleInnerClick ) ;
184
184
185
- const preservedScriptAttributes : ( keyof HTMLScriptElement ) [ ] = [
186
- 'type' , 'src' , 'nonce' , 'noModule' , 'async' ,
187
- ] ;
188
-
189
- // derived from https://github.com/jquery/jquery/blob/d0ce00cdfa680f1f0c38460bc51ea14079ae8b07/src/core/DOMEval.js
190
- const domEval = ( container : Element ) => {
191
- const arr = Array . from ( container . getElementsByTagName ( 'script' ) ) ;
192
- for ( let n = 0 ; n < arr . length ; n ++ ) {
193
- const node = arr [ n ] ;
194
- const scriptTag = document . createElement ( 'script' ) ;
195
- const trustedScript = ttPolicy ?. createScript ( node . innerText ) ?? node . innerText ;
196
- scriptTag . text = trustedScript as string ;
197
- for ( const key of preservedScriptAttributes ) {
198
- const val = node [ key ] || node . getAttribute && node . getAttribute ( key ) ;
199
- if ( val ) {
200
- scriptTag . setAttribute ( key , val as any ) ;
201
- }
202
- }
203
-
204
- // TODO@connor 4312: should script with src not be removed?
205
- container . appendChild ( scriptTag ) . parentNode ! . removeChild ( scriptTag ) ;
206
- }
207
- } ;
208
-
209
185
async function loadScriptSource ( url : string , originalUri : string ) : Promise < string > {
210
186
const res = await fetch ( url ) ;
211
187
const text = await res . text ( ) ;
@@ -2312,7 +2288,6 @@ async function webviewPreloads(ctx: PreloadContext) {
2312
2288
if ( content . type === 0 /* RenderOutputType.Html */ ) {
2313
2289
const trustedHtml = ttPolicy ?. createHTML ( content . htmlContent ) ?? content . htmlContent ;
2314
2290
this . element . innerHTML = trustedHtml as string ;
2315
- domEval ( this . element ) ;
2316
2291
} else if ( preloadErrors . some ( e => e instanceof Error ) ) {
2317
2292
const errors = preloadErrors . filter ( ( e ) : e is Error => e instanceof Error ) ;
2318
2293
showRenderError ( `Error loading preloads` , this . element , errors ) ;
0 commit comments