aboutsummaryrefslogtreecommitdiff
path: root/extensions/chrome-profile-bridge/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/chrome-profile-bridge/index.ts')
-rw-r--r--extensions/chrome-profile-bridge/index.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/extensions/chrome-profile-bridge/index.ts b/extensions/chrome-profile-bridge/index.ts
index 8a5e02d..aefdb89 100644
--- a/extensions/chrome-profile-bridge/index.ts
+++ b/extensions/chrome-profile-bridge/index.ts
@@ -604,7 +604,14 @@ class ChromeProfileBridge {
this.queue = [];
for (const waiter of this.waiters) waiter(undefined);
this.waiters = [];
- this.server?.close();
+ // close() refuses new connections but leaves open the ones that are busy at this moment, and
+ // Chrome sends the extension's next /next on such a connection once it goes idle. The stopped
+ // bridge then answered those polls forever, while commands waited in the new owner, which never
+ // heard from Chrome (2026-11-20). Drop them all, after the answers above are written, so the
+ // extension reconnects to whoever owns the port next.
+ const server = this.server;
+ server?.close();
+ if (server) setImmediate(() => server.closeAllConnections());
this.server = undefined;
this.mode = undefined;
}
@@ -1289,7 +1296,7 @@ Usage rules:
7. If you hit a native file-picker or privileged browser prompt gate, tell the user; generic clicks/typing/CSP gates are handled by Chrome input.
8. Run /chrome doctor when in doubt about connectivity or capabilities.
9. A page can open dialogs you cannot see: alert, confirm, prompt, and the \"Leave site? Changes you made may not be saved\" prompt of a page with unsaved changes. They are dismissed for you (stay, cancel). \`chrome_navigate\` reports one by failing, and \`leaveIfAsked: true\` leaves anyway; use that only when you know nothing unsaved matters, and ask the user when unsure. If a click or key press that should have navigated did nothing, a Leave-site prompt may have stopped it: check the page, then ask the user before discarding anything.
-10. Your tabs open in the user's Brave window, inactive, in your session's own tab group (collapsed to one label). An inactive tab takes clicks, typing and screenshots normally, so you do not need it showing. Reuse your tab (navigate it) rather than opening new ones, and close tabs you opened when you are done with them. Do not open new windows unless the user asks.
+10. Your tabs open in the user's browser window, inactive, in your session's own tab group (collapsed to one label). An inactive tab takes clicks, typing and screenshots normally, so you do not need it showing. Reuse your tab (navigate it) rather than opening new ones, and close tabs you opened when you are done with them. Do not open new windows unless the user asks.
11. If a tool fails saying another extension (a password manager such as 1Password) has a prompt open on the tab, decide whether it is in your way or part of the task. If it is just in your way, call \`chrome_clear_overlay\` for the tab. If you need the user to sign in, authorize or approve something with it, leave it alone and tell the user what you are waiting for. Navigating the tab away also frees it.`;
// Shared handlers, dispatched by the unified /chrome command below.