fix(android): take the IPC request URL from the sending frame's origin #1891
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 198 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.317
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1891"
general
weight: 0.35
LucaCappelletti94
On Android,
Ipc.postMessagesendsRustWebViewClient.currentUrlas the request URL, and that field is only written inonPageStartedon the main looper. When the main thread is busy during a load, the page's first scripts run before that callback, so their IPC calls arrive asabout:blankand Tauri's ACL refuses them withevent.listen not allowed on window "main", webview "main", URL: about:blank. #1275 narrowed this window without closing it. A stalled main thread on an API 35 emulator reproduces it on every launch, and it also shows up in CI on GitHub-hosted emulators, which is where I encountered this problem, stochastically, and it took me quite some time to narrow it down.Setting the URL earlier in
loadUrlwould let the outgoing page send IPC under the incoming page's origin until the navigation commits. This change usesWebViewCompat.addWebMessageListenerinstead, which reports each message's sender origin. The tracked URL is kept when it matches that origin, the origin is used otherwise, and opaque origins keep sendingabout:blankas in #1883. The listener runs on the UI thread, and handlers may block on the main pipe, so messages are forwarded on a single background thread. WebViews withoutWEB_MESSAGE_LISTENERkeep theaddJavascriptInterfacepath, withcurrentUrlnow@Volatile. Cross-origin iframes now report their own origin. I tentatively believe this solves the problem as I could not reproduce it any longer, although the stochasticity of it could either mean I am being very lucky right now or that it has become rarer still.