fix(firefox): properly handle navigations (#27132)

In firefox, the `frameRequestedNavigation` is coming from renderer and
thus can happen **after** the `Network.requestWillBeSent`, which is
dispatched from the browser process.

Fixes https://github.com/microsoft/playwright/issues/24132
This commit is contained in:
Andrey Lushnikov 2023-09-18 17:01:19 -07:00 committed by GitHub
parent 6b36a50969
commit 94e272ba0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,7 +200,9 @@ export class FrameManager {
// Do not override request with undefined. // Do not override request with undefined.
return; return;
} }
frame.setPendingDocument({ documentId, request: undefined });
const request = documentId ? Array.from(frame._inflightRequests).find(request => request._documentId === documentId) : undefined;
frame.setPendingDocument({ documentId, request });
} }
frameCommittedNewDocumentNavigation(frameId: string, url: string, name: string, documentId: string, initial: boolean) { frameCommittedNewDocumentNavigation(frameId: string, url: string, name: string, documentId: string, initial: boolean) {