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.
webextension/lib/messages.js'sThumbnails.getFavicons(around line 181) andThumbnails.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
getFaviconsandgetFaviconsByHostcall it.Notes
Thumbnails.getFavicons,Thumbnails.getFaviconsByHost) are among the 19 frozenruntime.onMessagenames (tests/integration/message-contract.test.ts) and must not change shape.