* Pretend the runner is run in `name`'s environment (globalThis). * @param {'Window'} name * @see https://github.com/nodejs/node/blob/24673ace8ae196bd1c6d4676507d6e8c94cf0b90/test/fixtures/wpt/resources/idlharness.js#L654-L671
(name)
| 649 | * @see {@link https://github.com/nodejs/node/blob/24673ace8ae196bd1c6d4676507d6e8c94cf0b90/test/fixtures/wpt/resources/idlharness.js#L654-L671} |
| 650 | */ |
| 651 | pretendGlobalThisAs(name) { |
| 652 | switch (name) { |
| 653 | case 'Window': { |
| 654 | this.globalThisInitScripts.push('globalThis.Window = Object.getPrototypeOf(globalThis).constructor;'); |
| 655 | break; |
| 656 | } |
| 657 | |
| 658 | // TODO(XadillaX): implement `ServiceWorkerGlobalScope`, |
| 659 | // `DedicateWorkerGlobalScope`, etc. |
| 660 | // |
| 661 | // e.g. `ServiceWorkerGlobalScope` should implement dummy |
| 662 | // `addEventListener` and so on. |
| 663 | |
| 664 | default: throw new Error(`Invalid globalThis type ${name}.`); |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | // TODO(joyeecheung): work with the upstream to port more tests in .html |
| 669 | // to .js. |
no test coverage detected