Skip to content

Commit 75c59f0

Browse files
committed
🩹 fix SW bypass for pptr 15 #2752
1 parent db26aac commit 75c59f0

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/controllers/browser.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ export async function initPage(sessionId?: string, config?:ConfigObject, qrManag
3939
spinner?.info(`Browser launched: ${(now() - startBrowser).toFixed(0)}ms`)
4040
waPage = await getWAPage(browser);
4141
}
42-
const pageCDPClient = await waPage.target().createCDPSession();
43-
await pageCDPClient.send('Network.setBypassServiceWorker', {bypass: true})
44-
if(waPage._client) {
45-
const cl = (typeof waPage._client === 'function' ? waPage._client() : waPage._client) as CDPSession
46-
if(cl.send) await cl.send('Network.setBypassServiceWorker', {bypass: true})
47-
}
42+
//@ts-ignore
43+
await (typeof waPage._client === 'function' && waPage._client() || waPage._client).send('Network.setBypassServiceWorker', {bypass: true})
4844
const postBrowserLaunchTs = now();
4945
waPage.on("framenavigated", async frame => {
5046
try {

0 commit comments

Comments
 (0)