@@ -182,30 +182,6 @@ async function webviewPreloads(ctx: PreloadContext) {
182182
183183 document . body . addEventListener ( 'click' , handleInnerClick ) ;
184184
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-
209185 async function loadScriptSource ( url : string , originalUri : string ) : Promise < string > {
210186 const res = await fetch ( url ) ;
211187 const text = await res . text ( ) ;
@@ -2312,7 +2288,6 @@ async function webviewPreloads(ctx: PreloadContext) {
23122288 if ( content . type === 0 /* RenderOutputType.Html */ ) {
23132289 const trustedHtml = ttPolicy ?. createHTML ( content . htmlContent ) ?? content . htmlContent ;
23142290 this . element . innerHTML = trustedHtml as string ;
2315- domEval ( this . element ) ;
23162291 } else if ( preloadErrors . some ( e => e instanceof Error ) ) {
23172292 const errors = preloadErrors . filter ( ( e ) : e is Error => e instanceof Error ) ;
23182293 showRenderError ( `Error loading preloads` , this . element , errors ) ;
0 commit comments