Skip to content

fix(android): block initial URL load in sandbox mode#19

Merged
janicduplessis merged 1 commit intomasterfrom
@janic/sandbox-block-initial-load-master
Apr 16, 2026
Merged

fix(android): block initial URL load in sandbox mode#19
janicduplessis merged 1 commit intomasterfrom
@janic/sandbox-block-initial-load-master

Conversation

@janicduplessis
Copy link
Copy Markdown
Collaborator

Description

PR #16 was merged into rainbow-customizations-part1 by mistake, so this replacement PR carries the same Android sandbox fix directly onto master.

When a WebView is in sandbox mode, Android does not call shouldOverrideUrlLoading for the initial source URL. That lets a blocked host render as the first page load even though later navigations are checked against the allowlist.

Solution

This adds the allowlist check to onPageStarted and emits onReceivedError when the initial URL is blocked, so the initial load path behaves the same way as the existing blocked-navigation path.

Test plan

shouldOverrideUrlLoading doesn't fire for the initial source URL, so
sandboxed WebViews could load blocked domains as their first page.

Added host allowlist check in onPageStarted — if the domain isn't
allowed, stops loading and emits onReceivedError so the JS onError
callback fires.
@janicduplessis janicduplessis merged commit 4d83973 into master Apr 16, 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