Skip to content

Commit aaa3808

Browse files
committed
Release claims on initial visibility exit
1 parent d27bcb3 commit aaa3808

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/chrome/src/ui/sidepanel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7119,6 +7119,7 @@ async function sendMessage(extraChatParams = {}) {
71197119
&& sameTabId(currentTabId, tabId)
71207120
&& sameTabId(renderedTabId, tabId);
71217121
if (!renderToCurrentTab) {
7122+
await releaseOwnedContextMenuClaim();
71227123
if (text) saveInputDraftForTab(tabId, text);
71237124
return false;
71247125
}

src/firefox/src/ui/sidepanel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6852,6 +6852,7 @@ async function sendMessage(extraChatParams = {}) {
68526852
&& sameTabId(currentTabId, tabId)
68536853
&& sameTabId(renderedTabId, tabId);
68546854
if (!renderToCurrentTab) {
6855+
await releaseOwnedContextMenuClaim();
68556856
if (text) saveInputDraftForTab(tabId, text);
68566857
return false;
68576858
}

test/run.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21939,8 +21939,13 @@ test('context-menu ownership and stale-panel persistence guards are wired in bot
2193921939
const sendMessageBody = panel.slice(sendMessageStart, sendMessageEnd);
2194021940
assert.equal(
2194121941
(sendMessageBody.match(/await releaseOwnedContextMenuClaim\(\);/g) || []).length,
21942-
3,
21943-
`${label}: visibility exits after preflight and renewal should release the claim and schedule retry`,
21942+
4,
21943+
`${label}: every visibility exit should release the claim and schedule retry`,
21944+
);
21945+
assert.match(
21946+
sendMessageBody,
21947+
/if \(!retryOptions\) text = await parseSlashCommands\(text, tabId, \{ permissionSkipContext \}\);[\s\S]*?if \(!renderToCurrentTab\) \{\s*await releaseOwnedContextMenuClaim\(\);/,
21948+
`${label}: the first visibility failure after refresh and command parsing should relinquish initial ownership`,
2194421949
);
2194521950
assert.match(
2194621951
sendMessageBody,

0 commit comments

Comments
 (0)