Skip to content

fix(runtime): treat a WinUI host as a XAML host everywhere - #59

Merged
triniwiz merged 1 commit into
mainfrom
fix/xaml-host-detection
Nov 21, 2026
Merged

triniwiz merged 1 commit into
mainfrom
fix/xaml-host-detection

Conversation

@triniwiz

Copy link
Copy Markdown
Member

Follow-up to #58.

Problem

Under WinUI 3, needs_win32_pump() was true too. The runtime makes its own DispatcherQueueController there, because WinUI's dispatcher isn't a Windows.System.DispatcherQueue. So code keyed on needs_win32_pump() behaved as if there were no XAML host:

  • defer_microtask_drain never deferred. JS delegates, requestAnimationFrame callbacks and the other native-to-JS entry points drained Promise continuations inline. That includes running them inside XAML callouts such as the render walk, which is the 0xC000027B fail-fast the deferral exists to prevent.
  • __nsWorkerPushesMessages was false. Every worker.postMessage blocked the UI thread polling for replies (up to 100 × 5 ms). Replies are posted to the UI thread's dispatcher, which XAML's loop runs anyway.

Fix

needs_win32_pump() is now false when host_pumps_messages() is true. All of the above follow from that one definition, and runtime_pump_timers no longer needs its separate check from #58.

Testing

  • Tested: classic V8 release-with-devtools, together with fix(runtime): pick between same-arity overloads by argument type #60, in a WinUI 3 game that renders every frame (pixi.js on WebGPU). The menu renders, play joins the server, the game runs, and closing the window ends the process.
  • Not tested: the worker path under WinUI; that app doesn't use workers.

needs_win32_pump() was true under WinUI 3 as well (the runtime makes its
own DispatcherQueueController there, since WinUI's dispatcher isn't a
Windows.System.DispatcherQueue), so code keyed on it acted as if there
were no XAML host:
- defer_microtask_drain never deferred: JS delegates, rAF callbacks and
  the other native-to-JS entry points drained Promise continuations
  inline, inside XAML callouts such as the render walk (the
  0xC000027B fail-fast the deferral exists to prevent)
- __nsWorkerPushesMessages was false: every worker.postMessage blocked
  the UI thread polling for replies (up to 100 x 5 ms), though replies
  are posted to the UI thread's dispatcher, which XAML's loop runs

needs_win32_pump() is now false when host_pumps_messages(), so all of
these follow from one definition, and runtime_pump_timers needs no
separate check.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 155c84bd-888d-4ccd-a306-3ab4232c6d10

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@triniwiz
triniwiz merged commit 7942b28 into main Nov 21, 2026
1 of 3 checks passed
@triniwiz
triniwiz deleted the fix/xaml-host-detection branch November 21, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant