Refactor FXIOS-15783 Reader mode Render webpages and set up caching for custom scheme#33908
Open
Alex-Bangu wants to merge 3 commits into
Conversation
added 3 commits
May 19, 2026 18:28
…d support for separate private mode and regular browsing caches, additions to ReadabilityService.swift
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.
📜 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