Refactor/extension scoring#77
Merged
Merged
Conversation
…ciency. Ensure requestId is mandatory for responses and streamline response structure. Enhance error handling for better debugging.
…endencies. Introduce a Bill of Materials document detailing project components and dependencies. Add unit tests for the Extension's scan functionality, improving test coverage and reliability. Update constants and message handling for better performance and error management.
Collaborator
|
Only thing of note so far was long load times, which could be caused by some API's being down with NetStar |
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 PR improves extension scan performance and simplifies the popup/background flow. The background now uses a single request/response for getCurrentTab (return true + sendResponse) instead of the previous two-message pattern, so the popup no longer hits 15s/10s timeouts or races when the service worker wakes. Both scanUrl and getCurrentTab call sendResponse as soon as getCachedOrScan resolves, then run icon/recent-scans/notifications in a fire-and-forget block so the popup is unblocked immediately. Scan requests use an AbortController with a 10s timeout so a slow server doesn’t hang the extension. HomeTab is simplified to one sendMessage plus a 12s timeout (no requestId, listener, or retry).
A new Jest suite in Extension/tests/scan.test.js covers performSecurityScan (success, URL normalization, aggregatedScore fallback, timeout/abort, network error) and getCachedOrScan (cache hit/miss/expired, in-flight deduplication), with fetch and chrome.storage mocked. CI now runs Extension unit tests on every push/PR. HomeTab logs a single end-to-end metric in the popup console: [NetSTAR][timing] popup: getCurrentTab end-to-end X ms. Extension and Server test suites pass; manual checks (cold start, manual scan, cache hit, timeout) should show faster response and no long freezes.