Skip to content

Commit

Permalink
fix(webdriver): emit RequestServedFromCache for requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Mar 18, 2024
1 parent e058641 commit 9b50b46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/bidi/HTTPRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions packages/puppeteer-core/src/bidi/HTTPResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9b50b46

Please sign in to comment.