fix(webdriver): emit RequestServedFromCache for requests (#12104)

This commit is contained in:
Nikolay Vitkov 2024-03-19 16:25:33 +01:00 committed by GitHub
parent 73f3f4e173
commit 6ba6bef1b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View File

@ -68,7 +68,7 @@ export class BidiHTTPRequest extends HTTPRequest {
} }
override resourceType(): ResourceType { override resourceType(): ResourceType {
return this.initiator().type.toLowerCase() as ResourceType; throw new UnsupportedOperation();
} }
override method(): string { override method(): string {

View File

@ -40,6 +40,12 @@ export class BidiHTTPResponse extends HTTPResponse {
} }
#initialize() { #initialize() {
if (this.#data.fromCache) {
this.#request
.frame()
?.page()
.trustedEmitter.emit(PageEvent.RequestServedFromCache, this.#request);
}
this.#request.frame()?.page().trustedEmitter.emit(PageEvent.Response, this); this.#request.frame()?.page().trustedEmitter.emit(PageEvent.Response, this);
} }

View File

@ -2645,6 +2645,12 @@
"expectations": ["FAIL"], "expectations": ["FAIL"],
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" "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", "testIdPattern": "[network.spec] network Network Events Page.Events.Response",
"platforms": ["darwin", "linux", "win32"], "platforms": ["darwin", "linux", "win32"],