fix(browser): preserve uncertain main-frame navigation identity

Own CDP frame applicability and identity at the parsed event boundary. Preserve malformed or incomplete main-frame facts, recognize replacement roots, and carry the same document identity through captures, screenshots, timelines, and execution windows.

Validation: full check:ci and docs:check; 763 browser and dispatch tests passed, 6 skipped. Independent source and fixture-lifecycle review passed. Local real-Chrome behavior was not exercised.

Closes #5665
This commit is contained in:
morluto committed 2026-10-21 07:16:47 +08:00
1 parent 9dee989a79
commit 0bd14ca16c
16 files changed
+962 -179

No files matched your search

+6 -3
View File
@@ -45,6 +45,7 @@ export class CdpCaptureEvents implements CdpCaptureEventsState {
]);
originViolation = false;
navigationDuringCapture = false;
unknownRootIdentity = false;
mainFrameId: string | undefined = undefined;
committedDocument: string | undefined = undefined;
@@ -60,6 +61,7 @@ export class CdpCaptureEvents implements CdpCaptureEventsState {
this.mainFrameId = frameId;
this.originViolation = false;
this.navigationDuringCapture = false;
this.unknownRootIdentity = false;
this.committedDocument = undefined;
this.scripts.clear();
this.scriptMetadataBudgetOmissionsById.clear();
@@ -122,6 +124,10 @@ export class CdpCaptureEvents implements CdpCaptureEventsState {
}
ingest(event: CdpEvent): void {
if (event.method === "Page.frameNavigated") {
handlers.handleFrameNavigated(this, event.params);
return;
}
const params = recordValue(event.params);
if (params === undefined) return;
switch (event.method) {
@@ -158,9 +164,6 @@ export class CdpCaptureEvents implements CdpCaptureEventsState {
case "Runtime.consoleAPICalled":
handlers.handleConsoleAPICalled(this, params);
break;
case "Page.frameNavigated":
handlers.handleFrameNavigated(this, params);
break;
case "Network.webSocketCreated":
handlers.handleWebSocketCreated(this, params);
break;