Skip to content

Commit

Permalink
fix(chromium): properly detect session closed errors for oopifs (micr…
Browse files Browse the repository at this point in the history
…osoft#28197)

Exposed by the flaky test `should not throw on exposeFunction when oopif
detaches`.
  • Loading branch information
dgozman authored Nov 16, 2023
1 parent ff706ec commit da6707f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/playwright-core/src/server/chromium/crPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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__';
Expand Down Expand Up @@ -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;
});
Expand Down

0 comments on commit da6707f

Please sign in to comment.