feat: wire WebView2 native↔SPA bridge in CanvasWindow#259
Open
AlexAlves87 wants to merge 1 commit intoopenclaw:masterfrom
Open
feat: wire WebView2 native↔SPA bridge in CanvasWindow#259AlexAlves87 wants to merge 1 commit intoopenclaw:masterfrom
AlexAlves87 wants to merge 1 commit intoopenclaw:masterfrom
Conversation
7 tasks
Adds BridgeMessageReceived + PostBridgeMessage to CanvasWindow following the same pattern as WebChatWindow (c7630fa), closing the CanvasWindow item on the openclaw#191 checklist. Removes SendA2UIMessageAsync, ResetA2UIAsync, and their heuristic ExecuteScriptAsync helpers; both had no active callers and are replaced by the bridge. IsTrustedBridgeSource accepts only _trustedGatewayOrigin and openclaw-canvas.local. Source-scan test added in TrayMenuWindowMarkupTests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
85c44b9 to
aa449d2
Compare
Contributor
Author
|
The failing test ( I noticed a recent run on 0f54bc1 showing a different integration test failing in the same pattern, which suggests this might be intermittent CI flakiness rather than a regression. Happy to trigger a re-run if that would help move this forward! |
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.
Summary
Adds the bidirectional WebView2 bridge to
CanvasWindowand removes the fragileExecuteScriptAsyncheuristic paths, closing the remaining item on the #191 checklist after #192 landed theWebChatWindowhalf.Native → SPA
SPA → native
Why
The #191 checklist had one item outstanding after #192:
SendA2UIMessageAsyncandResetA2UIAsyncused 11 and 6 heuristic fallbacks respectively (window.__a2ui,window.a2ui,window.A2UI,dispatchEvent,postMessage…) to push messages into the SPA — the exact fragile pattern the issue calls out. Both methods had no active callers; the A2UI path is now served by the nativeA2UICanvasWindowrenderer. They are removed and the bridge is the replacement.Trust boundary
IsTrustedBridgeSourceaccepts messages from exactly two origins:_trustedGatewayOrigin— the gateway configured viaSetTrustedGatewayOriginhttps://openclaw-canvas.local— the local virtual host for canvas filesEverything else is rejected with a warning log entry.
What is not changed
EvalAsync— untouched; it is thecanvas.evalagent API, not a messaging pathEnsureA2UIHostAsync— untouched; usesNavigate, not the heuristic patternNodeService— no changesA2UICanvasWindow— not touchedTests
Source-scan added in
TrayMenuWindowMarkupTestsasserting presence ofBridgeMessageReceived,IsTrustedBridgeSource,openclaw-canvas.local, dispatcher marshaling,PostWebMessageAsJson,SanitizeBridgeLogValue, andWebMessageReceivedcleanup inOnWindowClosed.Validation
build.ps1✅ —OpenClaw.Shared.Tests1100/1100 ✅ —OpenClaw.Tray.Tests407/407 ✅