fix: do not hang on submitting target=_blank form (#20458)

Fixes #18392
This commit is contained in:
Yury Semikhatsky 2023-01-30 11:13:56 -08:00 committed by GitHub
parent e6f83f5b94
commit cffe7b65e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -379,7 +379,7 @@ export class WKPage implements PageDelegate {
eventsHelper.addEventListener(this._session, 'Page.frameDetached', event => this._onFrameDetached(event.frameId)), eventsHelper.addEventListener(this._session, 'Page.frameDetached', event => this._onFrameDetached(event.frameId)),
eventsHelper.addEventListener(this._session, 'Page.willCheckNavigationPolicy', event => this._onWillCheckNavigationPolicy(event.frameId)), eventsHelper.addEventListener(this._session, 'Page.willCheckNavigationPolicy', event => this._onWillCheckNavigationPolicy(event.frameId)),
eventsHelper.addEventListener(this._session, 'Page.didCheckNavigationPolicy', event => this._onDidCheckNavigationPolicy(event.frameId, event.cancel)), eventsHelper.addEventListener(this._session, 'Page.didCheckNavigationPolicy', event => this._onDidCheckNavigationPolicy(event.frameId, event.cancel)),
eventsHelper.addEventListener(this._session, 'Page.frameScheduledNavigation', event => this._onFrameScheduledNavigation(event.frameId)), eventsHelper.addEventListener(this._session, 'Page.frameScheduledNavigation', event => this._onFrameScheduledNavigation(event.frameId, event.delay, event.targetIsCurrentFrame)),
eventsHelper.addEventListener(this._session, 'Page.loadEventFired', event => this._page._frameManager.frameLifecycleEvent(event.frameId, 'load')), eventsHelper.addEventListener(this._session, 'Page.loadEventFired', event => this._page._frameManager.frameLifecycleEvent(event.frameId, 'load')),
eventsHelper.addEventListener(this._session, 'Page.domContentEventFired', event => this._page._frameManager.frameLifecycleEvent(event.frameId, 'domcontentloaded')), eventsHelper.addEventListener(this._session, 'Page.domContentEventFired', event => this._page._frameManager.frameLifecycleEvent(event.frameId, 'domcontentloaded')),
eventsHelper.addEventListener(this._session, 'Runtime.executionContextCreated', event => this._onExecutionContextCreated(event.context)), eventsHelper.addEventListener(this._session, 'Runtime.executionContextCreated', event => this._onExecutionContextCreated(event.context)),
@ -445,7 +445,8 @@ export class WKPage implements PageDelegate {
this._page._frameManager.frameAbortedNavigation(frameId, 'Navigation canceled by policy check'); this._page._frameManager.frameAbortedNavigation(frameId, 'Navigation canceled by policy check');
} }
private _onFrameScheduledNavigation(frameId: string) { private _onFrameScheduledNavigation(frameId: string, delay: number, targetIsCurrentFrame: boolean) {
if (targetIsCurrentFrame)
this._page._frameManager.frameRequestedNavigation(frameId); this._page._frameManager.frameRequestedNavigation(frameId);
} }

View File

@ -33,9 +33,8 @@ it('should work with cross-process _blank target', async ({ page, server }) => {
await page.click('"Click me"'); await page.click('"Click me"');
}); });
it('should work with _blank target in form', async ({ page, server, browserName }) => { it('should work with _blank target in form', async ({ page, server }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/18392' }); it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/18392' });
it.fixme(browserName === 'webkit');
server.setRoute('/done.html?', (req, res) => { server.setRoute('/done.html?', (req, res) => {
res.end(`Done`); res.end(`Done`);
}); });