Repository navigation
Description
Current behavior 🐛
On Skia, several CoreWebView2 members that WebView2-based libraries depend on are [NotImplemented("__SKIA__")] stubs (checked on current master, src/Uno.UI/Generated/3.0.0.0/Microsoft.Web.WebView2.Core/):
CoreWebView2Environment.CreateWithOptionsAsync(...)throwsNotImplementedException.CoreWebView2Environment.CreateWebResourceResponse(...)throws.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync(...)throws.CoreWebView2.PostWebMessageAsString(...)is a no-op (raises "not implemented" throughTryRaiseNotImplemented).CoreWebView2.DOMContentLoadedis never raised.- On macOS,
WebResourceRequestedcan change navigation headers, but a handler cannot supply a response body, so requests cannot be served from managed code (observed with a decompile ofUno.UI 7.0.0-dev.763; not re-checked againstmaster).
MAUI's stock BlazorWebView handler (Microsoft.AspNetCore.Components.WebView.Maui 10.0.101, WinUI handler) uses these members, so it cannot run on Skia: the handler faults silently (its _webviewReadyTask faults with NotImplementedException and nothing awaits it) and the Razor component never starts.
Expected behavior 🎯
Either the members work on Skia, or they fail with a documented, explicit exception, so WebView2-based libraries (MAUI BlazorWebView and others using WebResourceRequested, document-created scripts or web messages) can run or fail clearly.
How to reproduce it (as minimally and precisely as possible) 🔬
- New MAUI app with a
BlazorWebView(aRootComponentsentry and a simple.razorcomponent), run through a Uno Skia desktop head (for example with https://github.com/unoplatform/uno.maui.renderer). - Run on macOS.
- The component never renders; no exception is logged.
Workaround 🛠️
A subclass handler that serves the app's static files over a loopback HttpListener and uses only the members Uno implements. It exposes local files to other local processes, so it is a diagnostic, not a recommendation.
Renderer 🎨
Skia
Affected platforms 📱💻🖥️
Skia Desktop (macOS verified; the stubs are __SKIA__-wide)
Suggested direction
- macOS: a custom-scheme handler (for example
WKURLSchemeHandler) soWebResourceRequestedcan supply a response. - Implement
CreateWebResourceResponse,AddScriptToExecuteOnDocumentCreatedAsync,PostWebMessageAsStringandDOMContentLoadedon Skia, or throw explicit documented exceptions where they stay unsupported. - Make
CreateWithOptionsAsyncreturn a usable environment, or document the Skia path.
Design and plan
Replaces the loopback HttpListener workaround above. Split into small PRs (the earlier all-in-one #23754 is reference only). All are drafts.
Spec
A stock MAUI BlazorWebView needs, from Microsoft.UI.Xaml.Controls.WebView2 / CoreWebView2:
CoreWebView2Environment.CreateWithOptionsAsync/CreateAsync,CreateWebResourceResponse,CoreWebView2EnvironmentOptions,EnsureCoreWebView2Async(environment[, options]). MAUI only uses the environment to build responses, then calls the parameterlessEnsureCoreWebView2Async().AddWebResourceRequestedFilter("*", All)+WebResourceRequestedwithResponseset forhttps://0.0.0.1/, possibly after awaits (a real deferral).AddScriptToExecuteOnDocumentCreatedAsync(defineswindow.externaloverchrome.webview),DOMContentLoaded,WebMessageReceivedwithSourceunder the virtual host,PostWebMessageAsString/Json.
Win32 forwards to the real WebView2. Other targets need a host-side implementation.
Per platform
| Target | Approach |
|---|---|
| Win32 | forward to real WebView2 (managed response accepted) |
| macOS, iOS | WKWebView cannot intercept https: WKURLSchemeHandler for a custom scheme (uno-app), URLs translated back to https:// at the Uno boundary |
| Android | ShouldInterceptRequest already sees https://; accept any response, real deferral, scripts injected into intercepted HTML (no AndroidX.WebKit yet) |
| Linux X11 | WebKitGTK custom URI scheme, same translation as Apple. Not started |
| WASM | iframe cannot intercept; would need a service worker. Deferred: throw a clear NotSupportedException |
0.0.0.0/8 is treated as a virtual host by default (shared layer in #25594).
PRs
| PR | Base | Content | State |
|---|---|---|---|
| #25593 | master | detached CoreWebView2Environment, options, CreateWebResourceResponse |
19 unit tests; macOS runtime tests pass |
| #25592 | master | document scripts, PostWebMessage*, DOMContentLoaded, Source |
11 unit tests; desktop/Android/iOS build; Win32 runtime tests compiled, not run |
| #25594 | dev/doti/webview2-stack (merge of the two above) |
shared bridge, virtual host map, response snapshot | 121 unit tests |
| #25598 | #25594 | macOS + iOS scheme handler | macOS runtime tests on real WKWebView pass (21 passed, 5 Win32-only skipped); iOS builds only |
| #25599 | #25594 | Android responses, deferral, script injection | builds, 159 unit tests; no runtime run (emulator would not start) |
Not verified yet
- Win32, X11, WASM, iOS simulator, Android runtime.
uno-app://as a secure context in WKWebView.- End to end with a stock MAUI
BlazorWebView(e.g. MarvelousMAUI photo grid) without the loopback handler. - Remaining work: Linux X11 scheme, the e2e check, retargeting the stacked PRs to
masteras the base PRs merge.
Open maintainer questions are in the comment above (virtual 0.0.0.0/8 default, scheme name, AndroidX.WebKit dependency, WebKitGTK version floor, NotSupportedException vs silent no-op).
Activity
morning4coffe-dev commentedon Oct 20, 2026
Splitting the older draft #23754 into smaller PRs so these gaps can be reviewed and landed one at a time. Draft PRs open:
CoreWebView2Environment.CreateAsync/CreateWithOptionsAsync(detached environment),CreateWebResourceResponse(managed response),CoreWebView2EnvironmentOptionsas data,EnsureCoreWebView2Async(environment); Win32 accepts a managed response.AddScriptToExecuteOnDocumentCreatedAsync,PostWebMessageAsString/Json,DOMContentLoaded,WebMessageReceivedEventArgs.Source: the API surface through new internal capability interfaces, forwarded to the real WebView2 on Win32.Next, as separate PRs (not started yet): a shared
chrome.webviewbridge and virtual-host layer for hosts without a native one, then one PR per platform: Android (ShouldInterceptRequestresponses with deferrals), macOS and iOS (aWKURLSchemeHandlerwith URL rewriting from the virtual host), Linux X11 (WebKitGTK custom scheme).Design questions for the maintainers, for the WebKit hosts (macOS, iOS, Linux), where
httpscannot be intercepted:0.0.0.0/8range (what Blazor's WebView uses) as a virtual host by default, and rewrite those URLs to a custom scheme internally (soSource/Uristill report thehttpsURL)? Which scheme name would you prefer?addDocumentStartJavaScript/addWebMessageListener? (Otherwise the script would be injected into intercepted HTML.)NotSupportedExceptioninstead of silently doing nothing, as MAUI only catchesFileNotFoundExceptionand the failure is otherwise silent?webkit_uri_scheme_request_finish_with_responseneeds 2.36.The browser (iframe) host cannot intercept requests; that would need a service worker and is out of scope for now.