Skip to content

Refactor FXIOS-15783 Reader mode Render webpages and set up caching for custom scheme#33908

Open
Alex-Bangu wants to merge 3 commits into
abangu/FXIOS-15780-add-readermode-schemefrom
abangu/FXIOS-15783-readermode-cache-readability
Open

Refactor FXIOS-15783 Reader mode Render webpages and set up caching for custom scheme#33908
Alex-Bangu wants to merge 3 commits into
abangu/FXIOS-15780-add-readermode-schemefrom
abangu/FXIOS-15783-readermode-cache-readability

Conversation

@Alex-Bangu
Copy link
Copy Markdown
Member

📜 Tickets

Jira ticket
Github issue

💡 Description

This pull request sets up page rendering and caching without replacing the legacy localhost implementation just yet.

ReaderModeSchemeHandler.swift:
Single router replaced with normalRouter/privateRouter so private tabs use MemoryReaderModeCache and normal tabs use DiskReaderModeCache. Router selection happens per-request based on websiteDataStore.isPersistent.

PageRoute.swift:
Expanded from a skeleton into a full TinyRoute implementation. Checks cache first via fetchOrExtract, falls back to ReadabilityService extraction on miss, renders via ReaderModeUtils.generateReaderContent, and serves an error page with a "Load Original" link on failure (might need to add a string for this).

ReadabilityService.swift:
Added ReadabilityServiceError enum (.timeout, .noResult) and an async extract method that wraps ReadabilityOperation.

ReaderModeCache.swift:
Added Sendable to the protocol so PageRoute (which conforms to Sendable via TinyRoute) can store it.

PageRouteTests.swift:
8 tests: URL param validation (3), cache-hit rendering (2), cache-miss extraction (1), extraction failure error page (1),
CSP/response builders (2).

MockReaderModeCache.swift:
Mock cache for testing

ReaderModeSchemeHandlerTests.swift:
Updated TODO comment, removed defunct test

🎥 Demos

No user-visible changes to show

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

Alex Bangu added 3 commits May 19, 2026 18:28
…d support for separate private mode and regular browsing caches, additions to ReadabilityService.swift
@Alex-Bangu Alex-Bangu requested a review from issammani May 19, 2026 23:22
@Alex-Bangu Alex-Bangu requested a review from a team as a code owner May 19, 2026 23:22
@Alex-Bangu Alex-Bangu changed the title Refactor FXIOS-15783 Reader mode Use custom reader mode scheme in webviews Refactor FXIOS-15783 Reader mode Render webpages and set up caching for custom scheme May 20, 2026
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