mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:51:23 +00:00
Fix #1035: refresh extension tab metadata
Handle Target.targetInfoChanged in extension relay so /json/list reflects updated title/url after navigation. Adds regression coverage.
This commit is contained in:
committed by
Peter Steinberger
parent
78a4441ac2
commit
693f152895
@@ -497,6 +497,23 @@ export async function ensureChromeExtensionRelayServer(opts: {
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep cached tab metadata fresh for /json/list.
|
||||
// After navigation, Chrome updates URL/title via Target.targetInfoChanged.
|
||||
if (method === "Target.targetInfoChanged") {
|
||||
const changed = (params ?? {}) as { targetInfo?: { targetId?: string; type?: string } };
|
||||
const targetInfo = changed?.targetInfo;
|
||||
const targetId = targetInfo?.targetId;
|
||||
if (targetId && (targetInfo?.type ?? "page") === "page") {
|
||||
for (const [sid, target] of connectedTargets) {
|
||||
if (target.targetId !== targetId) continue;
|
||||
connectedTargets.set(sid, {
|
||||
...target,
|
||||
targetInfo: { ...target.targetInfo, ...(targetInfo as object) },
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
broadcastToCdpClients({ method, params, sessionId });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user