Skip to content

Enhance exception handling and improve second level suffixes#91

Merged
ormidales merged 17 commits intomainfrom
1.0.5
Mar 7, 2026
Merged

Enhance exception handling and improve second level suffixes#91
ormidales merged 17 commits intomainfrom
1.0.5

Conversation

@ormidales
Copy link
Copy Markdown
Owner

This pull request introduces improvements for robustness, accessibility, and maintainability in the extension’s codebase. The main changes include safer handling of domain storage and retrieval, improved interval management for cleaning up stale requests, enhanced accessibility feedback in the popup UI, and refactoring for better code reuse and clarity.

Robustness improvements:

  • Ensured that domain lists loaded from storage are always arrays, preventing errors from malformed or missing data in background.js.
  • Added error handling in popup.js for domain retrieval failures, displaying a user-friendly error message and logging the issue.

Maintainability and clarity:

  • Moved the list of second-level suffixes to a shared constant SECOND_LEVEL_SUFFIXES in utils.js, allowing reuse and easier updates. [1] [2]

Interval management:

  • Improved cleanup interval handling in background.js by storing the interval ID globally and clearing any existing interval before setting a new one, preventing duplicate intervals.

Accessibility enhancements:

  • After adding a domain in popup.js, the status message element is focused and made keyboard-accessible, improving accessibility for users relying on screen readers or keyboard navigation.

Copilot AI and others added 17 commits March 6, 2026 13:20
Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
…xception-domains

Guard exception domains initialization against non-array storage values
Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
…uffixes

Extend secondLevelSuffixes with mil, int, sch
…rage API failures

Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
…ns-popup

fix: handle storage API failures in renderList to prevent frozen loading state
Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
…rInterval

Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
…mory-issue

fix: prevent duplicate cleanup intervals on background script reload
…lock

Co-authored-by: ormidales <46538211+ormidales@users.noreply.github.com>
…-loss

fix(a11y): restore keyboard focus after addCurrentDomain
@ormidales ormidales added this to the v1.0.5 milestone Mar 7, 2026
@ormidales ormidales self-assigned this Mar 7, 2026
@ormidales ormidales marked this pull request as ready for review March 7, 2026 11:59
Copilot AI review requested due to automatic review settings March 7, 2026 11:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves robustness, maintainability, and accessibility across the TruePath browser extension. It adds defensive error handling for domain storage operations, extracts a shared constant for second-level domain suffixes (with three new entries), prevents duplicate cleanup intervals in the background script, and enhances keyboard/screen-reader accessibility in the popup.

Changes:

  • Moved second-level suffix list to a shared SECOND_LEVEL_SUFFIXES constant in utils.js and added mil, int, and sch entries.
  • Added error handling for domain retrieval in popup.js (renderList) and defensive Array.isArray checks for storage data in background.js, plus focus management for the status element in addCurrentDomain.
  • Introduced interval deduplication logic in background.js to prevent stacking cleanup intervals.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
utils.js Extracted SECOND_LEVEL_SUFFIXES to a module-level Set constant and added mil, int, sch
popup.js Added try-catch in renderList for domain retrieval failures; added #status focus management in addCurrentDomain's finally block
background.js Added interval deduplication for cleanupStaleTrackedRequests; added Array.isArray guard when loading exception domains from storage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ormidales ormidales merged commit 06ac78b into main Mar 7, 2026
4 checks passed
@ormidales ormidales deleted the 1.0.5 branch March 7, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants