Repository navigation
Conversation
This branch has not been deployed
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.
Why
Apps need to disable publication JavaScript before the first page loads while keeping Readium's injected scripts available. WebKit's content JavaScript preference preserves user scripts and application evaluation.
What changed
Add
EPUBNavigatorViewController.Configuration.allowsContentJavaScript, defaulting totrue, and apply it before each spread constructs its WebView. Existing callers retain the current behavior.The regression opens an XHTML publication through a real reflowable spread in the existing navigator app host. It waits for Readium's spread-loaded event. It checks that a parse-time script changes visible text when enabled and leaves the original text intact when disabled. Readium's injected script must still complete spread loading, and application evaluation must still call Readium's CSS API.
Scope
This patch is based on 3.11.0 for an explicitly pinned OpenRead integration. We offer the configuration hook upstream. No script sanitizer, runtime toggle, stored preference, or application-specific behavior is added.
Verification
Passed all three hosted cases on an iPhone 18 Pro simulator with iOS 27.0: disabled, enabled, and enabled by default. Readium injection and application evaluation worked in each case. Without the enforcement assignment, the disabled case failed on the publication script's text mutation and both positive controls passed. Native result bundles were inspected. SwiftFormat 0.61.1 lint and
git diff --checkpassed.Generate the existing test project with
make navigator-ui-tests-project, then runxcodebuild test -project Tests/NavigatorTests/UITests/NavigatorUITests.xcodeproj -scheme NavigatorTestHost -destination 'platform=iOS Simulator,name=Readium H3-6A' -only-testing:ContentJavaScriptTests/ContentJavaScriptTests -parallel-testing-enabled NO -collect-test-diagnostics never.This draft offers the patch tested against 3.11.0. Current develop integration, whole-app behavior, and fixed-layout publication qualification remain separate.