@@ -489,9 +489,7 @@ class WPTRunner {
489489 pretendGlobalThisAs ( name ) {
490490 switch ( name ) {
491491 case 'Window' : {
492- this . globalThisInitScripts . push (
493- `global.Window = Object.getPrototypeOf(globalThis).constructor;
494- self.GLOBAL.isWorker = () => false;` ) ;
492+ this . globalThisInitScripts . push ( 'globalThis.Window = Object.getPrototypeOf(globalThis).constructor;' ) ;
495493 this . loadLazyGlobals ( ) ;
496494 break ;
497495 }
@@ -531,39 +529,10 @@ class WPTRunner {
531529 this . globalThisInitScripts . push ( script ) ;
532530 }
533531
534- brandCheckGlobalScopeAttribute ( name ) {
535- // TODO(legendecas): idlharness GlobalScope attribute receiver validation.
536- const script = `
537- const desc = Object.getOwnPropertyDescriptor(globalThis, '${ name } ');
538- function getter() {
539- // Mimic GlobalScope instance brand check.
540- if (this !== globalThis) {
541- throw new TypeError('Illegal invocation');
542- }
543- return desc.get();
544- }
545- Object.defineProperty(getter, 'name', { value: 'get ${ name } ' });
546-
547- function setter(value) {
548- // Mimic GlobalScope instance brand check.
549- if (this !== globalThis) {
550- throw new TypeError('Illegal invocation');
551- }
552- desc.set(value);
553- }
554- Object.defineProperty(setter, 'name', { value: 'set ${ name } ' });
555-
556- Object.defineProperty(globalThis, '${ name } ', {
557- get: getter,
558- set: setter,
559- });
560- ` ;
561- this . globalThisInitScripts . push ( script ) ;
562- }
563-
564532 // TODO(joyeecheung): work with the upstream to port more tests in .html
565533 // to .js.
566534 async runJsTests ( ) {
535+ this . pretendGlobalThisAs ( 'Window' ) ;
567536 let queue = [ ] ;
568537
569538 // If the tests are run as `node test/wpt/test-something.js subset.any.js`,
0 commit comments