From e1606acfc800ab067ec5a8db336a70dba57b0827 Mon Sep 17 00:00:00 2001 From: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com> Date: Fri, 26 Apr 2024 12:28:11 +0200 Subject: [PATCH] fix(webdriver): redirects emitting events (#12338) --- packages/puppeteer-core/src/bidi/HTTPRequest.ts | 11 +++++++++++ test/TestExpectations.json | 7 ------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/puppeteer-core/src/bidi/HTTPRequest.ts b/packages/puppeteer-core/src/bidi/HTTPRequest.ts index 30ed807e8b5..923a82726e3 100644 --- a/packages/puppeteer-core/src/bidi/HTTPRequest.ts +++ b/packages/puppeteer-core/src/bidi/HTTPRequest.ts @@ -67,6 +67,17 @@ export class BidiHTTPRequest extends HTTPRequest { #initialize() { this.#request.on('redirect', request => { const httpRequest = BidiHTTPRequest.from(request, this.#frame, this); + request.once('success', () => { + this.#frame + .page() + .trustedEmitter.emit(PageEvent.RequestFinished, httpRequest); + }); + + request.once('error', () => { + this.#frame + .page() + .trustedEmitter.emit(PageEvent.RequestFailed, httpRequest); + }); void httpRequest.finalizeInterceptions(); }); this.#request.once('success', data => { diff --git a/test/TestExpectations.json b/test/TestExpectations.json index c0f3ae17ab0..7dc29e6e89f 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -4087,13 +4087,6 @@ "expectations": ["FAIL", "PASS"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, - { - "testIdPattern": "[network.spec] network Network Events should support redirects", - "platforms": ["linux"], - "parameters": ["chrome", "headless", "webDriverBiDi"], - "expectations": ["FAIL"], - "comment": "Fix in next PR" - }, { "testIdPattern": "[network.spec] network raw network headers Same-origin set-cookie subresource", "platforms": ["darwin", "linux", "win32"],