Skip to content

fix(notifications): make close handler robust against edge cases#3309

Merged
smalluban merged 1 commit into
mainfrom
fix-notifications
May 4, 2026
Merged

fix(notifications): make close handler robust against edge cases#3309
smalluban merged 1 commit into
mainfrom
fix-notifications

Conversation

@smalluban
Copy link
Copy Markdown
Collaborator

Hardens the notification iframe close path so the popup (most visibly the 30-day review notification) cannot get stuck on screen. Two edge cases could leave the wrapper in the DOM after the user clicked close: (1) after an extension update/reload, the first call in the close handler — chrome.runtime.sendMessage(CLEAR_ACTION) — throws synchronously with Extension context invalidated, aborting the rest of the cleanup; (2) the wrapper was only removed inside a transitionend listener, which never fires under prefers-reduced-motion, hidden tabs, or accessibility tooling that disables CSS transitions.

This PR wraps the CLEAR_ACTION broadcast in try/catch and replaces the transitionend listener with a setTimeout slightly longer than the 0.2s CSS transition, so cleanup always runs. Drive-by: await chrome.storage.local.set in the YouTube notification's dontAsk handler so the value is persisted before the page closes.

@smalluban smalluban requested a review from chrmod May 4, 2026 07:00
@smalluban smalluban merged commit 966d3ca into main May 4, 2026
7 checks passed
@smalluban smalluban deleted the fix-notifications branch May 4, 2026 09:24
@smalluban smalluban mentioned this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants