Skip to content

Dedupe the near-identical favicon cursor walks in lib/messages.js #17

Description

@perdrizat

webextension/lib/messages.js's Thumbnails.getFavicons (around line 181) and Thumbnails.getFaviconsByHost (around line 214) each implement a near-identical cursor-walk over the favicon store — one keyed by exact URL, the other by registrable host. Flagged opportunistically during the Stage-M review; never scheduled.

Task

Extract the shared cursor-walk logic (open cursor, iterate, match/accumulate, stop condition) into a single helper parameterized by the key-matching predicate (exact URL vs. registrable-host), and have both getFavicons and getFaviconsByHost call it.

Notes

  • Behavior-preserving refactor only — both wire names (Thumbnails.getFavicons, Thumbnails.getFaviconsByHost) are among the 19 frozen runtime.onMessage names (tests/integration/message-contract.test.ts) and must not change shape.
  • Follow the project's TDD workflow: characterization tests for both handlers' current behavior first (if not already fully covered), then refactor under green.
  • Low risk, small diff — good first-timer or low-priority backlog item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions