Skip to content

feat(mobile): render the HTML preview on the page in a sealed srcdoc frame (OTA phase C, C7.10 A) - #21862

Merged
Jinwoo-H merged 31 commits into
mainfrom
ota-c7-10a-html-preview
Sep 21, 2026
Merged

Jinwoo-H merged 31 commits into
mainfrom
ota-c7-10a-html-preview

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase C, C7.10 PR A (ruling 26: the OTA page loses no capability; rulings 29 as amended): the HTML preview renders on the page. MobileHtmlPreview.web.tsx keeps the native component's Preview/Source toggle and renders Preview in an <iframe> whose srcdoc is the artifact and whose sandbox is the single token allow-top-navigation-by-user-activation: no scripts, no same-origin, so the artifact is an opaque-origin document that can run nothing, reach nothing, and cannot message the shell (the bridge refuses non-main-frame senders on both platforms). Inert: no route serves the preview until C7.7; native screen unchanged; released RPCs unchanged; BRIDGE_PROTOCOL_VERSION unchanged.

No CSP change. Measured in the render rig on Chromium and WebKit under the header the shell ships (design-ota-c7-10.md item A, 48 cases): a srcdoc frame is admitted under frame-src 'none' because it has no URL to match and inherits its embedder's policy, while blob: is refused under 'none' and 'self' and, under frame-src blob:, commits blank on WebKit for a second directive (frame-ancestors). Inheritance also seals the box twice over: with allow-scripts deliberately granted in a probe, the artifact's inline script still never ran under script-src 'self'; remote <img>, CSS background and @font-face fetched nothing; target="_top" without the token left the top frame where it was. Controls with no header showed the script running, the fetch landing and the top frame moving, so the instrument sees each harm it reports absent.

Tapped links open externally, as they do natively (ruling 29 amended). The sealed box cannot see a tap, but the user-activation token turns a tapped <a> into a top-frame navigation request. Neither shell opened such a request: iOS MobileWebShellView.swift allowed only the document URL and cancelled the rest silently, Android MobileWebShellNavigationPolicy.kt dropped anything whose path is not /. 048db51441 adds the rule on both shells: a cancelled main-frame navigation reaches JS as an onExternalNavigation event and goes through the same Linking.openURL path and scheme list (readBridgeExternalLinkUrl) the externalLink notify already uses, so the allowed schemes stay in the half that updates over the air. Native tests: MobileWebShellDroppedNavigationTest.kt (9 cases at the head, gradle XML failures="0" errors="0", 54 across the module's 9 classes), MobileWebShellChecks.swift (swiftc clean); neither has a CI job.

Sandbox matrix (config/scripts/mobile-web-app-html-preview-render.test.mjs, foreign and own-origin requests intercepted and counted): a user click on target="_top" → exactly 1 top-frame navigation on both engines; target="_blank", <meta http-equiv="refresh">, and a click on a target="_top" form submit → 0 on both. Script-running controls: window.top.location throws SecurityError, an auto-submitting form navigates nothing, a click still navigates, and without the token even a click gives 0. The inline script runs in no arm under the shipped header, including with allow-scripts granted; the seal's two fences are measured separately. Red-first: a literal sandbox string in the JSX reds 4 cases; adding allow-scripts reds the script fence and the token census (lead-reproduced).

Round 1 (fresh) found one blocking defect, folded (bb26edf7c1): <a href="/" target="_top"> and href="" resolve to the document URL, which both shells allowed as a main-frame navigation, so one tap reloaded the shell page and dropped its state. Now a navigation a human started is never allowed whatever it names: allow and offer are one verdict function per platform (MobileWebShellNavigationPolicy.verdict, mobileWebShellNavigationVerdict; the gesture is .linkActivated on iOS, request.hasGesture() on Android), the offer is gated on that same gesture so a top-page meta refresh or redirect is cancelled and never opened, and iOS's early shouldPerformDownload return is gone so a gesture-started download reaches the opener on both. Native red-first: the Swift control exits 133 with the gesture rule removed; Kotlin 8 tests / 0 failures. The rig now counts own-origin top-frame navigations and pins that href="/" and href="" each produce exactly one (which the shell refuses), while a foreign tap and a meta refresh produce none of those. A tap on /h/other is cancelled and dropped by the scheme list; #hash is same-document; javascript: produces nothing.

Round 2 (delta) hardened the reload refusal so it does not depend on the host reporting a gesture (a95b24f31a). Measured on a real WKWebView off-device, logging every decidePolicyFor: the shell's own load arrives with target and source both the main frame; a sandboxed subframe navigating the top frame to the document URL arrives with the subframe as source, type .other, and no gesture at all, which the gesture rule alone would have allowed. Census first: nothing in the page's web files or web entry navigates the top frame (no location assignment, reload or replace, no window.open, no form; the only history call is replaceState in the web entry), so the rule needs no page cooperation. iOS raises a flag around its own load; a main-frame navigation is allowed only while it is up, everything else naming the document is refused and never offered (offering the shell's own URL would send the user out of the app), and a foreign one is refused and offered only with the gesture. iOS adds the sourceFrame discriminator. Android has no own-load window at all: WebViewClient.shouldOverrideUrlLoading is, per its AOSP javadoc, "not called for navigations which the app initiated with loadUrl()", so the shell's own load never reaches the policy and everything naming the document is refused there (round 3 removed the Android raise that guarded nothing; the javadoc is quoted in the policy). Native tests written first on both platforms (they failed to compile against the old signature). The rig's meta-refresh arm now refreshes to / and pins zero top-frame requests on a counter the href="/" case proves reads 1, with controls attributing the frame's containment to two fences either of which holds alone (the opaque origin and the shipped frame-src 'none'); the 600 ms clock is gone (a navigation arm returns when the route handler records it; an absence arm waits two painted frames plus a bounded popup drain, insurance against runner load rather than a fix for a failure seen).

CI on chromium after the merges of main (two attempts on 86d3396baa, two reds each, different sets): the two-fences loose arm read window.__ran before the inline script had run, because its readiness wait was for the marker element's attachment rather than the script's own write; and the meta-refresh arm's inner 15 s deadline expired under a job that now runs eleven browser-driving files in parallel. The first is a real rig gap, reproduced deterministically (6d07f692f3); the second is retired by running every wait to the case's own timeout (6d78e8c95a). Nothing in main reaches the page the rig loads (its entry imports the preview component only; the two shared inputs are byte-identical to the last green run). The whole mobile-web-app- family at default parallelism passed three of three runs on this head (311 tests, all 18 preview cases, no diagnostic line), on an 18-core machine that cannot reproduce the runner's two-core contention; no serialisation is proposed.

Render check counts (the file's own, not the design probe's): 7 cases per engine, 13 mount arms per engine, 2 no-header control arms, 2 sandbox-override arms, 3 script arms of which 2 run under the shipped header, plus 2 standalone policy cases = 16 tests. The rig waits for the child frame's own load before any oracle read (c758faf0bc; a 2.5 s mount delay standing in for a loaded CI runner failed the paint case on both engines before and passes after), which is what the first CI run tripped on.

Native parity, three differences all in the safer direction: the native preview runs the artifact's scripts and loads its remote images and fonts inside a separate content process; the page does neither, having no second process to contain them. Links open externally on both, and the Preview/Source toggle announces its selected side to assistive technology on both (9de29a7b5f, the two toolbars character-identical).

CI on the runner's Chrome 152 (93330b2de7 diagnostics, ea85d7cf5e fix). After the readiness and deadline folds, two chromium arms still timed out only on CI: the two-fences control (no header, allow-scripts) and the meta-refresh control (no header, allow-same-origin allow-top-navigation). The per-frame diagnostic showed the srcdoc frame present and parsed on the runner (readyState complete, marker true, 868 / 549 body chars) with the script never run, no navigation, and no violation anywhere, which is what a sandbox without those tokens does. Both arms are the rig's override arms, and the rig relaxed the sandbox on the product's live, already-loaded iframe and reassigned srcdoc. Chromium 147 (local Playwright) honours the relaxed flags on that re-navigation; Chrome 152 keeps the browsing context's original flags and still parses the new document, so every header-keeping arm passed on 152 because the sandbox held, not the CSP. The product never relaxes a live frame (React sets the attribute before insertion), so this was the rig. The control frame is now built fresh with the widened sandbox from creation; with that widening disabled, both engines reproduce CI's 180 s timeouts. And the header-keeping override arm now proves its frame was widened before crediting the policy: it asserts the script-src violation was raised inside its own frame.

Round 3 (delta) and the bot pass. The own-load flag moved from a field the view had to remember into the load state machine, which every ending already runs through on both platforms (commit, failure, dead renderer, prop update, reset), so the failed prop update and process death drop it by construction (9f4e15b038; red-first, both platforms' rows failed to compile). CodeRabbit then found the window the endings leave open: WebKit can decide a second main-frame action before the first commits, and nothing had spent the flag, so the .allow decision spends it now and the endings still drop it for a load that never commits (e989bafbe5; a composed machine-plus-policy check allows once and refuses the same action again). The document branch covers a download, so <a href="/" download> is refused from either frame, gesture or not, and never offered (9d0185b968; Swift exited 133, the Kotlin row failed). The rig's marker wait is bounded inside the case timeout and on expiry reports the frame's URL, the srcdoc length and the page's violation list, which tells a policy refusal from a slow runner; no other read in the file rests on a frame URL, and the about:srcdoc reading CI's Chrome disagreed with is no longer consulted (303960eb22). Both single-fence arms run (a1329026a8): with the sandbox token alone the meta refresh never starts (no request, no violation); with the policy alone and allow-same-origin it starts and frame-src refuses it, reported as the embedder's violation; the engines leave different things in the frame (chromium an error page, WebKit the artifact), so only the absent request is asserted. Every arm settles before its counters are read (9aa2e13da6): the sealed refresh arms take the bounded no-navigation path and the loose arm waits for a recorded navigation that is neither main-frame nor foreign (with settling removed and the refresh moved to 2 s the loose arm reads 0 on both engines; at 0.4 s it passed either way, which is why the gap was invisible).

Native test counts (lead reproduction): Kotlin 55 @Test across nine files, of which 10 dropped-navigation and 11 load-state; the Swift checks run as one executable.

Commits (3 + round-1 and bot folds):

commit what
048db51441 feat(mobile): offer a cancelled top-frame navigation to the shell's opener
17ba967521 feat(mobile): render the HTML preview in a sealed srcdoc frame on the page
2caf1872a3 test(mobile): pin the preview's sealed frame where the degradation was pinned
40708f889f merge of origin/main (2524737ef0)
bb26edf7c1 fix(mobile): refuse a link-activated top-frame navigation, even to the document (round 1 F1, F5, F6)
9325dae503 test(mobile): count own-origin top-frame navigations, and drop the goto cap (round 1 F2, F1's page side)
c758faf0bc test(mobile): wait for the preview frame's own load, never a clock (CI chromium race)
1623a3a7c6 docs(mobile): say whose violations the preview rig reads (pullfrog)
9de29a7b5f fix(mobile): announce which side of the preview toggle is showing (CodeRabbit; native and page identical)
95ccf607fb test(mobile): type the WebView mock like the file's other hosts
a95b24f31a fix(mobile): allow a main-frame navigation only while the shell's own load is up (round 2)
9f2738e3d0 test(mobile): pin an own-origin meta refresh and attribute the frame's containment (round 2)
db37673f5e, 66960080d4 test(mobile): read absences after a completion signal, not a clock (round 2)
303960eb22 test(mobile): bound the marker wait and report what the frame holds when it expires (CI chromium)
a1329026a8 test(mobile): run both single-fence arms and assert only the absent request (round 3)
9d0185b968 fix(mobile): refuse a download naming the shell's own document (round 3)
9f4e15b038 fix(mobile): drop the own-load flag wherever a document ends (round 3)
e989bafbe5 fix(mobile): spend the own-load flag on the allow, not on the commit (CodeRabbit)
0ab10711f7 fix(mobile): stop raising an own-load flag Android never consults (CodeRabbit)
9aa2e13da6 test(mobile): settle every arm, not only the ones that tap (CodeRabbit)
36eab6eed1 GitHub merge of origin/main (8a3a119052)
acfb872bce merge of origin/main (e9b180685b, PR E haptics and PR B mermaid); one conflict in MobileWebShellScreen.tsx resolved as a union: this PR's openUrlForPage opener (main's inline body hoisted so the cancelled-navigation path and the externalLink notify share it) beside main's onHaptic: playPageHaptic
86d3396baa GitHub merge of origin/main (2d697a4012)
6d07f692f3 test(config): per-arm readiness in the preview rig — the two-fences control waits for what the inline script writes, not for #marker being attached (CI's expected +0 to be 1 at :443 reproduced on demand with the write delayed 1.5 s; passes with the delay under the new arm)
6d78e8c95a test(config): the rig's waits run to vitest's abort signal instead of two inner 15 s clocks; on abort the reading is printed (frame URL, srcdoc length, violation list) and the case fails as the timeout it declared (CI's waitForRecordedNavigation red at :728)
49d7363aa7 merge of origin/main (5d13a70ea3, C2.9): no conflict; the opener, onExternalLink, onHaptic and the onExternalNavigation prop read back unchanged
93330b2de7 test(mobile): diagnostic only — on timeout print the browser version, the iframe element's srcdoc length and sandbox, its content document's readyState and location, and every frame's url, readyState, body length, marker, script flag and own violation list; diagnosis split into mobile-web-app-preview-frame-diagnosis.mjs (the test file was at 600 lines)
ea85d7cf5e test(mobile): build a widened control frame instead of relaxing a live one — __mount's override path clones the product's iframe, sets the widened sandbox on the clone, gives it the artifact and replaces the live frame; the header-keeping override arm now asserts a script-src violation raised inside its own frame, which can only happen if the sandbox let the script start; version read once at open, reading sampled at once and every 5 s
fca290f39c fix(mobile): aria-selected beside accessibilityState on both toolbar tabs (CodeRabbit; react-native-web never reads accessibilityState, measured null before)

Verification

Lead gate on fca290f39c (diagnostic, control-frame fix, aria-selected) against 5d13a70ea3 (verify-gates.sh, four artifacts rebuilt): tsc 0, tests-typecheck ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 9 changed files 0, machine paths 0; config/scripts 241 files / 2,193 passed, 0 failed; mobile 775 files / 8,678 passed, 6 skipped, 0 failed. The preview file is 18 of 18 locally on chromium 147 and WebKit; the runner's Chrome 152 is the reading that decides, and CI on this head is it.

Lead gate on 49d7363aa7 (rig folds + merges of main through 5d13a70ea3) against 5d13a70ea3 (verify-gates.sh, four artifacts rebuilt): tsc 0, ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 8 changed files 0, machine paths 0; config/scripts 241 files / 2,193 passed, 0 failed; mobile 775 files / 8,678 passed, 0 failed.

Lead gate on acfb872bce (merge of main e9b180685b) against e9b180685b (verify-gates.sh, four artifacts rebuilt): tsc 0, ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 8 changed files 0, machine paths 0; mobile 775 files / 8,665 passed, 0 failed; config/scripts 237 passed + two reds neither this PR's: the owner-loss timing flake in an untouched file (green alone, 21/21) and main's own session-closure pin (expected [ …(4324) ] to have a length of 4323, PR E's bridge-haptics-notify.ts joined the closure after PR B pinned it; fixed on main by #21908, which this PR's next merge of main carries). The lane reproduced the same attribution independently: main alone at e9b180685b reads 4,324, and reverting this PR's preview component to main's copy leaves the count unchanged.

Lead gate on 9aa2e13da6 (round-3 and bot folds) against 2524737ef0 (verify-gates.sh, artifacts rebuilt): tsc 0, ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 8 changed files 0, root oxfmt over 2 files 0, machine paths 0; config/scripts 237 files / 2,146 passed, 0 failed; mobile 771 files / 8,610 passed, 0 failed. Lead native reproduction at the same head: the Swift shell checks compile and run OK (swiftc -O over the eight ios/ sources plus tests/MobileWebShellChecks.swift); Kotlin 55 @Test counted (Gradle run is the lane's, 55 / 0 failures).

Lead gate on 66960080d4 (round-2 folds) against 2524737ef0: tsc 0, ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 8 changed files 0, machine paths 0; config/scripts 235 passed + two load flakes in untouched files (the frame-budget encoder sweep and the workflow glob race; both green alone, 24/24); mobile 771 files / 8,610 passed, 0 failed.

Lead gate on 95ccf607fb (round-1, CI and bot folds) against 2524737ef0: tsc 0, ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 8 changed files 0, machine paths 0; config/scripts 237 files / 2,144 passed; mobile 771 files / 8,610 passed, 0 failed. Lead control at that head: one toggle's accessibilityState removed from the page sibling → mobile-webview-editor-web-fallbacks.test.tsx fails says which side of the toggle is showing, on the page (1 of 11). Native at that head: gradle 9 classes / 53 tests / 0 failures / 0 errors (XML); at 66960080d4: 54 / 0 / 0, Swift checks clean with the control exiting 133 when the gesture rule is removed.

Lead gate on 40708f889f against 2524737ef0 (verify-gates.sh, artifacts rebuilt): tsc 0, tests-typecheck ratchet 0, oxlint 0, oxfmt 0, changed-code quality 0, react-doctor 0, oxlint-config 0, anti-slop 0, merge-max-lines 0, root oxlint over 7 changed files 0, machine paths 0; config/scripts 237 files / 2,142 passed; mobile 771 files / 8,607 passed. (A first run read oxlint 38 / format 1 / changed-code 37 / consumer census 1 red, all from a stray untracked C7.5b artifact in the verify tree; removed, all four re-ran 0.) Lead control: allow-scripts added to the sandbox constant → the render check fails 3 of 14 (the paint case on both engines and the token census). Native: gradle XML MobileWebShellDroppedNavigationTest tests=5 failures=0 errors=0 read by the lead; swiftc clean per the lane.

Limit: Playwright's WebKit is WebKit, not WKWebView serving orca-mobile-web://<session>/; about:srcdoc inheritance under the custom scheme is proven on a device in C7.9, listed there.

Not in this PR: Mermaid in-page (PR B), the rich editor (C1/C2 after C7.5c), dictation (PR D), haptics (PR E), the img-src widening (ruling 27, its own PR).

…pener

Both shells cancelled every navigation off their own document in silence: iOS
`decidePolicyFor` allowed only `isMainFrame && isDocumentUrl`, Android's
`shouldOverrideUrlLoading` dropped anything whose resolved path was not "/".
Nothing opened. That is the whole of ruling 29's "if they do not": a user tapping
a link inside C7.10's sealed HTML-preview frame reaches the top frame as a
navigation request, and the shell was the only thing that could act on it.

A cancelled main-frame navigation now reaches JS as `onExternalNavigation` and
goes through the same `Linking.openURL` the `externalLink` notify already uses.
The scheme list is not restated natively: the native side caps the string and
says which frame it came from, and `readBridgeExternalLinkUrl` decides what opens
in the half that ships over the air. A subframe navigation is never offered,
because that is the sealed preview loading itself.

swiftc check: OK (`checkCancelledNavigation` added, the whole suite runs).

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
… page

C7.6 gave the page the artifact's source, which is the native component's Source
tab and half its job (ruling 8). Ruling 26 makes that debt: the Preview tab comes
back as an `<iframe sandbox srcdoc>` inside the page's own document.

`srcdoc` rather than a `blob:` URL, and no CSP change at all. Measured on Chromium
and WebKit: a `srcdoc` frame has no URL for `frame-src` to match and inherits its
embedder's policy instead, so it is admitted under the shipped `frame-src 'none'`,
while a `blob:` frame is refused by `frame-src` on both and refused a second time
in WebKit by the `frame-ancestors 'none'` it inherits.

Two independent fences seal it, and the render check measures each on its own:
the sandbox grants neither `allow-scripts` nor `allow-same-origin`, and the
inherited `script-src 'self'` refuses the artifact's inline script even when a
control arm grants `allow-scripts`. The inherited `img-src` and `font-src 'none'`
govern its subresources, against a no-header control where the same three are
fetched.

`allow-top-navigation-by-user-activation` is the one token granted (ruling 29), so
a tapped link becomes one top-frame navigation the shell now opens externally,
while a `<meta refresh>`, a form submit, `target="_blank"` and any script-initiated
navigation produce none.

`lucideBarrelPlugin` is exported from the bundle builder so the check builds the
toolbar's icons the way the page does rather than carrying a second shim.

config/scripts suite, this file: 14 passed, 0 errors, exit 0. Control runs: a
literal `sandbox` in the JSX reds 4, an added `allow-scripts` reds the script
fence and the token census.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…s pinned

The three HTML-preview cases in this file described the state ruling 26 retires:
no toggle, no frame, the source only. They now pin the frame's shape through the
test renderer -- the artifact reaches it as `srcDoc`, the sandbox grants neither
`allow-scripts` nor `allow-same-origin`, both toggle positions exist, and Source
takes the frame away with it -- and the "never renders the html itself" case
becomes "never puts it anywhere but the frame", counted rather than merely absent.
What a browser does with that frame stays in the render check, which is the only
thing that can answer it.

The rich Markdown editor's half is unchanged: it is still the plain field, and
item C is a later PR.

Two mocks added: `Pressable`/`ScrollView` on the react-native double, because the
toggle renders one, and `lucide-react-native`, whose barrel imports a
`LucideProvider` its own context module does not export and so does not load under
vitest at all.

9 passed, exit 0.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 39ecae1c-09b8-4e6d-86da-e64899e10a47

📥 Commits

Reviewing files that changed from the base of the PR and between 9aa2e13 and 86d3396.

📒 Files selected for processing (1)
  • mobile/src/mobile-web-shell/MobileWebShellScreen.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The web mobile preview now renders agent HTML in a sandboxed srcdoc iframe with a Preview/Source toggle and tab accessibility state. Browser tests verify CSP, sandbox, resource, script, and navigation behavior. Android and iOS shell views now classify navigation verdicts, emit eligible cancelled navigation URLs, and consume shell-load authorization. The screen normalizes supported targets before opening.

Priority: ➖ Normal

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 49.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 53 functions across 18 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description provides extensive technical details and verification results, but it does not follow the required template. It omits the required ELI5, What Changed, Why, Linked Issue, Visual Proof, … Restructure the description using the repository template. Add the required issue reference after “Fixes #”, provide before-and-after visual proof or state why it is not applicable, document manual and automated testing with platform detail…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: rendering the mobile HTML preview in a sealed srcdoc frame. The phase and project context are additional but still relevant.
Full details: Description check

Explanation

The description provides extensive technical details and verification results, but it does not follow the required template. It omits the required ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.

Resolution

Restructure the description using the repository template. Add the required issue reference after “Fixes #”, provide before-and-after visual proof or state why it is not applicable, document manual and automated testing with platform details, complete the required checklist items, and address the AI Disclosure, Review, Agent skill upstream boundary, and Notes sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: dec668ff-614e-47bf-a156-b335f4c1ff97

📥 Commits

Reviewing files that changed from the base of the PR and between 2524737 and 40708f8.

📒 Files selected for processing (17)
  • config/scripts/build-mobile-web-app-bundle.mjs
  • config/scripts/mobile-web-app-html-preview-render.test.mjs
  • mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellNavigationPolicy.kt
  • mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellView.kt
  • mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/OrcaMobileWebShellModule.kt
  • mobile/modules/orca-mobile-web-shell/android/src/test/java/expo/modules/orcamobilewebshell/MobileWebShellDroppedNavigationTest.kt
  • mobile/modules/orca-mobile-web-shell/ios/MobileWebShellNavigationPolicy.swift
  • mobile/modules/orca-mobile-web-shell/ios/MobileWebShellView.swift
  • mobile/modules/orca-mobile-web-shell/ios/OrcaMobileWebShellModule.swift
  • mobile/modules/orca-mobile-web-shell/src/index.ts
  • mobile/modules/orca-mobile-web-shell/tests/MobileWebShellChecks.swift
  • mobile/src/components/MobileHtmlPreview.web.tsx
  • mobile/src/components/mobile-webview-editor-web-fallbacks.test.tsx
  • mobile/src/mobile-web-shell/MobileWebShellScreen.tsx
  • mobile/src/mobile-web-shell/cancelled-navigation-target.test.ts
  • mobile/src/mobile-web-shell/cancelled-navigation-target.ts
  • mobile/web-entry/web-overrides.json

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.

…e document

F1, blocking, with F5 and F6 folded in because they are the same decision and
splitting them would mean three rewrites of one function.

F1: `<a href="/" target="_top">` and `href=""` in an artifact resolve against the
embedder's base, so both named the shell's own document URL -- which both shells
ALLOWED (iOS `isDocumentUrl`, Android's path `/`). One tap inside the sealed
preview reloaded the shell's page: bridge target cleared, load state restarted,
page state gone. A navigation a human started is now never allowed, whatever it
names; it is offered instead, and `cancelledShellNavigationTarget` drops
`orca-mobile-web:` in silence exactly as it drops `/h/other`. The page rewriting
its own path carries no gesture and is still allowed.

F5: the OFFER is gated on the same gesture, so a top-page meta refresh or a
redirect is cancelled and never opened externally.

F6: iOS returned early on `shouldPerformDownload` before the offer, so `<a
download>` was dead on iOS and opened on Android. The early return goes; a
download is refused rather than allowed when nothing started it, and a
gesture-started one reaches the opener on both platforms.

The allow half and the offer half are now one function per platform
(`MobileWebShellNavigationPolicy.verdict`, `mobileWebShellNavigationVerdict`), so
they cannot drift. The gesture is the platform's own answer: `.linkActivated` on
iOS, `request.hasGesture()` on Android.

Native tests, both platforms: document URL + gesture refused and offered; document
URL without gesture allowed; foreign + gesture cancelled and offered; foreign
without gesture cancelled and silent; download both ways; subframe never offered.
swiftc OK; control run with the gesture rule removed exits 133. Gradle
MobileWebShellDroppedNavigationTest tests=8 failures=0 errors=0.

Also corrected: the screen comment that claimed the document's own reloads reach
the handler (they never do), and the prop doc, which now states the gesture rule.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…to cap

F2: `page.setDefaultTimeout(4000)` capped `page.goto` at 4 s while every sibling
render check uses the 30 s default, so under load the first WebKit cases redded on
the navigation rather than on anything they assert. The cap goes; the per-action
timeouts that needed to be short are already passed at their call sites.

F1's page-side half: the rig now routes the page's own origin as well as the
foreign one and counts main-frame navigations to each separately, with two cases
pinning that `href="/"` and `href=""` each produce exactly one own-origin
top-frame request. Playwright is not the shell, so what these state is the request
the shell is handed; refusing it is the native tests' job and the docstring names
which ones. The own-origin route is registered after the initial load, because it
aborts main-frame navigations and the first `goto` is one.

The foreign-tap and meta-refresh cases now also assert zero own-origin
navigations, so a fix that merely moved the target would not pass.

16 passed, exit 0, no Errors line.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one sequencing question and a rough edge worth a look.

Reviewed changes

  • Sealed preview frame on the page. MobileHtmlPreview.web.tsx now renders the artifact in an <iframe srcDoc> sandboxed to allow-top-navigation-by-user-activation (no allow-scripts, no allow-same-origin), keeping the native component's Preview/Source toggle. It relies on the srcdoc frame inheriting the shell's already-shipped CSP rather than a policy change.
  • Cancelled-navigation hand-off. A new native onExternalNavigation event on both shells offers the URL of a cancelled main-frame navigation; cancelledShellNavigationTarget filters it through readBridgeExternalLinkUrl (normalized href, https/http/mailto only) and MobileWebShellScreen opens it with Linking.openURL.
  • Tests. A Chromium + WebKit browser render check with no-header controls (pixel oracle, sandbox matrix, external-fetch interception), Kotlin and Swift policy checks, vitest for the TS filter and for the web sibling's frame and toggle.

The seal is sound: I had the sandbox/CSP model independently checked against the HTML and CSP specs, and the artifact cannot run script, fetch remote subresources, reach storage/cookies/orcaBridge, or start a top-frame navigation without a real user activation. meta refresh, forms, target="_blank", <base target> and nested frames are all closed, and the bridge refuses non-main-frame senders on both platforms, so the "two fences" claim is genuine.

ℹ️ The preview's external links depend on a native event that is never negotiated

MobileHtmlPreview.web.tsx grants the sandbox token unconditionally, and MobileWebShellScreen.tsx wires onExternalNavigation unconditionally, but the event only exists on a shell built from this PR. Native code does not ship over the air while the web bundle does, so a newer bundle running on an older installed shell renders the preview and then a tapped link is cancelled with no event and silently does nothing. The preview route is inert until C7.7, so the fallout lands with C7.7 rather than this PR — but that is also the point at which the gate is needed.

Technical details
# Ungated native dependency for the preview's external links

## Affected sites
- `mobile/src/components/MobileHtmlPreview.web.tsx:25,84` — sandbox token applied with no shell-capability check; the module reads no bridge/session state.
- `mobile/src/mobile-web-shell/MobileWebShellScreen.tsx:281` — handler wired with no feature check.
- `mobile/modules/orca-mobile-web-shell/{android,ios}/.../OrcaMobileWebShellModule.{kt,swift}` — the `Events(...)` entry is the capability itself.
- `mobile/src/mobile-web-shell/page-route-policy.ts` — `MOBILE_WEB_SHELL_GRANTS` carries no name for this, so there is nothing for the page to check.
- `config/scripts/mobile-web-page-routes.mjs:64-67` — the file-preview route's declared grants are all pre-existing, so an older shell passes the route gate and mounts the page.

## Required outcome
- A newer OTA bundle must be able to tell whether the installed shell emits `onExternalNavigation`, and degrade visibly (or not render the frame) when it does not.

## Suggested approach (optional)
- The precedent is `mobile/src/browser/use-browser-binary-screencast-grant.web.ts:27-30`, which reads `grants.native` from the shell session before sending a capability-gated flag.

## Open questions for the human
- Is this sequencing handled by the OTA program outside the code, or should the capability be negotiated here?
- `grants.native` currently names page-callable verbs; is it the right home for a native → JS view event, or does the shell need a separate "events it emits" surface?
- The two native tests this PR adds are not run by any CI job (only `assembleRelease` runs gradle); is that intentional?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

On the ungated native dependency (pullfrog, review 5262403469): handled by sequencing, not by code in this PR. The web shell module is in no released mobile build (mobile-v0.0.9 predates it), and the Phase E flip requires a native release that carries every verb and event C7.10 adds, so before the flip no bundle can meet a shell without onExternalNavigation. The general mechanism, the shell publishing its capability set (verbs, notify names, events) in the session so a newer bundle can gate on an older shell, is recorded as plan item C8.1 for the first post-flip native change. The two native test suites have no CI job today; they are run locally and their results are in the PR body.

CI read the child frame before its srcdoc committed: frameUrl came back ''
and the control arm's script as not yet run. The frame list, the frame's URL
and anything read inside it settle at their own moments, and a 900 ms wait
reads whichever of them has happened -- on a loaded runner, none.

Polls for a child frame at about:srcdoc with its load fired, bounded by the
case's own timeout, and an override arm now resolves on the document its
srcdoc assignment commits rather than on the assignment.

Red-first: with a 2.5 s mount delay standing in for a loaded runner, the
paint case failed on both engines before this and all 16 cases pass after.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The list is the main frame's: securitypolicyviolation does not cross into a
frame, so an empty one says the embedder raised none and says nothing about
the artifact's own style, image or font. A listener inside the frame cannot
be the fix -- the fence under test is that nothing in the artifact runs.

So the comment now claims what the reading supports, and names where the
frame's containment is actually measured: the pixel for its inline style,
the counting server for its img-src and font-src.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The Preview/Source pair carried a label each and nothing else, so which one
was showing lived only in the active background -- invisible to a screen
reader on both surfaces. Each button is now a tab carrying its selected
state, inside a tablist, and the two files' toolbars stay character-identical
so the page and the phone announce the same thing.

Red-first: the new case renders both siblings and failed on both for the
missing role before this.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The anti-slop gate refuses a bare `object` parameter. Takes the same shape as
the react-native mocks beside it, which pass it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The document URL was allowed whenever the host reported no gesture, so a
navigation the shell never asked for could reload the page out from under the
session. Measured against a real WKWebView off-device: a sandboxed subframe
navigating the top frame to the document URL arrives as `.other` with no
gesture at all, and Chromium's own docs allow hasGesture() to be false for a
request a human started. Census first: nothing in the page navigates the top
frame -- no location assignment, reload, replace, window.open or form -- the
router moves by pushState and replaceState only, so the rule needs no gesture
and no page cooperation.

Both shells now raise a flag around their own load and drop it at commit, and
allow a main-frame navigation only while it is up. Everything else naming the
document is refused and never offered, since offering it would send the user
out of the app. iOS carries the second discriminator the same probe measured:
sourceFrame is the main frame for the shell's own load and the subframe for a
subframe's top navigation, so a subframe can never take the allow path.

Red-first: the Swift checks and the Kotlin tests were written first and failed
to compile against the old signature. 9 Kotlin tests, 54 in the module.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The fixture pointed off-origin, so its own-origin assertion could not move
whatever the frame did. The new arm refreshes to `/`, which resolves against
the embedder's base, and pins zero top-frame requests on a counter the
`href="/"` case proves reads 1 in the same rig.

It also counts what the frame asks for itself, with a presence control that
attributes the fence: with `allow-same-origin` and no policy the same fixture
navigates the frame to the embedder's `/`, and with the policy dropped but the
product's token kept it navigates nothing, so the opaque origin is what
refuses it rather than the CSP.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The 600 ms after every action is gone. An arm that expects a navigation now
returns the moment the route handler records it, with a deadline only so a
click that missed its target says so instead of spending the case's timeout.
An arm that expects none waits for two painted frames inside the page and one
200 ms drain for the popup queue, which is a browser-process event with no
in-page counterpart; the docstring says why that one is bounded.

Measured and reported rather than claimed: with the new wait replaced by a
no-op every arm still passes, because the reads that follow are each a round
trip. It is insurance against the runner load that produced the frame-commit
race, not a fix for a failure seen here.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes (delta since prior pullfrog review 5262403469, 40708f889f → 95ccf607fb)

  • A gesture-started top-frame navigation is never allowed, even when it names the document. href="/" and href="" inside the preview resolve against the embedder's base, so one tap could reload the shell out from under the session. The native policy on both platforms now collapses allow/offer into one verdict per platform: a non-main-frame request is cancelled, a request a human started is cancelled and offered whatever it names, and only a no-gesture navigation to the served document can load in place. iOS's early shouldPerformDownload return is gone, so a tapped download also reaches the opener.
  • Own-origin navigations and frame-load waiting in the render rig. The Playwright check now counts top-frame navigations to the shell's own origin and pins that href="/" and href="" each produce exactly one request the shell must refuse; it also waits for the child frame's own load instead of a fixed delay, which is the CI Chromium race the first run tripped on.
  • The Preview/Source toggle now announces its selected side. Both the native and web toolbars are a tablist of tabs carrying accessibilityState.selected, pinned by a case that renders both siblings.
  • Typed the react-native-webview mock so the native sibling renders beside the web one without the codegen lookup.

The one open pullfrog thread (the violations comment claiming to read the artifact's policy) was addressed in 1623a3a7c6 and resolved.

ℹ️ The gesture gate's correctness rests on a platform flag no test observes

The fix for the round-1 reload defect now hinges on hasGesture. Android's own WebResourceRequest.hasGesture() contract says it may return false even for a request a user gesture created, and if that happens for a tap on href="/" the verdict falls through to Allow — the exact reload this commit exists to prevent. The sandbox only lets the navigation through at all when there is user activation, so a false negative for this tap is unlikely, and the change is strictly narrower than the previous always-allow. Worth a line in the device-check record (B4) or a fail-safe, since no test observes the native flag.

Technical details
# The gesture gate is only as reliable as the platform's gesture flag

## Affected sites

- `mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellView.kt:359` — comment asserts `hasGesture` is "Chromium's own answer to 'did a human start this'".
- `mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellNavigationPolicy.kt:84-90` — `hasGesture == false` + `isDocumentUrl == true` returns `Allow`.
- `mobile/modules/orca-mobile-web-shell/ios/MobileWebShellView.swift:465-466` and `MobileWebShellNavigationPolicy.swift:60-69` — same shape via `.linkActivated`.

## Evidence

- `https://developer.android.com/reference/android/webkit/WebResourceRequest#hasGesture()` — "For security reasons in certain situations this method may return `false` even though the sequence of events which caused the request to be created was initiated by a user gesture."
- Chromium's `AwWebResourceRequest.hasUserGesture()` carries the same warning in its source.

## Required outcome

- A device assertion that a tap in the sandboxed `srcdoc` frame yields `hasGesture() == true` / `.linkActivated` (and a programmatic/meta-refresh top navigation yields false), or a policy that does not fall through to `Allow` for a document-URL navigation when the gesture flag is unreliable.

## Open questions for the human

- Is the sandbox's activation requirement enough to trust the flag here, or should C7.7 not ship until the native flag is measured on a device?

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

CI timed out on all seven preview cases on one engine: the poll waited for a
child frame whose URL reads about:srcdoc, and that browser reports an empty
URL for a srcdoc frame, so every case ran to its own timeout. The same
difference had already shown as `expected '' to be 'about:srcdoc'`.

The frame is now the element: waitForSelector('iframe') then contentFrame(),
with readiness taken from the fixture's own marker inside it. Nothing compares
a frame URL any more -- the paint case reads the element's srcdoc attribute
and the absence of src instead, which is what "parsed inside the frame rather
than fetched into it" actually means. The one arm whose artifact navigates the
frame away says so rather than waiting for a marker that is not coming.

Red-first: with the old poll keyed on a URL the browser never reports, both
engines time out exactly as CI did; the new wait passes 18/18 with the 2.5 s
mount delay still injected.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 1d5dea87-71de-40cc-8e28-01a1b588cd80

📥 Commits

Reviewing files that changed from the base of the PR and between 95ccf60 and 6696008.

📒 Files selected for processing (9)
  • config/scripts/mobile-web-app-html-preview-render.test.mjs
  • mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellNavigationPolicy.kt
  • mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellView.kt
  • mobile/modules/orca-mobile-web-shell/android/src/test/java/expo/modules/orcamobilewebshell/MobileWebShellDroppedNavigationTest.kt
  • mobile/modules/orca-mobile-web-shell/ios/MobileWebShellNavigationPolicy.swift
  • mobile/modules/orca-mobile-web-shell/ios/MobileWebShellView.swift
  • mobile/modules/orca-mobile-web-shell/src/index.ts
  • mobile/modules/orca-mobile-web-shell/tests/MobileWebShellChecks.swift
  • mobile/src/mobile-web-shell/MobileWebShellScreen.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • mobile/src/mobile-web-shell/MobileWebShellScreen.tsx
  • mobile/modules/orca-mobile-web-shell/src/index.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.

The runner's Chrome read the preview frame's URL as empty where three
chromium builds here read about:srcdoc: bundled headless, the headless shell,
and --headless=old, all 147. So the difference is not reproducible locally and
the next CI run has to carry its own diagnosis.

The marker wait is bounded well inside the case timeout, and on expiry it
reports the frame's URL, the srcdoc attribute's length and the page's CSP
violation list -- which separates a frame the policy refused from one that was
merely slow, the two readings that look identical from a timeout.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The comment said the fixture navigates nothing with the policy dropped and
the product's token kept, but no arm ran it: the control dropped both fences
at once. Both single-fence arms exist now, either of which would hold.

Measured rather than assumed, and one of them is not what the comment said.
The token alone: the navigation never starts, no request, no violation. The
policy alone, with allow-same-origin granted: the navigation does start and
frame-src refuses it, which the embedder reports as its own violation. The
engines differ only in what is left in the frame -- chromium an error page,
WebKit the artifact -- so neither is asserted; what is asserted is that the
request never reaches the server.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The document branch skipped downloads, so `<a href="/" download>` fell
through to the offer path carrying the shell's own URL. Harmless in practice,
because the opener's scheme list drops it, but it contradicted the policy's
own comment and the prop doc, and it left the one URL that must never be
offered reaching the boundary.

The branch now covers a download too: refused, from either frame, gesture or
not, and never offered. A gesture-started download of anything else still
reaches the opener.

Red-first on both platforms: the Swift checks exited 133 and the Kotlin row
failed against the old policy. 10 navigation tests, 55 in the module.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The flag lived beside the load call and had to remember every ending
separately, so iOS missed two: a prop update that fails before it loads, and a
renderer that died. Both left it raised, and a navigation to the document URL
during that window would have been allowed.

It now lives in the load state machine, which every ending already runs
through -- a commit, a failure, a dead renderer, a prop update, a reset -- on
both platforms, so there is nothing left to remember. The view raises it and
reads it, and drops it nowhere.

The Android residual is stated in the policy rather than papered over: between
loadUrl raising the flag and onPageStarted dropping it, a navigation to the
document URL from inside the preview frame would be allowed, because that
callback says nothing about which frame asked and no host discriminator
exists. It needs a generation switch and a tap in that window; iOS closes the
same gap with sourceFrame.

Red-first: the new Swift row failed to compile and the Kotlin row with it.
12 load-state tests, 56 in the module.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor test-attribution point inline.

Reviewed changes (delta since prior pullfrog review 5262647580, 95ccf607fb → 66960080d4)

  • The document-URL decision no longer rests on a gesture. Both shells' navigation policies allow the served document only while a shellInitiatedLoad flag the view raises around its own load is up, and refuse every other navigation naming it without offering it. The gesture is consulted only for what may be offered to the opener — isShellLoad/isFromSubframe on Swift, the flag alone on Kotlin (which passes isFromSubframe = false because Chromium does not report the initiator in shouldOverrideUrlLoading).
  • Both views maintain that flag. iOS raises it in loadWhenIsolated and drops it in didCommit and both failure callbacks; Android raises it before loadUrl and drops it in onPageStarted and reportDocumentFailure.
  • Native policy tests follow the new signature and rules (MobileWebShellDroppedNavigationTest.kt, checkNavigationVerdict in MobileWebShellChecks.swift), and the render rig now reads a recorded main-frame navigation or a settled frame instead of a fixed clock.
  • A new rig arm pins an own-origin meta refresh, counting ownOriginFrameNavigations alongside the existing top-frame counters.

This folds the prior review's concern cleanly: the reload defect can no longer depend on the host reporting a gesture, so a false hasGesture() now costs at most a dead link rather than a shell reload.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

The flag stayed raised from the load until didCommit, so a second main-frame
action naming the document inside that window was allowed too and replaced the
document. WebKit can decide a second action before the first one starts, so
the commit is too late to be what spends it.

The allow itself spends it now, before the decision goes back, and every
ending still drops it for a load that is allowed and never commits.

Red-first: the new check composes the machine with the policy -- the seam the
flag and the rule meet at -- and failed to compile against the old machine.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
WebViewClient's javadoc, verbatim: "This callback is not called for all page
navigations. In particular, this is not called for navigations which the app
initiated with loadUrl(): this callback would not serve a purpose in this
case, because the app already knows about the navigation."

So the flag guarded nothing on this platform and, while raised, was the one
thing that could have let a competing request to the document URL through.
The view passes isShellLoad = false always now, the machine drops the field it
had no raiser for, and the policy comment carries the quote. Nothing reaching
that callback is the shell's own load, so nothing naming the document is
allowed there at all -- which also closes the generation-switch window the
residual named, so that paragraph goes.

No red to show: this is a removal, and the behaviour it leaves is the refusal
the existing rows already pin. What a device proof must check is stated in the
policy instead: a WebView that did route its own load here would have it
refused and the load state would sit at loading. 55 tests in the module.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
An arm with no action read its counters as soon as the frame's marker
appeared, so a zero-delay meta refresh could dispatch after the reading. The
arms that pin zero were the ones relying on it.

Every arm settles now, and what it settles on is what it expects: the sealed
refresh arms take the bounded no-navigation path, and the loose arm waits for
a recorded navigation that is neither main-frame nor foreign -- its own
frame's -- rather than the main-frame wait it would never satisfy.

Red-first: with the settling removed and the refresh moved to 2 s, the loose
arm reads 0 on both engines; with it back, 1 on both, the delay still in.
A 0.4 s refresh passes either way, which is why the finding was invisible.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes (delta since prior pullfrog review 5262726596, 66960080d4 → 9aa2e13da6)

  • Refused a download that names the shell's own document, without offering it to the opener. A real download of anything else still takes the gesture-gated offer path on both policies.
  • Moved the own-load flag into MobileWebShellLoadStateMachine on iOS. isShellLoad is now raised by shellLoadStarted(), spent by shellLoadConsumed() on the .allow decision (not at commit), and dropped by every document ending (committed, documentEnded, failed, reset).
  • Removed Android's own-load flag entirely. The view passes isShellLoad = false always, resting on WebViewClient.shouldOverrideUrlLoading's documented exemption for app-initiated loadUrl() navigations.
  • Measured both fences in the meta-refresh case. New tokenOnly (csp: null, product sandbox) and policyOnly (allow-same-origin, shipped CSP) arms replace the prior comment-only attribution; the resolved thread asked for exactly this.
  • Hardened the render rig's waits. The frame is found by its element (not its URL), a frame that never becomes ready reports its URL / srcdoc length / page violations on a bounded timeout, and every arm — not only the tapping ones — settles before its counters are read.

This folds the prior review's one open thread cleanly: a1329026a8 adds the intermediate control the comment claimed, so the refusal is now credited to a measured fence rather than a comment.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Jinwoo-H and others added 6 commits September 21, 2026 00:08
One conflict, in the shell screen, resolved as a union: main's page haptics
keep their import and their `onHaptic` handler, this branch keeps the hoisted
`openUrlForPage` that both the page's externalLink notify and a cancelled
top-frame navigation share. Main's inline handler body is that function's body
verbatim, so nothing of either side is dropped.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…element

The two-fences control asserts the inline script ran, and the marker element
it waited for exists from parse time, so the arm could read window.__ran
before the script had touched it. Under a loaded runner that reads 0, which is
CI's "expected +0 to be 1" on chromium.

Readiness is now per-arm: 'script' waits for the script's own write, 'load'
for the arm whose artifact navigates the frame away, 'artifact' for the rest.

Red-first: with the inline script's write delayed 1.5 s, the old arm fails on
both engines with that exact message and the new one passes, delay still in.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Two inner deadlines, 20 s and 15 s, were racing the outer one they sit
inside, so a slow runner could fail a case on a number this file picked
rather than on the one the case declares.

Both now run to vitest's own `ctx.signal`, which aborts when the case times
out. On abort the rig prints its reading -- the frame's URL, the srcdoc
length, the violation list, or the navigations it did record -- and lets the
case fail as the timeout it is. Nothing is rethrown from that path: a
rejection raised after vitest has given up on a case has nobody left to catch
it, and an unhandled one fails a run whose every test passed.

Red-first: with the marker selector pointed at an element that never appears
and the case timeout cut to 8 s, the diagnostic prints and the case fails as
`Test timed out in 8000ms` rather than hanging in silence.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
C2.9 landed on the same screen this branch edits. No conflict this time: its
changes to the shell screen sit beside the navigation opener and the haptics
handler rather than on them, and both survive the merge unchanged.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor consistency point inline.

Reviewed changes (delta since prior pullfrog review 9aa2e13da6; net delta 86d3396..49d7363)

  • Per-arm readiness in the render rig. frameReady ('artifact' / 'script' / 'load') replaces expectArtifactInFrame; the two-fences loose arm now waits for what the inline script writes (window.__ran), not for #marker being attached.
  • The rig's inner deadlines are gone. The 20 s marker wait and the 15 s navigation wait are removed; each wait runs with timeout: 0 and races the case's own ctx.signal through a new untilAborted, which prints the frame URL, srcdoc length and page violations on abort.
  • Merged origin/main (5d13a70ea3, C2.9). No conflict; no PR source file changed.

Both native halves, MobileHtmlPreview.web.tsx, MobileWebShellScreen.tsx and cancelled-navigation-target.ts are unchanged since the last reviewed head. The one point inline is a rig-consistency nit; the CI-hardening intent of 6d78e8c95a is otherwise carried through.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

The old diagnostic said only that a frame never parsed, and its violation
list was the top document's -- securitypolicyviolation does not cross frames,
so it said nothing about what the frame itself refused.

It now prints the browser version, the arm it came from, the iframe element's
srcdoc length and sandbox, contentDocument.readyState and contentWindow.href
(which answer for a same-origin arm and report `refused` for an opaque one,
so the arm's own origin is in the log), and every Playwright frame with its
url, name, readyState, body length, marker presence, window.__ran and its own
violations. Per frame, because the page's init script installs the collector
in every frame -- measured on both engines -- and CDP evaluates inside an
opaque frame whose scripts are blocked.

Two corrections that the local probes forced. The reading is sampled while
waiting and printed from the last sample: read at the abort it lost its race
with vitest's teardown and printed nothing at all. And two arms had never been
given the case's signal, so their waits could not be bounded or diagnosed.

The diagnosis moves to its own module because the test file is at its line
limit, and because the bound and the reading it prints are one thing.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes (delta since prior pullfrog review 5263481828, 49d7363aa7 → 93330b2de7)

  • Bound the two previously unbounded rig arms. The sealed two-fences arm and the no-CSP control now pass signal: ctx.signal, so their waitForLoadedFrame readiness wait takes the same case-timeout bound and abort diagnosis as every other arm — the prior review's inline point.
  • Extracted the frame diagnosis into a new module. untilAborted and describeFrame (now describePreviewFrame) moved from the test file, which was at its line limit, into config/scripts/mobile-web-app-preview-frame-diagnosis.mjs. describePreviewFrame now reports the embedder's iframe attributes plus a per-frame reading (readyState, body length, marker, script write, per-frame violations) instead of the top document's violations and srcdoc length alone.
  • Diagnostics sample while waiting. Both untilAborted and waitForRecordedNavigation take a reading every 5 s and print the last sample on abort, because a reading taken at the timeout loses its race with vitest's teardown.

node --check, oxlint, oxfmt and pnpm run check:code-quality:changed (0 findings across 10 changed files) are clean on the two touched files. The render rig itself needs mobile/node_modules and the Playwright browsers, so it was not executed here.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…e one

A live frame cannot be relaxed. Sandbox flags are fixed on a browsing context
when it is created, and Chrome 152 keeps the original ones through a srcdoc
reassignment while still parsing the new document -- so the control arms that
widened the product's own frame stayed sealed on the runner, and CI read a
script that never ran and a refresh that never navigated. Chromium 147 here
honours the relaxation, which is why it passed locally for a year of runs.

The override now clones the element, sets the sandbox on the clone, gives it
the artifact and replaces the product's frame with it, so the widened flags
are there from creation -- the way the product does it, since React sets the
attribute before insertion and never after. The product's own arms are
untouched: a null override still returns immediately.

And the control can no longer pass for the wrong reason on any engine. The
header-keeping arm now reads the violation raised inside the frame: a
script-src refusal can only happen if the sandbox let the script start, so it
separates "the policy held" from "the frame was never widened", which the old
arm could not. The loose arm pins an empty list beside it, the sealed arm pins
an empty one too, and those three readings are the whole fence story. The
violations come from each frame's own collector, because the embedder never
sees them.

Two diagnostic repairs the local probes forced: the browser version is read
once at open, since asking at the abort printed "browser unknown" in the CI
log this exists for, and the reading is sampled immediately as well as every
five seconds, since a wait that only prints "no reading was taken" says
nothing.

Red-first: with the widening disabled, both engines fail exactly as CI did --
180 s timeouts on the script arm -- and the diagnostic names the arm, the
version and the sandbox it actually had.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
CodeRabbit is right, and the browser says so: react-native-web's createDOMProps
never reads accessibilityState, so on the page the tab pair emitted role="tab"
and no aria-selected at all. The test renderer could not see it, because it
reports the props the component was handed rather than the DOM they become.

Both siblings carry aria-selected beside accessibilityState now -- the phone's
screen reader takes the latter, the browser the former -- and the toolbars stay
character-identical.

Red-first, in a real browser on both engines: the rig now reads every
[role="tab"] element's aria-selected before and after the tap, and it read null
for both positions before this line existed.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes (delta since prior pullfrog review, 93330b2de7 → fca290f39c)

  • Control arms now build a widened frame instead of relaxing a live one. __mount's override path clones the product's iframe, sets the widened sandbox on the clone before insertion, and replaces the live frame, so the flags are present from the browsing context's creation. A live frame cannot be relaxed — Chrome 152 keeps its original sandbox through a srcdoc reassignment — so the old control was measuring the sealed frame and could pass for the wrong reason.
  • The header-keeping control now proves it was widened. It asserts a script-src violation raised inside its own frame, which can only happen if allow-scripts let the inline script start; the loose and sealed arms pin empty violation lists as contrast. I confirmed the premise independently against the shipped header on the system Chromium: allow-scripts yields a script-src-elem violation in the opaque srcdoc frame, while the product sandbox yields [] with the foreign image, font and background blocked (blocked subresources raise no securitypolicyviolation in that frame).
  • The toolbar's selected state now reaches the DOM. Both siblings carry aria-selected beside accessibilityState, because react-native-web reads only the former; the render rig reads every [role="tab"]'s aria-selected before and after the tap instead of relying on the test renderer's props.
  • Diagnostics. The browser version is captured at open() rather than at the abort (where it printed browser unknown), and untilAborted samples a reading immediately and every 5 s.

The first two commits of this PR remain untouched, and no open pullfrog threads remain.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 8d42410 into main Sep 21, 2026
32 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-c7-10a-html-preview branch September 21, 2026 07:33
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