fix(canvas): don't hold SurfaceData mut borrow over window resize#35993
Merged
bartlomieju merged 6 commits intoJul 15, 2026
Merged
Conversation
Deno Individual Contributor License AgreementAll contributors have signed the CLA. Thank you! This is an automated message from CLA Assistant |
Giesch
force-pushed
the
fix/byow-surface-resize-double-borrow
branch
from
July 12, 2026 20:40
3574364 to
778543f
Compare
Adds a unit test that creates a real native window over FFI (win32 or x11), configures a webgpu context on a Deno.UnsafeWindowSurface, and resizes it. Without the previous commit, the width/height setters panic with a RefCell double borrow when the configured context is resized. Also passes --unstable-webgpu to webgpu_test in the unit test harness; without it Deno.UnsafeWindowSurface is undefined, and the existing UnsafeWindowSurface tests only passed because constructing undefined also throws. Co-Authored-By: Claude Fable 5 <[email protected]>
Giesch
force-pushed
the
fix/byow-surface-resize-double-borrow
branch
from
July 13, 2026 02:20
ed1bc13 to
a9e3c66
Compare
…m [ci] Moves the windowing-system availability check to the top level of webgpu_test.ts so the resize regression test is reported as ignored instead of silently passing, and makes in-test window creation failures explicit test failures. Also pins the expected error type and message in the UnsafeWindowSurface constructor tests. Co-Authored-By: Claude Fable 5 <[email protected]>
crowlKats
self-requested a review
July 13, 2026 13:32
Giesch
marked this pull request as ready for review
July 13, 2026 15:16
petamoriken
reviewed
Jul 13, 2026
petamoriken
reviewed
Jul 13, 2026
Co-authored-by: Kenta Moriuchi <[email protected]> Signed-off-by: Dan Gieschen Knutson <[email protected]>
Co-authored-by: Kenta Moriuchi <[email protected]> Signed-off-by: Dan Gieschen Knutson <[email protected]>
bartlomieju
pushed a commit
that referenced
this pull request
Jul 15, 2026
…5993) Fixes #35992 --------- Signed-off-by: Dan Gieschen Knutson <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: Kenta Moriuchi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #35992. I've used Claude Code while working on this PR.
The original issue was a panic when resizing a window when using the
rawwebgpu desktop backend. This change addresses that by explicitly dropping theRefMutused to modify the width/height.The added test opens a real FFI window. If that's undesirable, then we could potentially remove it. But, I think the alternative test would be a more invasive change to set up mockable traits for windowing, which might be even less desirable.
The intent is that the X11 version of the test is optional, and that the Windows version is required for CI. I'm not able to try out the Windows version locally right now, though. We'll need to check the PR's CI run.
One broader change that might be a better alternative than this fix would be to change width and height into plain
Cell<u32>properties, with no runtime borrow-checking. There's already no atomicity between width and height, and it seems like the other properties are intended to be read-only. That would make the test redundant, because the panic would no longer be possible.