fix: cover relay reannounce minimal target path (#27630) (thanks @markmusson)

This commit is contained in:
Peter Steinberger
2026-03-02 06:32:14 +00:00
parent 591ff3c1c8
commit 18cd77c8ce
2 changed files with 29 additions and 0 deletions

View File

@@ -439,6 +439,34 @@ describe("chrome extension relay server", () => {
cdp.close();
});
it("accepts re-announce attach events with minimal targetInfo", async () => {
const { ext } = await startRelayWithExtension();
ext.send(
JSON.stringify({
method: "forwardCDPEvent",
params: {
method: "Target.attachedToTarget",
params: {
sessionId: "cb-tab-minimal",
targetInfo: {
targetId: "t-minimal",
},
waitingForDebugger: false,
},
},
}),
);
const list = await waitForListMatch(
async () =>
(await fetch(`${cdpUrl}/json/list`, {
headers: relayAuthHeaders(cdpUrl),
}).then((r) => r.json())) as Array<{ id?: string }>,
(entries) => entries.some((entry) => entry.id === "t-minimal"),
);
expect(list.some((entry) => entry.id === "t-minimal")).toBe(true);
});
it("waits briefly for extension reconnect before failing CDP commands", async () => {
const { port, ext: ext1 } = await startRelayWithExtension();
const cdp = new WebSocket(`ws://127.0.0.1:${port}/cdp`, {