@@ -2,9 +2,6 @@ import { Page, JSCoverageEntry } from 'puppeteer-core';
2
2
import { TestRunnerCoreConfig } from '@web/test-runner-core' ;
3
3
import { v8ToIstanbul } from '@web/test-runner-coverage-v8' ;
4
4
import { SessionResult } from '@web/test-runner-core' ;
5
- import { Mutex } from 'async-mutex' ;
6
-
7
- const mutex = new Mutex ( ) ;
8
5
9
6
declare global {
10
7
interface Window {
@@ -49,43 +46,6 @@ export class ChromeLauncherPage {
49
46
} ) ;
50
47
}
51
48
52
- // Patching the browser page to workaround an issue in the new headless mode of Chrome where some functions
53
- // with callbacks (requestAnimationFrame and requestIdleCallback) are not executing their callbacks.
54
- // https://github.com/puppeteer/puppeteer/issues/10350
55
- if ( ! this . patchAdded ) {
56
- await this . puppeteerPage . exposeFunction ( '__bringTabToFront' , ( id : string ) => {
57
- const promise = new Promise ( resolve => {
58
- this . resolvers [ id ] = resolve as ( ) => void ;
59
- } ) ;
60
- return mutex . runExclusive ( async ( ) => {
61
- await this . puppeteerPage . bringToFront ( ) ;
62
- await promise ;
63
- } ) ;
64
- } ) ;
65
- await this . puppeteerPage . exposeFunction ( '__releaseLock' , ( id : string ) => {
66
- this . resolvers [ id ] ?.( ) ;
67
- } ) ;
68
- await this . puppeteerPage . evaluateOnNewDocument ( ( ) => {
69
- // eslint-disable-next-line @typescript-eslint/ban-types
70
- function patchFunction ( name : string , fn : Function ) {
71
- ( window as any ) [ name ] = ( ...args : unknown [ ] ) => {
72
- const result = fn . call ( window , ...args ) ;
73
- const id = Math . random ( ) . toString ( ) . substring ( 2 ) ;
74
- // Make sure that the tab running the test code is brought back to the front.
75
- window . __bringTabToFront ( id ) ;
76
- fn . call ( window , ( ) => {
77
- window . __releaseLock ( id ) ;
78
- } ) ;
79
- return result ;
80
- } ;
81
- }
82
-
83
- patchFunction ( 'requestAnimationFrame' , window . requestAnimationFrame ) ;
84
- patchFunction ( 'requestIdleCallback' , window . requestIdleCallback ) ;
85
- } ) ;
86
- this . patchAdded = true ;
87
- }
88
-
89
49
await this . puppeteerPage . setViewport ( { height : 600 , width : 800 } ) ;
90
50
await this . puppeteerPage . goto ( url ) ;
91
51
}
0 commit comments