From 8aef8e8fc26f965bb3414861a0252e358e70b2c6 Mon Sep 17 00:00:00 2001 From: Playwright Service <89237858+playwrightmachine@users.noreply.github.com> Date: Wed, 6 Dec 2023 13:53:00 -0800 Subject: [PATCH] cherry-pick(#28197): fix(chromium): properly detect session closed errors for oopifs (#28508) This PR cherry-picks the following commits: - da6707f785bd03fbb12be1d7c3208588dc459f38 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- packages/playwright-core/src/server/chromium/crPage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts index d7a2a5dddf..2aa98d4f7f 100644 --- a/packages/playwright-core/src/server/chromium/crPage.ts +++ b/packages/playwright-core/src/server/chromium/crPage.ts @@ -46,6 +46,7 @@ import type { Protocol } from './protocol'; import { VideoRecorder } from './videoRecorder'; import { BrowserContext } from '../browserContext'; import { TargetClosedError } from '../errors'; +import { isSessionClosedError } from '../protocolError'; const UTILITY_WORLD_NAME = '__playwright_utility_world__'; @@ -132,7 +133,7 @@ export class CRPage implements PageDelegate { return cb(frameSession); return cb(frameSession).catch(e => { // Broadcasting a message to the closed iframe should be a noop. - if (e.message && e.message.includes('Target closed')) + if (isSessionClosedError(e)) return; throw e; });