File tree Expand file tree Collapse file tree 1 file changed +1
-24
lines changed Expand file tree Collapse file tree 1 file changed +1
-24
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ const getInjectScripts: ScramjetInterface["getInjectScripts"] = (
257257 script ( config . files . wasm ) ,
258258 script ( config . files . all ) ,
259259 script ( "data:application/javascript;base64," + base64Injected ) ,
260+ script ( virtualInjectUrl ) ,
260261 ] ;
261262} ;
262263setInterface ( {
@@ -349,30 +350,6 @@ function makeController(url: URL): Controller {
349350 cookieJar,
350351 prefix : prefix ,
351352 } ) ;
352- fetchHandler . addEventListener ( "htmlPostRewrite" , ( e : any ) => {
353- const handler = e . handler as DomHandler ;
354- function findhead ( node : Element ) : Element | null {
355- if ( node . type === ElementType . Tag && node . name === "head" ) {
356- return node as Element ;
357- } else if ( node . childNodes ) {
358- for ( const child of node . childNodes ) {
359- const head = findhead ( child as Element ) ;
360- if ( head ) return head ;
361- }
362- }
363-
364- return null ;
365- }
366-
367- const head = findhead ( handler . root as Node as Element ) ! ;
368-
369- // inject after the scramjet scripts and before the rest of the page
370- head . children . splice (
371- 3 ,
372- 0 ,
373- new Element ( "script" , { src : virtualInjectUrl } )
374- ) ;
375- } ) ;
376353
377354 const controller = {
378355 controllerframe : frame ,
You can’t perform that action at this time.
0 commit comments