Conversation
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
Contributor
There was a problem hiding this comment.
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_SUFFIXESconstant inutils.jsand addedmil,int, andschentries. - Added error handling for domain retrieval in
popup.js(renderList) and defensiveArray.isArraychecks for storage data inbackground.js, plus focus management for the status element inaddCurrentDomain. - Introduced interval deduplication logic in
background.jsto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
background.js.popup.jsfor domain retrieval failures, displaying a user-friendly error message and logging the issue.Maintainability and clarity:
SECOND_LEVEL_SUFFIXESinutils.js, allowing reuse and easier updates. [1] [2]Interval management:
background.jsby storing the interval ID globally and clearing any existing interval before setting a new one, preventing duplicate intervals.Accessibility enhancements:
popup.js, the status message element is focused and made keyboard-accessible, improving accessibility for users relying on screen readers or keyboard navigation.