Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Defensive hardening for the macOS Skia native WebView title accessor to avoid a native crash when WKWebView.title is nil, plus a runtime test covering the “title before navigation” case.
Changes:
- Guard
WKWebView.titleagainstnilinuno_webview_get_titlebefore callingstrdup. - Add a runtime test asserting
CoreWebView2.DocumentTitlereturns""on a fresh WebView2 (no navigation yet). - Add a new SamplesApp manual test page for ContentDialog auto-focus / soft-keyboard behavior (appears unrelated to this PR’s stated scope).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWebView.m | Prevents strdup(NULL) by coalescing nullable WKWebView.title to an empty string. |
| src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_WebView2.cs | Adds regression coverage for reading DocumentTitle before any navigation. |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml/FocusManager/ContentDialog_AutoFocusTextBox.xaml.cs | Adds a new manual sample page (also contains a build-breaking unused using). |
| src/SamplesApp/SamplesApp.Samples/Windows_UI_Xaml/FocusManager/ContentDialog_AutoFocusTextBox.xaml | XAML UI for the new manual sample page. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23642/wasm-skia-net9/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23642/wasm-skia-net9/index.html |
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23642/wasm-skia-net9/index.html |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
7bb0e11 to
ea15d2a
Compare
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23642/wasm-skia-net9/index.html |
|
Tick the box to add this pull request to the merge queue (same as
|
Context: #23622 Context: #23642 **Tests - Desktop Skia macOS > Runtime Tests > Run macOS Runtime Tests** regularly crashes on CI *when using macos-26*: info: Uno.UI.Samples.Tests.UnitTestsControl[0] Running test When_ExecuteScriptAsync_Has_No_Result() dbug: Uno.UI.Runtime.Skia.MacOS.MacOSNativeWebView[0] LoadHtmlString: <html><body><script>function testMe(){ }</script><div id='test' style='width: 100px; height: 100px; background-color: blue;' /></body></html> build/test-scripts/macos-skia-runtime-tests.sh: line 31: 70322 Segmentation fault: 11 dotnet SamplesApp.Skia.Generic.dll --runtime-tests=$TEST_RESULTS_FILE and as the .NET 11 bump updates `$(macOSVMImage)` to be macos-26 -- beecause only macos-26 has Xcode 26.5, which .NET 11 P5 requires -- for awhile it looked like this might be a .NET 11 issue. PR #23622 verified that this was in fact a macos-26 issue, unrelated to .NET 11. Update `.azure-devops-tests-macos-skia.yml` to run the **Tests - Desktop Skia MacOS** stage on $(vmMacImageTest) (macos-14) instead of $(macOSVMImage) (macos-26). This allows the tests to run without crashing on CI. *Note*: we are unable to locally reproduce the crash, though it *may* be addressed by #23642. Additionally, update `macos-skia-runtime-tests.sh` to explicitly log the ABI of the machine running the tests, as `macos-26` means different things between [GitHub Actions][0] (arm64!) > | **Image** | **Architecture** | **YAML Label** | > | --------------- | ----------------- |----------------| > | macOS 26 Arm64 | arm64 | `macos-26` or `macos-26-xlarge` | and [Azure DevOps][1] (x64!). > **macOS images updates** > > * The macOS 26 (Intel) Azure Pipelines hosted agent image is in public preview. > * … > * The macOS 15 Sequoia ARM64 limited public preview has been paused. (As far as @jonpryor can tell, Azure DevOps currently provides *no* arm64 build agents…) [0]: https://github.com/actions/runner-images/tree/f84258ba81f6e9f1edfaf7a83da4727921e85790#available-images [1]: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=macos-images%2Cyaml#macos-images-updates
Context: #23622 Context: #23642 **Tests - Desktop Skia macOS > Runtime Tests > Run macOS Runtime Tests** regularly crashes on CI *when using macos-26*: info: Uno.UI.Samples.Tests.UnitTestsControl[0] Running test When_ExecuteScriptAsync_Has_No_Result() dbug: Uno.UI.Runtime.Skia.MacOS.MacOSNativeWebView[0] LoadHtmlString: <html><body><script>function testMe(){ }</script><div id='test' style='width: 100px; height: 100px; background-color: blue;' /></body></html> build/test-scripts/macos-skia-runtime-tests.sh: line 31: 70322 Segmentation fault: 11 dotnet SamplesApp.Skia.Generic.dll --runtime-tests=$TEST_RESULTS_FILE and as the .NET 11 bump updates `$(macOSVMImage)` to be macos-26 -- beecause only macos-26 has Xcode 26.5, which .NET 11 P5 requires -- for awhile it looked like this might be a .NET 11 issue. PR #23622 verified that this was in fact a macos-26 issue, unrelated to .NET 11. Update `.azure-devops-tests-macos-skia.yml` to run the **Tests - Desktop Skia MacOS** stage on $(vmMacImageTest) (macos-14) instead of $(macOSVMImage) (macos-26). This allows the tests to run without crashing on CI. *Note*: we are unable to locally reproduce the crash, though it *may* be addressed by #23642. Additionally, update `macos-skia-runtime-tests.sh` to explicitly log the ABI of the machine running the tests, as `macos-26` means different things between [GitHub Actions][0] (arm64!) > | **Image** | **Architecture** | **YAML Label** | > | --------------- | ----------------- |----------------| > | macOS 26 Arm64 | arm64 | `macos-26` or `macos-26-xlarge` | and [Azure DevOps][1] (x64!). > **macOS images updates** > > * The macOS 26 (Intel) Azure Pipelines hosted agent image is in public preview. > * … > * The macOS 15 Sequoia ARM64 limited public preview has been paused. (As far as @jonpryor can tell, Azure DevOps currently provides *no* arm64 build agents…) [0]: https://github.com/actions/runner-images/tree/f84258ba81f6e9f1edfaf7a83da4727921e85790#available-images [1]: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=macos-images%2Cyaml#macos-images-updates
Context: #23622 Context: #23642 **Tests - Desktop Skia macOS > Runtime Tests > Run macOS Runtime Tests** regularly crashes on CI *when using macos-26*: info: Uno.UI.Samples.Tests.UnitTestsControl[0] Running test When_ExecuteScriptAsync_Has_No_Result() dbug: Uno.UI.Runtime.Skia.MacOS.MacOSNativeWebView[0] LoadHtmlString: <html><body><script>function testMe(){ }</script><div id='test' style='width: 100px; height: 100px; background-color: blue;' /></body></html> build/test-scripts/macos-skia-runtime-tests.sh: line 31: 70322 Segmentation fault: 11 dotnet SamplesApp.Skia.Generic.dll --runtime-tests=$TEST_RESULTS_FILE and as the .NET 11 bump updates `$(macOSVMImage)` to be macos-26 -- beecause only macos-26 has Xcode 26.5, which .NET 11 P5 requires -- for awhile it looked like this might be a .NET 11 issue. PR #23622 verified that this was in fact a macos-26 issue, unrelated to .NET 11. Update `.azure-devops-tests-macos-skia.yml` to run the **Tests - Desktop Skia MacOS** stage on $(vmMacImageTest) (macos-14) instead of $(macOSVMImage) (macos-26). This allows the tests to run without crashing on CI. *Note*: we are unable to locally reproduce the crash, though it *may* be addressed by #23642. Additionally, update `macos-skia-runtime-tests.sh` to explicitly log the ABI of the machine running the tests, as `macos-26` means different things between [GitHub Actions][0] (arm64!) > | **Image** | **Architecture** | **YAML Label** | > | --------------- | ----------------- |----------------| > | macOS 26 Arm64 | arm64 | `macos-26` or `macos-26-xlarge` | and [Azure DevOps][1] (x64!). > **macOS images updates** > > * The macOS 26 (Intel) Azure Pipelines hosted agent image is in public preview. > * … > * The macOS 15 Sequoia ARM64 limited public preview has been paused. (As far as @jonpryor can tell, Azure DevOps currently provides *no* arm64 build agents…) [0]: https://github.com/actions/runner-images/tree/f84258ba81f6e9f1edfaf7a83da4727921e85790#available-images [1]: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=macos-images%2Cyaml#macos-images-updates
GitHub Issue: #23641
PR Type:
🐞 Bugfix
What changed? 🚀
uno_webview_get_title(macOS Skia native WebView) calledstrdup(webview.title.UTF8String)directly.WKWebView.titleis nullable; when it isnil,[nil UTF8String]returnsNULLandstrdup(NULL)dereferences null →SIGSEGV. This guards it:""preserves the existing behavior:CoreWebView2.DocumentTitlealready coalesces to"",_previousTitleseeds to""(so no spuriousDocumentTitleChanged), and it matches WinUI parity (a title-less page returns""). Allocation/free ownership is unchanged (still astrdupbuffer freed by the UTF-8 return marshaller).Also adds a
When_DocumentTitle_Before_Navigationruntime test assertingDocumentTitlereturns""(rather than crashing) on a fresh web view.Scope / honesty note: this targets the intermittent macOS 26 / x64
SIGSEGVin theGiven_WebView2.When_ExecuteScriptAsync*runtime tests (#23641). The crash could not be reproduced locally (~65 runs on a matching macOS 26.4.1 / x64 machine, incl.NSZombieEnabledandMallocScribble; instrumentation showedtitlewas nevernilacross ~70 navigations). So this is a defensive nullability fix, not a confirmed root-cause fix — butWKWebView.titleis nullable by API, sostrdup(NULL)is a real latent crash worth closing regardless. Whether it resolves the CI crash will be shown by the macOS runtime-test leg; #23641 is left open until confirmed.PR Checklist ✅
When_DocumentTitle_Before_Navigation)Screenshots Compare Test Runresults — N/A (no visual change)🤖 Generated with Claude Code
https://claude.ai/code/session_0178mJtoQEwreA2zrADWUgqP