@@ -298,7 +298,7 @@ class WPTRunner {
298
298
this . resource = new ResourceLoader ( path ) ;
299
299
300
300
this . flags = [ ] ;
301
- this . dummyGlobalThisScript = null ;
301
+ this . globalThisInitScripts = [ ] ;
302
302
this . initScript = null ;
303
303
304
304
this . status = new StatusLoader ( path ) ;
@@ -340,17 +340,17 @@ class WPTRunner {
340
340
}
341
341
342
342
get fullInitScript ( ) {
343
- if ( this . initScript === null && this . dummyGlobalThisScript === null ) {
344
- return null ;
343
+ if ( this . globalThisInitScripts . length === null ) {
344
+ return this . initScript ;
345
345
}
346
346
347
+ const globalThisInitScript = this . globalThisInitScripts . join ( '\n\n//===\n' ) ;
348
+
347
349
if ( this . initScript === null ) {
348
- return this . dummyGlobalThisScript ;
349
- } else if ( this . dummyGlobalThisScript === null ) {
350
- return this . initScript ;
350
+ return globalThisInitScript ;
351
351
}
352
352
353
- return `${ this . dummyGlobalThisScript } \n\n//===\n${ this . initScript } ` ;
353
+ return `${ globalThisInitScript } \n\n//===\n${ this . initScript } ` ;
354
354
}
355
355
356
356
/**
@@ -361,8 +361,9 @@ class WPTRunner {
361
361
pretendGlobalThisAs ( name ) {
362
362
switch ( name ) {
363
363
case 'Window' : {
364
- this . dummyGlobalThisScript =
365
- 'global.Window = Object.getPrototypeOf(globalThis).constructor;' ;
364
+ this . globalThisInitScripts . push (
365
+ `global.Window = Object.getPrototypeOf(globalThis).constructor;
366
+ self.GLOBAL.isWorker = () => false;` ) ;
366
367
break ;
367
368
}
368
369
0 commit comments