Skip to content

Commit fb8a0de

Browse files
authored
feat(consent): log where the consent window was opened (#107)
#106 made a window that cannot be created a logged denial. The remaining blind spot is the opposite case: creation succeeds, a window id comes back, and the user still sees nothing. Those two are indistinguishable from the outside -- "no popup, no errors" -- and that ambiguity is exactly what made the silent hang take days to find. A window id proves creation succeeded; it does not prove the window is visible. consentWindowBounds derives left/top from chrome.windows.getLastFocused(), so a minimised window, a second display, or an undocked DevTools window can place the prompt somewhere the user never looks. Logging the id and the computed bounds makes "I see no popup" answerable: either no line (never reached creation), the #106 error (creation failed), or a line naming coordinates that can be checked against the actual displays. Logging only; no behaviour change. Both consent surfaces. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
1 parent 9af5cda commit fb8a0de

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

packages/extension/src/background.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,18 @@ async function requestConsent(args: {
592592
settle(false, false);
593593
return;
594594
}
595+
// A window id proves creation succeeded; it does NOT prove the window is
596+
// visible. `consentWindowBounds` derives left/top from
597+
// `chrome.windows.getLastFocused()`, so a minimised window, a second
598+
// display, or an undocked DevTools window can place the prompt somewhere
599+
// the user never looks — and that is indistinguishable from no prompt at
600+
// all, which is precisely the ambiguity that made the silent hang above
601+
// so hard to find. Log where it went so "I see no popup" is answerable.
602+
console.info(
603+
"[pnm consent] consent window opened",
604+
"id=", winId,
605+
"bounds=", JSON.stringify(bounds),
606+
);
595607
// Closing the window without a decision is a denial.
596608
const onClosed = (closedId: number) => {
597609
if (closedId === winId) {
@@ -678,6 +690,18 @@ async function requestTaskConsent(
678690
settle(false);
679691
return;
680692
}
693+
// A window id proves creation succeeded; it does NOT prove the window is
694+
// visible. `consentWindowBounds` derives left/top from
695+
// `chrome.windows.getLastFocused()`, so a minimised window, a second
696+
// display, or an undocked DevTools window can place the prompt somewhere
697+
// the user never looks — and that is indistinguishable from no prompt at
698+
// all, which is precisely the ambiguity that made the silent hang above
699+
// so hard to find. Log where it went so "I see no popup" is answerable.
700+
console.info(
701+
"[pnm consent] consent window opened",
702+
"id=", winId,
703+
"bounds=", JSON.stringify(bounds),
704+
);
681705
// Closing the window without deciding is a denial. Never assent: silence
682706
// is not agreement, and a task-consent prompt that timed out into an
683707
// approval would be the single worst bug in this system.

0 commit comments

Comments
 (0)