aboutsummaryrefslogtreecommitdiff
path: root/extensions/chrome-profile-bridge
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/chrome-profile-bridge')
-rw-r--r--extensions/chrome-profile-bridge/index.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/extensions/chrome-profile-bridge/index.ts b/extensions/chrome-profile-bridge/index.ts
index 6156e81..158584d 100644
--- a/extensions/chrome-profile-bridge/index.ts
+++ b/extensions/chrome-profile-bridge/index.ts
@@ -1204,6 +1204,12 @@ export default function (pi: ExtensionAPI): void {
// /reload continues the same session. On exit, give Chrome a bounded opportunity to
// close this session's created tabs and ungroup adopted tabs before stopping the broker.
if (event?.reason !== "reload") await cleanupAutomationTargetBestEffort();
+ // A /chrome authorize grant belongs to this session: /reload keeps it, while /new, /resume
+ // and /fork start a different session in this process, which must not inherit it. "quit"
+ // leaves it alone: a subagent quitting in this process must not drop its parent's grant.
+ if (event?.reason === "new" || event?.reason === "resume" || event?.reason === "fork") {
+ delete globalState[PI_CHROME_AUTH_KEY];
+ }
bridge.stop();
if (globalState[PI_CHROME_GLOBAL_KEY]?.token === instanceToken) {
delete globalState[PI_CHROME_GLOBAL_KEY];