Skip to content

feat(webview2): Improve API parity across platforms - #23754

Open
morning4coffe-dev wants to merge 17 commits into
masterfrom
dev/doti/temp-webview2-improve
Open

morning4coffe-dev wants to merge 17 commits into
masterfrom
dev/doti/temp-webview2-improve

Conversation

@morning4coffe-dev

@morning4coffe-dev morning4coffe-dev commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #12644, closes #17711, closes #22415

PR Type:

✨ Feature

What changed? 🚀

  • Adds explicit EnsureCoreWebView2Async(...) initialization with environment/controller options, initialization error reporting, and terminal Close() behavior.
  • Expands CoreWebView2 with cookie management, printing, user-agent overrides, JavaScript and zoom settings, document-created scripts, host-to-page messaging, and content lifecycle events.
  • Implements equivalent behavior for both Windows backends, including the default .NET 10 WebView2Aot backend.
  • Adds deterministic Win32 controller, event, and child-window cleanup.
  • Detaches and disposes native providers on Close, preserves host-only cookie scope and native navigation flags, and installs supported messaging bridges before application callbacks.
  • Adds samples, runtime tests, and public documentation for the new APIs and platform limitations.

Current platform support

Capability Win32 (WebView2Aot and managed SDK) macOS iOS Android WebAssembly X11/Linux
Cookie manager Implemented Implemented Implemented Partial; URI-scoped enumeration Unsupported Unsupported
User-agent override Implemented Implemented Implemented Implemented Unsupported Implemented
Enable/disable JavaScript Implemented Implemented Implemented Implemented Disabling unsupported Implemented
Document-created scripts Implemented Implemented Implemented Unsupported without a real document-start hook Unsupported Implemented
Host-to-page messaging Native WebView2 API Native bridge Document-start bridge Unsupported without a real document-start hook NavigateToString bridge only Document-start bridge
Printing PDF stream, settings, and print UI PDF and print UI; settings subset PDF and print UI; settings subset Print UI only Print UI only PDF and print UI
Zoom controls Implemented State only Implemented Implemented Disabling unsupported State only
Custom environment/controller options Implemented Private mode only Unsupported Unsupported Unsupported Unsupported
Content lifecycle events Implemented Implemented Partial Partial Actual document phases for NavigateToString; URI documents are not synthesized at load completion Partial

Unsupported platform requests fail explicitly instead of being silently ignored. Android's existing page-to-host channel is retained. Browser URI documents, including same-origin URI navigation, do not advertise the NavigateToString messaging bridge.

Validation

  • Compile: actual .NET 10 desktop, X11, Android and WebAssembly builds/publish succeeded with repository compiler/analyzer settings. No iOS trimming success is claimed for the latest source correction.
  • Unit: 57 focused cases passed, including cookie scope/identity, queued-callback lifetime and chooser cancellation.
  • Runtime (Win32): 11 real WebView2Aot cases passed, including cookie update/delete identity, native lifecycle behavior, and strict object-versus-JSON-looking-string message types.
  • Runtime (WASM): 12 cases passed in the published Uno app, including string/JSON initialization messages from ContentLoading, lifecycle ordering, URI rejection, close behavior and strict message types.
  • Original failure reproductions and focused follow-up reviews cover the corrected cookie, callback and bootstrap paths.
  • Earlier validation included 41/41 WebView2 sample files passing XAML Styler; no sample XAML was changed in this follow-up.

Exact-head CI build 234924 now passes all reported checks (64 successful, one neutral), including managed binaries, Linux runtime tests and the Release net11.0-ios simulator build. The iOS log confirms that assembly optimization/linking ran and completed with zero errors, so the IL2037 verification gate is satisfied. This does not imply unrecorded manual device or screen-reader testing.

CI follow-up: build 234907 exposed Apple CS8625 delegate-wrapper assignments before linking and stale Linux double-JSON expectations. Nullable native weak-delegate properties fix the compile boundary without suppression; the Linux assertions now require the exact WebView2 JSON type without changing production serialization or allowing alternative results. A real Apple-reference binding probe reproduces the compile errors before the correction and passes afterward; CI 234924 verifies the full managed/iOS build and Linux runtime paths.

PR Checklist ✅

Copilot AI lite review requested due to automatic review settings July 14, 2026 08:31
@github-actions github-actions Bot added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform area/automation Categorizes an issue or PR as relevant to project automation labels Jul 14, 2026

Copilot AI 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.

Pull request overview

This PR expands Uno’s WebView2 / CoreWebView2 implementation to better match WebView2 API behavior across platforms (Skia Win32/macOS, iOS, Android, WebAssembly, X11), including explicit initialization, lifecycle events, settings (User-Agent / JS / zoom), cookie management, printing, and postMessage support, plus new SamplesApp manual-test pages.

Changes:

  • Adds explicit WebView2.EnsureCoreWebView2Async(...) initialization (with optional environment/controller options) plus WebView2.Close() behavior and initialization error reporting.
  • Introduces cross-platform “capability” interfaces (ISupportsCookieManager, ISupportsPrint, ISupportsUserAgent, etc.) and wires them into native providers (Win32, macOS, iOS, Android, WASM, X11).
  • Updates WASM interop/TypeScript glue and adds SamplesApp manual tests for the new API surface.

Reviewed changes

Copilot reviewed 54 out of 70 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Uno.UI/UI/Xaml/Controls/WebView/WebView2/WebView2.Properties.cs Guards Source updates when closed; triggers implicit init on Source changes.
src/Uno.UI/UI/Xaml/Controls/WebView/WebView2/WebView2.cs Adds explicit init overloads, close/dispose behavior, and initialization event/error propagation.
src/Uno.UI/UI/Xaml/Controls/WebView/WebView2/CoreWebView2InitializedEventArgs.cs Adds internal ctor to carry initialization exceptions.
src/Uno.UI/UI/Xaml/Controls/WebView/WebView1/WebView.cs Implements new IWebView.RequiresExplicitInitialization contract for legacy WebView.
src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.wasm.cs Adds capability-interface implementations and improved navigation/message lifecycle for WASM iframe host.
src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.Interop.wasm.cs Adds JSImport entries for postMessage, print UI, and close.
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsZoomControl.cs New capability interface (zoom enable/disable).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsUserAgent.cs New capability interface (User-Agent override).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsScriptEnabled.cs New capability interface (JS enable/disable).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsPrint.cs New capability interface (print UI / PDF stream).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsPostWebMessage.cs New capability interface (native host-to-page messaging).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsDocumentCreatedScripts.cs New capability interface (document-start script injection).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsCookieManager.cs New capability interface (cookie store operations).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/ISupportsClose.cs New capability interface (explicit native close).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/iOSmacOS/UnoWKWebView.iOS.cs Adds iOS/macOS WebKit-backed implementations for settings, cookies, scripts, and printing.
src/Uno.UI/UI/Xaml/Controls/WebView/Native/Android/NativeWebViewWrapper.Android.cs Adds Android implementations for settings, cookies, scripts, and printing (UI only).
src/Uno.UI/UI/Xaml/Controls/WebView/Native/Android/InternalWebClient.Android.cs Injects document-created scripts at navigation start on Android.
src/Uno.UI/UI/Xaml/Controls/WebView/IWebView.cs Adds RequiresExplicitInitialization to control native creation timing.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2Settings.cs Adds UserAgent, IsScriptEnabled, IsZoomControlEnabled with change notifications.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2PrintSettings.cs Introduces a managed CoreWebView2PrintSettings surface + validation.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2EnvironmentOptions.cs Introduces managed environment options surface + default-value tracking.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2Environment.cs Introduces managed environment surface + factory methods.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2DOMContentLoadedEventArgs.cs Adds managed DOMContentLoaded event args.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2CookieManager.cs Adds managed cookie manager surface backed by capability interface.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2Cookie.cs Adds managed cookie model surface.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2ControllerOptions.cs Adds managed controller options surface.
src/Uno.UI/UI/Xaml/Controls/WebView/Core/CoreWebView2ContentLoadingEventArgs.cs Adds managed ContentLoading event args.
src/Uno.UI/ts/Windows/UI/Xaml/Controls/WebView.ts Updates WASM host glue for JSON-serialized script results, postMessage, printing, and close.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2Settings.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2ServerCertificateErrorDetectedEventArgs.cs Replaces not-implemented stub with usable managed shape.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2PrintSettings.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2PermissionRequestedEventArgs.cs Replaces not-implemented stub with usable managed shape.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2FrameCreatedEventArgs.cs Replaces not-implemented stub with usable managed shape.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2EnvironmentOptions.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2Environment.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2DownloadStartingEventArgs.cs Replaces not-implemented stub with usable managed shape.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2DOMContentLoadedEventArgs.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2CookieManager.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2Cookie.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2ControllerOptions.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2ContextMenuRequestedEventArgs.cs Replaces not-implemented stub with usable managed shape.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2ContentLoadingEventArgs.cs Adjusts generated stubs to defer to newly implemented managed members.
src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/CoreWebView2.cs Adjusts generated stubs to defer to newly implemented managed members/events/methods.
src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Controls/WebView2.cs Adjusts generated stubs to defer to newly implemented WebView2 members.
src/Uno.UI.Runtime.Skia.Win32/UI/Xaml/Controls/WebView/Win32NativeWebView.cs Adds Win32 implementations for cookies, printing, UA/JS/zoom, messaging, doc-created scripts, lifecycle events, and env/controller options.
src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOWebView.h Extends native macOS bridge API for lifecycle callbacks, printing, cookies, scripts, UA/JS, postMessage, and private mode creation.
src/Uno.UI.Runtime.Skia.MacOS/UI/Xaml/Controls/WebView/MacOSNativeWebViewProvider.cs Registers lifecycle + capability callbacks for macOS native webview.
src/Uno.UI.Runtime.Skia.MacOS/UI/Xaml/Controls/WebView/MacOSNativeWebView.cs Adds close/unregister logic, private mode creation option, and lifecycle callback wiring.
src/Uno.UI.Runtime.Skia.MacOS/UI/Xaml/Controls/WebView/MacOSNativeWebView.Capabilities.cs Implements macOS capabilities for UA/JS/zoom, messaging, scripts, cookies, and printing using native bridge callbacks.
src/Uno.UI.Runtime.Skia.MacOS/Native/NativeUno.cs Adds P/Invoke signatures for new native macOS webview bridge APIs.
src/SamplesApp/UITests.Shared/UITests.Shared.projitems Registers new manual SamplesApp WebView2 test pages.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_UserAgent.xaml.cs Adds manual sample for CoreWebView2Settings.UserAgent.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_UserAgent.xaml XAML for User-Agent sample page.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_Print.xaml.cs Adds manual sample for PDF printing + print UI.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_Print.xaml XAML for printing sample page.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_PostWebMessage.xaml.cs Adds manual sample for host-to-page messaging.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_PostWebMessage.xaml XAML for messaging sample page.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_LifecycleEvents.xaml.cs Adds manual sample for lifecycle event ordering/logging.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_LifecycleEvents.xaml XAML for lifecycle sample page.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_EnvironmentOptions.xaml.cs Adds manual sample for env/controller options initialization.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_EnvironmentOptions.xaml XAML for env/controller options sample page.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_DocumentCreatedScripts.xaml.cs Adds manual sample for document-created scripts.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_DocumentCreatedScripts.xaml XAML for document-created scripts sample page.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_CookieManager.xaml.cs Adds manual sample for cookie manager operations.
src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_CookieManager.xaml XAML for cookie manager sample page.
src/AddIns/Uno.UI.WebView.Skia.X11/X11NativeWebView.cs Adds capability implementations for X11 WebKitGTK provider (UA/JS/zoom/scripts/print; cookies remain unsupported).
src/.gitignore Ignores macOS runtime native output folder.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@morning4coffe-dev
morning4coffe-dev force-pushed the dev/doti/temp-webview2-improve branch from 5709802 to 83c8c1b Compare July 14, 2026 09:52
Copilot AI review requested due to automatic review settings July 14, 2026 09:52
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 5m 42s —— View job


PR Review: feat(webview2): Improve API parity across platforms

Tasks:

  • Gather context and understand the PR
  • Review core WebView2 changes (WebView2.cs, CoreWebView2.cs)
  • Review capability interfaces and implementations
  • Review platform-specific implementations (Android, iOS/macOS, WASM, X11, Win32)
  • Review cookie manager, print settings, environment options
  • Review tests and samples
  • Post inline comments for findings
  • Post summary

Summary

Verdict: fix-first — the PR is a solid, well-structured feature with good coverage across platforms and tests. A few issues should be addressed before it can land cleanly.

Issues by severity

Sev Count Details
Bug 2 Null URI forwarded to native cookie layer
Style 2 PascalCase parameters; missing braces on if setters
Concern 4 Fragile file URI construction; sync I/O inside async; silent exception swallow; silent UserAgent reset

Cross-cutting notes

Null URI in GetCookiesAsync — CoreWebView2CookieManager.GetCookiesAsync accepts null via string.IsNullOrEmpty, then forwards it directly to all native implementations. The Android JNI path (CookieManager.GetCookie(null)) is the primary crash risk; iOS silently catches it but masks the bad call. Fix at the manager layer (uri ?? string.Empty) and narrow the iOS catch {} to UriFormatException only.

ShowPrintUI async fire-and-forget — platform failures (GTK, native bridge) are silently swallowed. Add a logging continuation so failures surface in diagnostics.

Capability-interface design — the ISupports* interface decomposition is clean and follows the existing ISupportsWebResourceRequested pattern well. ISupportsCookieManager is correctly declared internal and the NotSupportedException message strings on WASM/X11 are clear and actionable.

Test coverage — runtime tests are well-scoped to macOS and WASM, cover the intended scenarios (lifecycle ordering, cookie round-trip, init idempotency, environment rejection), and use [PlatformCondition] correctly rather than #if. No [Ignore]d or Assert.Inconclusive tests found.

PR draft state — the description calls this out explicitly (rebase needed, platform-wide validation pending). The inline comments above apply to the code as-is; the overall shape of the implementation is sound.

Copilot AI 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.

Pull request overview

Copilot reviewed 53 out of 64 changed files in this pull request and generated 4 comments.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222223 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2346, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ContextRequested.png-dark
    • ContextRequested.png
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • ImageIconPage.png-dark
    • Buttons.png-dark
    • Buttons.png
  • skia-windows-screenshots: 2346 changed over 2390

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ApplicationViewMode.png
    • AppBarButtonWithIconTest.png-dark
    • AppBarButtonWithIconTest.png
    • AppWindowPositionAndSize.png-dark
    • AutoSizedPathCentered.png
    • AppWindowPresenters.png
    • AppWindowTitleBar Properties.png
    • AutoSuggestBox_Keyboard.png
    • Attributed_text_FontSize_Changing.png-dark
    • Attributed_text_Simple.png-dark
    • BasicEnability.png
    • AutoBorderStretchwithbottommargin.png-dark
    • AutoBorderStretchwithtopmargin.png-dark
    • BindableDrawerLayout_ChangePane.png
    • BadgeNotificationTests.png-dark
    • AutomationProperties_AutomationId.png-dark
    • BorderCenteredwithmargins.png
    • Basics.png
    • AutoSuggestBox_Keyboard.png-dark
    • BorderRightwithmargins.png
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Uno_Web.Http.CookieManagerTests
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal

Copilot AI review requested due to automatic review settings July 16, 2026 10:26
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Jul 16, 2026
@github-actions

github-actions Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 4m 31s —— View job


PR Review: feat(webview2): Improve API parity across platforms

Tasks:

  • Gather context and understand the PR
  • Review core WebView2 changes (WebView2.cs, CoreWebView2.cs)
  • Review capability interfaces and implementations
  • Review platform-specific implementations (Android, iOS/macOS, WASM, X11, Win32)
  • Review cookie manager, print settings, environment options
  • Review tests and samples
  • Post inline comments for findings
  • Post summary

Summary

Verdict: fix-first — the overall shape is sound and most of the issues from the prior review pass have been addressed. Three items remain before this can land cleanly.

Fixes confirmed since the prior review pass

Prior finding Status
Null URI forwarded through GetCookiesAsync to native ✅ Fixed — uri ??= string.Empty at line 87
ShowPrintUI silent exception swallow ✅ Fixed — ContinueWith(OnlyOnFaulted) logs the error
X11 fragile "file://" + tempFile URI construction ✅ Fixed — uses UriBuilder
X11 File.ReadAllBytes blocking read ✅ Fixed — File.ReadAllBytesAsync
iOS catch {} masking null URI ✅ Fixed — null check at the manager layer replaces the broad catch
Unused using Uno.Foundation.Logging in NativeWebView.wasm.cs ✅ Fixed — removed
Unused using directives in CoreWebView2CookieManager.cs ✅ Fixed — removed
Missing braces on if bodies in Win32 setters ✅ Fixed

Remaining issues

Sev File Finding
Style CoreWebView2CookieManager.cs:35 Domain, Path parameters are PascalCase — CI analyzers will fail
Style CoreWebView2CookieManager.cs:146 Same PascalCase violation in DeleteCookiesWithDomainAndPath
Bug X11NativeWebView.cs:99 PrintOperationResult from RunDialog is discarded; user cancellation always reports Succeeded
Concern Win32NativeWebView.cs:167 null UA is silently suppressed; macOS propagates null to reset the platform default — cross-platform asymmetry

Cross-cutting notes

Capability interface decomposition — the ISupports* pattern is clean, consistent with the existing ISupportsWebResourceRequested model, and correctly declared internal. NotSupportedException messages on WASM/X11 are actionable.

CoreWebView2Settings.UserAgent semantics — the "null/empty does not update" design is documented in the remarks and intentionally diverges from WinUI (where null resets to default). This is a deliberate trade-off, but it should be kept consistent across all native implementations — currently macOS passes null through while Win32 suppresses it.

Test coverage — well-scoped to macOS and WASM using [PlatformCondition], covering lifecycle ordering, cookie round-trip, init idempotency, and environment rejection. No [Ignore]d tests found.

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 241173 has failed on Uno.UI - CI.

Copilot AI lite review requested due to automatic review settings October 24, 2026 13:26

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 24s —— View job


PR Review (latest push 41a72440)

Verdict: fix-first (one minor item)

Reviewed the new commits since the last "ship" pass: 41a72440 (cookie sample catch narrowing), 14745cd1 (unit test classes on the UI thread), and the merges and earlier commits in between. The test-class change is a clean fix.

Severity Count
Concern 1

The one finding is posted inline. 41a72440 narrows the catch in the async void handlers OnLoaded and OnListClick of WebView2_CookieManager.xaml.cs to ArgumentException, InvalidOperationException and NotSupportedException. Any other exception, such as a COMException from a native cookie store, would escape the async void and crash the sample app. This contradicts the repo's async void try/catch rule. It is sample-only code and a small fix.

I didn't re-audit the earlier native, X11, macOS or iOS changes. They were covered and confirmed fixed in the prior passes.

@morning4coffe-dev
morning4coffe-dev requested review from MartinZikmund and ajpinedam and removed request for MartinZikmund and ajpinedam October 24, 2026 13:26
}
OutputText.Text = sb.ToString();
}
catch (Exception ex) when (ex is ArgumentException or InvalidOperationException or NotSupportedException)

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.

This catch is inside an async void handler (OnListClick, same for OnLoaded at line 25). Narrowing it to three exception types means anything else — e.g. COMException/IOException from the native cookie store, or OperationCanceledException — escapes the async void and tears the app down. The repo rule is that async void needs a wrapping try/catch. Either keep the broad catch in these handlers (the previous revision, with its comment) or add a final catch-all that reports to OutputText.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 241181 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2454

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
  • skia-windows-screenshots: 2454 changed over 2490

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png
    • AnimatedIconPage.png
    • AnimatedVisualsTestbedPage.png
    • AppBarToggleButtonTest.png
    • ApplicationViewSpanningRectsPage.png-dark
    • AppWindowFeatures.png-dark
    • AppWindowPresenters.png
    • Arrange_Performance01.png-dark
    • Attributed_text_Supserscript.png-dark
    • Attributed_text_Supserscript.png
    • AutomationPropertiesExtensions_Role.png
    • AutomationProperties_AutomationId.png-dark
    • AutoSuggestBox_BitmapIcon.png-dark
    • AutoSuggestBox_BitmapIcon.png
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics_Automated.png-dark
    • Basics_Automated.png
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 241181 has failed on Uno.UI - CI.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @morning4coffe-dev's task in 39s —— View job


PR Review: feat(webview2): Improve API parity across platforms

Verdict: ship after a minor fix. I scoped this pass to the commits since the last review: the master merge (5148febee), the sample catch-narrowing (41a724406), the unit-test UI-thread fix, and the pointer-input/theme-backdrop work. I didn't re-audit the earlier, already-reviewed code. I haven't built or run anything for this pass, so the findings below come from reading the diff only.

Severity Count
Concern 1 (inline)

Cross-cutting notes

  • The narrowed catch filters in WebView2_CookieManager.xaml.cs sit inside async void handlers. That removes the "never crash on async void" safety that the repo's async rules call for. Check the other WebView2 sample pages for the same pattern.
  • The merge commit pulls in about 900 unrelated files from master. I did not review them, but nothing in them touches the WebView2 surface.
  • Earlier findings (HistoryChanged unsubscription, X11 print result, JsonDocument disposal, iOS TCS threading) were reported fixed in prior passes. I did not re-verify them here.
  • The screenshot diffs and the review workflow's context-size failure are noted in earlier comments and are unrelated to this code.
    · branch dev/doti/temp-webview2-improve

}
OutputText.Text = sb.ToString();
}
catch (Exception ex) when (ex is ArgumentException or InvalidOperationException or NotSupportedException)

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.

Narrowing this catch inside an async void handler means any other exception (e.g. IOException, COMException, OperationCanceledException from the native layer) now escapes and tears down the app. The removed comment was the reason the broad catch existed. Either keep the broad catch for async void handlers, or add COMException/IOException/OperationCanceledException to the filter. This also applies to the init handler at line ~25.

@mergify

mergify Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

Comment on lines +180 to +189
foreach (var remaining in _documentCreatedScripts.Values)
{
using var script = new WebKit.UserScript(
remaining,
WebKit.UserContentInjectedFrames.AllFrames,
WebKit.UserScriptInjectionTime.Start,
null,
null);
_webview.UserContentManager.AddScript(script);
}
Comment on lines +328 to +334
foreach (var cookie in cookies)
{
if (string.Equals(cookie.Name, name, System.StringComparison.Ordinal))
{
await RunCookieMutation(handle => NativeUno.uno_webview_delete_cookies(GetCapabilityHandle(), handle, cookie.Name, cookie.Domain, cookie.Path));
}
}
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 246706 found UI Test snapshots differences: skia-linux-screenshots: 240, skia-windows-screenshots: 475

Details
  • skia-linux-screenshots: 240 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppWindowTitleBar Properties.png-dark
    • BenchmarkDotNet.png-dark
    • BenchmarkDotNet.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppWindowTitleBar Properties.png
    • AutomationProperties_AutomationId.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Accessibility_Showcase.png
    • Basics.png-dark
    • Basics.png
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • Accessibility_Showcase.png-dark
    • AnimatedBackVisualSourceSamplePage.png
    • AutomationProperties_StructureAndProps.png-dark
  • skia-windows-screenshots: 475 changed over 2496

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ClipboardTests.png
    • AnimatedVisualsTestbedPage.png-dark
    • AutomationProperties_AutomationId.png
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • CenteredGridinGridwiththreefixedsizechildren.png-dark
    • CenteredGridinGridwiththreefixedsizechildren.png
    • CenteredGridinGridwithtwofixedsizechildren.png-dark
    • CenteredGridinGridwithtwofixedsizechildren.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • BasicAcrylicBrushTest2.png-dark
    • BasicAcrylicBrushTest2.png
    • Border_CornerRadius_BorderThickness.png-dark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform platform/macos 🍏 Categorizes an issue or PR as relevant to the macOS platform platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebView2] Implement CoreWebView2EnvironmentOptions Adding a User Agent Definition to WebView Webview2 Implementation of CookieManager

5 participants