Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(oopifs): ignore target closure when broadcasting across oopifs (#5246)
Dmitry Gozman9e09bd369d40
diff --git a/src/server/chromium/crPage.ts b/src/server/chromium/crPage.tsindex 5aa3892b01..eebdbdb4a6 100644--- a/src/server/chromium/crPage.ts+++ b/src/server/chromium/crPage.ts@@ -93,7 +93,17 @@ export class CRPage implements PageDelegate {}private async _forAllFrameSessions(cb: (frame: FrameSession) => Promise<any>) {- await Promise.all(Array.from(this._sessions.values()).map(frame => cb(frame)));+ const frameSessions = Array.from(this._sessions.values());+ await Promise.all(frameSessions.map(frameSession => {+ if (frameSession._isMainFrame())+ return cb(frameSession);+ return cb(frameSession).catch(e => {+ // Broadcasting a message to the closed iframe shoule be a noop.+ if (e.message && (e.message.includes('Target closed.') || e.message.includes('Session closed.')))+ return;+ throw e;+ });+ }));}private _sessionForFrame(frame: frames.Frame): FrameSession {@@ -348,7 +358,7 @@ class FrameSession {});}- private _isMainFrame(): boolean {+ _isMainFrame(): boolean {return this._targetId === this._crPage._targetId;}