Skip to content

Normalize website access handling and harden background startup/message lifecycle#1465

Open
KillariDev wants to merge 16 commits into
mainfrom
t3code/9551112f
Open

Normalize website access handling and harden background startup/message lifecycle#1465
KillariDev wants to merge 16 commits into
mainfrom
t3code/9551112f

Conversation

@KillariDev

Copy link
Copy Markdown
Contributor

Summary

  • Normalized website access logic to operate by hostname scope, including access checks, address access checks, interceptor disable propagation, request blocking, and badge/icon state updates.
  • Added migration and preservation for website metadata, including migrated/stored icon/title handling and updated origin parsing for favicon validation.
  • Introduced robust content-script port lifecycle handling with ignorable-port detection to avoid crashes from benign disconnect/invalidated-port errors.
  • Improved startup safety by awaiting startup dependencies before handling content-script requests and migrated address book/website access data during startup.
  • Refactored shared logic into helper modules (internal provider methods, popup-or-tab utilities, website origin helpers, website icon sanitization) and updated background error logging to be more structured.
  • Expanded regression coverage with hostname scope and migration tests for address book, website access migration, origins, icon handling, and lifecycle behavior.

Testing

  • Not run: bun test
  • Not run: bun run setup-chrome
  • Not run: bun run typecheck
  • Not run: bun run lint
  • Not run: bun run test:chrome-communication
  • Not run: bun run install-chrome / browser-communication validation

- Changed website approval, interceptor disable, and request blocking checks to operate on hostname scope instead of exact origin matches
- Refactored website access popup data generation/sync into shared background helpers and updated event emission after access mutations
- Extracted internal provider method allowlist to generated shared definitions and improved RPC/popup parse error logging
- Improved interceptor sleep scheduling to avoid overlapping recursive timers
- Thread website-tab context into home data refresh requests and rebuild state using signer-account fallback checks before rendering
- Treat a signer as connected if cached accounts exist, avoiding stale `signerConnected` false negatives in the Home UI
- Add regression coverage for stale signer connection handling and vendored metadata image exposure for `@darkflorist/address-metadata`
- Add CI agent review workflow/docs for new automated review roles
- Keep signer-access helpers in `popupMessageHandlers` import list by removing merge conflict markers
- Remove commented `declarativeNetRequest.onRuleMatchedDebug` listener stub from `accessManagement`
- Replace empty catch blocks in background and utility helpers with error-aware branches
- Preserve existing fallback behavior while exposing underlying exception details in logs/results
- Keep behavior unchanged for control flow, improving debuggability of favicon, ABI, ENS, and error decoding paths
- Change ENS name normalization helper to rethrow non-`Error` parsing failures
- Change website origin parser to rethrow unexpected errors while keeping `TypeError` fallback behavior
- Add `app/ts/utils/try.ts` with `tryOrUndefined` and `tryOrFalse`
- Refactor `abiRuntime`, `ens`, and `websiteOrigins` to use shared helpers instead of duplicated try/catch blocks
- Keep revert/panic decode fallback behavior while adding warning logs for decode failures
- Normalize formatting and spacing across inpage, background, and component modules
- Improve type annotations and callback/messaging helper readability without changing runtime behavior
- Keep bridge/error diagnostics logic and extension message flows intact while making the code lint-friendly
@KillariDev

Copy link
Copy Markdown
Contributor Author

/review

- Applied broad TypeScript formatting cleanup across inpage, background, and simulation/component modules
- Collapsed verbose multiline expressions and type/constant declarations without altering logic
- Kept behavior unchanged while improving readability consistency and reducing diff noise
# Conflicts:
#	app/inpage/ts/inpage.ts
#	test/tests/inpageSignerBridge.test.ts
- Normalize whitespace style in interpolated template strings across inpage, background, UI, and simulation files
- Keep behavior unchanged while aligning code style for lint/format consistency
- Remove redundant parentheses from many single-expression arrow functions across inpage, background, and UI modules
- Simplify JSX map renderers by using compact inline child expressions
- Preserve existing behavior while applying consistent formatting and readability cleanup
- Normalize whitespace, quoting, and JSX attribute formatting across components and background services
- Reflow long type declarations and unions for readability
- Apply non-functional lint/format style cleanup without changing logic
- Simplified repetitive `onMessage`, `onConnect`, `onUpdated`, `onRemoved`, and related mock event registrations into compact object literals across many test files.
- Applied formatting cleanup only; no behavior changes to test mock implementations.
- Apply consistent parenthesized conditional and ternary expressions in touched TypeScript files.
- Reformat JSX callback returns and `map` render blocks to multiline style for readability.
- No functional behavior changes were introduced; this is a formatting-only cleanup.
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.

1 participant