diff --git a/packages/puppeteer-core/src/bidi/HTTPRequest.ts b/packages/puppeteer-core/src/bidi/HTTPRequest.ts index e75bb0cf3ce..972d4fd82eb 100644 --- a/packages/puppeteer-core/src/bidi/HTTPRequest.ts +++ b/packages/puppeteer-core/src/bidi/HTTPRequest.ts @@ -68,7 +68,7 @@ export class BidiHTTPRequest extends HTTPRequest { } override resourceType(): ResourceType { - return this.initiator().type.toLowerCase() as ResourceType; + throw new UnsupportedOperation(); } override method(): string { diff --git a/packages/puppeteer-core/src/bidi/HTTPResponse.ts b/packages/puppeteer-core/src/bidi/HTTPResponse.ts index bad44ff0895..ffb2ac298a4 100644 --- a/packages/puppeteer-core/src/bidi/HTTPResponse.ts +++ b/packages/puppeteer-core/src/bidi/HTTPResponse.ts @@ -40,6 +40,12 @@ export class BidiHTTPResponse extends HTTPResponse { } #initialize() { + if (this.#data.fromCache) { + this.#request + .frame() + ?.page() + .trustedEmitter.emit(PageEvent.RequestServedFromCache, this.#request); + } this.#request.frame()?.page().trustedEmitter.emit(PageEvent.Response, this); } diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 099195fd43e..9654c4e248a 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -2645,6 +2645,12 @@ "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, + { + "testIdPattern": "[network.spec] network Network Events Page.Events.RequestServedFromCache", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "webDriverBiDi"], + "expectations": ["PASS"] + }, { "testIdPattern": "[network.spec] network Network Events Page.Events.Response", "platforms": ["darwin", "linux", "win32"],