Repository navigation
ci: Backport master's CI fixes to 6.8 - #25725
Conversation
(cherry picked from commit 7db730f)
The script completion handlers passed UTF8String pointers of temporary NSStrings, which ARC may release before the managed callback copies them, so the callback could read freed memory: the intermittent SIGSEGV in the WebView2 ExecuteScriptAsync tests on the macOS WebGPU lane. Hold the strings until the callback returns, and complete the awaiting task asynchronously instead of inside WebKit's completion handler. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016JuV6BPjWEEXzuX2RUEE3z (cherry picked from commit fda0ac5)
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
|
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
A hard SIGSEGV in objc_retain inside libUnoNativeMac killed the whole macOS Runtime Tests job across 11 different branches, taking the results of every other test in the run with it. uno_native_dispose does not deallocate by itself: [element dispose] only calls removeFromSuperview, and the object dies when [transients removeObject:] drops the last strong reference. MacOSNativeElement raised that from Unloaded, which fires on any tree leave including a reparent, yet left NativeHandle pointing at the freed NSView and Detached untouched. Re-entering the tree then called uno_native_attach on that pointer, and ARC retained freed memory. Root-cause fix: disposal is now terminal on both sides. The managed wrapper zeroes NativeHandle and records Disposed, and uno_native_dispose also removes the element from `elements` so a disposed view cannot be resurrected by a later attach through the other strong-reference set. Defensive hardening: every uno_native_* entry point now refuses a disposed or zero handle and logs, so an operation fails instead of crashing the process. Note this does not make a native element survive a reparent — destroying the peer on Unloaded is a separate design defect, and MediaPlayerElement full-window toggling still tears its peer down. That is now a logged no-op instead of a crash. Compile-validated only: Uno.UI.Runtime.Skia.MacOS builds clean on net10.0. The Objective-C change and the crash itself need the macOS CI leg to confirm. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Tj7eBARpKztfeLfaLTWde7 (cherry picked from commit 9760b68)
`MacOSNativeWebView` kept a private `_webview` copy of the `WKWebView` pointer alongside the inherited `NativeHandle`. Disposal zeroes `NativeHandle`, but the shadow field survived it, so the fifteen `uno_webview_*` P/Invokes that read it kept messaging a deallocated `WKWebView` once the element left the visual tree — `objc_msgSend` into freed memory, which takes down the process instead of failing the call. That is what killed the macOS runtime-test job at `When_WebMessageReceived_After_RemoveAdd` even with the native-handle guards in place: those guards cover only the `uno_native_*` surface, which goes through `NativeHandle`. The field is gone. Every call resolves the handle through `TryGetHandle`, which refuses a disposed peer and logs, mirroring `TryGetLiveElement`. Two call-site choices worth noting: a disposed peer reports no navigation history rather than keeping a stale `CanGoBack`/`CanGoForward` that would invite a `GoBack()`, and `ExecuteScriptAsync`/`InvokeScriptAsync` return null instead of allocating a `GCHandle` whose callback can never fire. `_registeredHandle` is deliberately not another shadow of the native pointer: it is only the `_webViews` dictionary key and is never passed to native code. It has to be remembered because the unload order between the `WebView2` and its native element is undefined, so reading `NativeHandle` in `OnUnloaded` can find it already zeroed and leave a stale entry behind. This does not make a WebView2 survive a reparent — the peer really is gone, so `When_WebMessageReceived_After_RemoveAdd` now fails its assert instead of crashing the host. That is the point: the shard writes its results file and the rest of the suite reports. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> (cherry picked from commit ef4af74)
- Fix TaskCompletionSource<string> to TaskCompletionSource<string?> in ExecuteScriptAsync so it matches the callback cast - Guard content?.GetType() in TryGetLiveElement to avoid NullReferenceException when content is null - Return new Size(0, 0) from MeasureNativeElement for disposed peers instead of Size.Empty (-∞, -∞) which caused layout exceptions Co-authored-by: MartinZikmund <[email protected]> (cherry picked from commit d6462d4)
`TryGetLiveElement` and `TryGetHandle` are reached on every arrange, measure, attach and detach of a reparented element, so `Error` put a per-layout-pass stream into the channel reserved for genuine faults. The disposed peer is a known degraded path, not an unexpected state. Also from review: - `DisposeNativePeer` skips the P/Invoke when the handle is already zero, which happens when the peer was never created. - `ExecuteScriptAsync` awaits inside the `token.Register` scope, matching `InvokeScriptAsync`. It previously disposed the registration before awaiting, so a cancel arriving after the P/Invoke never reached the pending task. - Records why the disposed-peer measure fallback cannot be `Size.Empty`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01TEzBHbVj75RX9ENGARb6sL (cherry picked from commit f81eec0)
`MacOSNativeElement` destroyed its NSView from `Unloaded`, but `Unloaded` also fires on a reparent and the framework re-enters the very same element through `AttachNativeElement`. Every operation on the way back in was then refused, so a `WebView2` removed from and re-added to the tree came back dead — which is why `When_WebMessageReceived_After_RemoveAdd` failed the macOS runtime-test job. The X11 and Win32 hosting extensions never destroyed their peer on unload either. Root-cause fix: the peer's lifetime follows the managed wrapper. The finalizer releases it, dispatched to the main thread since AppKit is main-thread only, and `uno_native_attach` drops the strong reference `uno_native_detach` took so `transients` holds only genuinely detached views. The disposed-handle guards stay as hardening — they can no longer be reached through a reparent. `addScriptMessageHandler:name:` raises on a name that is already registered, and the WKWebView now survives the round trip, so registration removes the previous handler first and `OnUnloaded` unregisters symmetrically with `OnLoaded`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014LKUHFiW2J8nNFy7FmuCsd (cherry picked from commit bbf1ec8)
`uno_webview_create`, `uno_mediaplayer_create_view` and `uno_native_create_sample` all end in `objc_autoreleaseReturnValue` (confirmed in the shipped dylib), so the handle they hand back is owned by nothing but the current autorelease pool. The native side only took a strong reference at `uno_native_attach`, which adds the view to `elements`. Any element that is never attached, or whose attach lands in a later run-loop turn than its creation, is therefore already deallocated — and both `uno_native_attach` and `uno_native_dispose` begin with an ARC `objc_retain` of their parameter, so the next call takes the process down at `+0x1f`. That is the SIGSEGV the macOS runtime-test job keeps hitting: three CI core dumps from this branch all fault at the same image offset, which symbolizes to `uno_native_dispose` retaining a freed NSView. `uno_native_track` takes the strong reference at creation instead. The peer is now owned continuously — `transients` from creation, `elements` while attached, back to `transients` on detach — until `uno_native_dispose` drops both and deallocates it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014LKUHFiW2J8nNFy7FmuCsd (cherry picked from commit 3a8a41e)
`drawInMTKView:` returned without calling managed code when `currentDrawable` was nil. The view runs with `enableSetNeedsDisplay`, so AppKit had already cleared `needsDisplay` to make that call, and the managed side latches its own request: `CompositionTarget.RequestNewFrame` sets `RenderRequested` and only clears it from `OnNativePlatformFrameRequested`, which the dropped frame never reaches. Every later `RequestNewFrame` then coalesced into an invalidation that had already been consumed, so a single nil drawable stopped the window rendering permanently. Anything awaiting a frame after that waits forever — `UITestHelper.WaitForRender` has no timeout of its own — which is how one macOS test takes the whole 60-minute job down with it and publishes no results. The nil case now re-arms `needsDisplay` on a later main-queue turn, so the frame request survives. The software path never had the defect: it calls the managed callback before its own early return. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014LKUHFiW2J8nNFy7FmuCsd (cherry picked from commit 3d9731b)
Focusing a semantic node let the browser scroll its semantic scroller to reveal it, and the scroll listener fed that offset back into the ScrollViewer. Programmatic focus of an off-screen element then scrolled the XAML content, flaking Given_TextBox.When_GotFocus_BringIntoView on WASM once accessibility is enabled. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 92ec8c3)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 1abd4e0)
Review feedback addressed 2026-10-09. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NHPnucPE4WuxBEhL1RJG2T (cherry picked from commit 7c06b30)
A native crash in the desktop macOS runtime tests leaves no results and no stack in the log, only "Segmentation fault: 11". Print the exception and the crashed thread's frames from the report macOS writes to ~/Library/Logs/DiagnosticReports, then fail with the original exit code. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
|
EnableAccessibility had no counterpart, so the semantic DOM, focus sync, native-focus suppression and live regions stayed on for the rest of the app. DisableAccessibility tears all of it down and brings the enable button back, so it can be turned on again. The ItemsRepeater, ListView and ContentDialog handlers are now detachable so a re-enable does not subscribe them twice. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Da9FjW3KpXk99Zo4YyViTE (cherry picked from commit 00377f7)
The accessibility tests left it on for every later test in the WASM app, slowing them down and making a TextBox focus bounce through the semantic DOM. Each a11y test class now disables it in its cleanup, and new tests cover disabling and re-enabling. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Da9FjW3KpXk99Zo4YyViTE (cherry picked from commit 86905c8)
91df58d to
c8edeed
Compare
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
2bfc905 to
c71ab62
Compare
NSWindow defaults to releasedWhenClosed = YES, and uno_window_create never turned it off. Under ARC, with the static windows set holding the strong reference, AppKit then adds one unmatched release when the window closes, deferred to the autorelease pool. When -[NSApplication run] drains the pool, the window is freed while its owners still point at it, and the next release crashes in objc_release inside AutoreleasePoolPage::releaseUntil: the macOS Skia runtime-test crash 6.8 has hit since moving to the macos-26 image. Turn it off, and remove the window from the set once it has closed. Backport of master's 49f4bcf without its NSZombieEnabled change to macos-skia-runtime-tests.sh: zombies alone hide this crash, so the lane would not show whether the fix works. (cherry picked from commit 49f4bcf) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
@Mergifyio backport release/stable/6.7 |
✅ Backports have been createdDetails
|
…6.7/pr-25725 ci: Backport master's CI fixes to 6.8 (backport #25725)
…heads Given_WasmAccessibilityLifecycle (from #25725) uses WasmSemanticDomHelper, which the native Android and WASM heads don't build, so they failed with CS0234. Exclude it like the other Given_Accessible* tests there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
GitHub Issue: related to #23641, #24111, #24604, #24635, unoplatform/uno.check#590 and #24489
PR Type:
🏗️ Build or CI related changes
What changed? 🚀
Every pull request into
servicing/6.8fails CI for reasons that master has already fixed. This backports those fixes. Apart from the crash-report commit, each commit is a cherry-pick of a master commit:fix(ci): Pin msopenjdk-17 to a version uno-check parsesuno-checkreportsCheckup had Error status: openjdkfix(macos): Keep WebView script results alive for the callbackGiven_WebView2.When_WebMessageReceived. The script completion handler passed pointers into temporaryNSStrings that could be freed before the managed callback copied them. Fixes #23641 on 6.8.fix(macos)commits of #24112MacOSNativeWebViewmessaged a freedWKWebViewthrough a stale handle copy.fix(a11y): Don't scroll when mirroring focus to the DOMand its two testsfocusSemanticElementcalledfocus()withoutpreventScroll. The browser scrolled the semantic scroller, and that scroll fed back into the XAMLScrollViewer. This is howGiven_TextBox.When_GotFocus_BringIntoViewfails on first runs (VerticalOffset455 or 467, expected 0).fix(wasm-a11y): Allow disabling accessibility againandtest(wasm-a11y): Disable accessibility after each a11y testGiven_Accessible*test turned accessibility on, it stayed on for every later test in the shard. TheGiven_InputPaneocclusion tests then failed whenever they ran after one, e.g.When_OccludedRect_Cleared_Then_Content_Restored: "not brought above the keyboard top".DisableAccessibility()is on the internalWebAssemblyAccessibilitytype, so there's no new public API.ci(macos): Print the crash report when the runtime tests crash.ipsreport macOS writes.fix(macOS): Don't over-release NSWindow instancesNSWindowdefaults toreleasedWhenClosed = YES, so under ARC AppKit adds an unmatched release when a window closes, and the next owner's release hits a freed window. More frequent on macOS 26, which is why 6.8's lane started crashing when it moved tomacos-26.Differences from master:
MacOSNativeWebView.cson 6.8 had noTryGetHandleguard, so the conflict was resolved by keeping 6.8's code and applying only the fix. BothTaskCompletionSources are created withRunContinuationsAsynchronously. The Objective-C half (UNOWebView.m) applied unchanged.MacOSNativeWebView.cs, where 6.8 already hadRunContinuationsAsynchronouslyfrom the WebView fix. Resolved by keeping the disposed-handle guards with that option. The touched files now match master, apart from the namespace rename.DisableAccessibility()doesn't reset_relationshipPeersor_relationshipRefreshQueued. Those fields come from master's ARIA relationship refresh, which 6.8 doesn't have.Given_WasmAriaandGiven_WasmAriaRelations, which don't exist on 6.8.Given_InputPanetests, as master's 9431b99 does. Master has re-enabled them since. With fix(a11y): Don't scroll when mirroring focus to the DOM #24605 and fix(wasm-a11y): Allow disabling accessibility again #24636 they pass on 6.8 too, so they stay enabled here.The macOS Skia crash
When it started: the macOS lane has crashed in the
Given_WebView2message tests since #24964 moved 6.8's macOS jobs from themacos-15image tomacos-26. The last green run was build 238987 (macos-15), the first red one build 239875 (macos-26).The crash report (from the new step):
That is the stack master's 49f4bcf traced to an over-released
NSWindow. The crash lands in whatever test is running when the pool drains, so the WebView2 tests were where it surfaced, not what caused it.Backported without one line: master's commit also exports
NSZombieEnabled=YESinmacos-skia-runtime-tests.sh. That line is left out here. A CI run with zombies on and without the fix passed the whole suite, because zombies keep the freed window from being reused. With the line, this lane would pass whether or not the fix works.Local runs: on macOS 27 (Apple M2), as arm64 and as x64 under Rosetta, the crash never reproduced, so this PR's macOS lane is the check.
Validation
Compile:
Uno.UI.Runtime.Skia.MacOSandUno.UI.Runtime.Skia.WebAssembly.Browserbuild on Windows (net10.0).Runtime, WASM (local, headless Edge at 1920×1080). One sequence was repeated five times:
Given_AccessibleScrollViewer,Given_WasmAccessibilityLifecycle,Given_TextBox.When_GotFocus_BringIntoViewand the wholeGiven_InputPaneclass.When_OccludedRect_Cleared_Then_Content_Restoredfailed once in fiveInputPanetests, including the 3 re-enabled onesRun on their own, or within a local run of all of CI shards 2 and 3, both tests pass even without the fixes. They only fail after accessibility tests.
Runtime, macOS (local, macOS 27, M2): the full desktop suite (8052 tests) completes, and both
When_WebMessageReceivedtests pass. This doesn't reproduce the CI crash; see above.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code