Closed Bug 2086760 Opened 29 days ago Closed 24 days ago

Crash in nsWindow::TryDwmResizeHack when a window opened with sizemode="fullscreen" is the session's first fullscreen entry

Categories

(Core :: Widget: Win32, defect)

defect

Tracking

()

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: florian, Assigned: florian)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

On Windows 11, when the first fullscreen entry of the session comes from a XUL window opened with sizemode="fullscreen", the window goes fullscreen from AppWindow::BeforeStartLayout, before any renderer exists. The heuristics in nsWindow::TryDwmResizeHack then dereference the null mWindowRenderer. That is a null-deref crash in opt builds and a MOZ_ASSERT in debug builds.

It reproduces every time with https://tests.firefox.dev/test.html?test=dom/base/test/fullscreen/test_fullscreen.xhtml in the windows11 mochitest-chrome-standalone jobs, which restart the browser before each test. Those jobs currently skip the test (the skip was added in bug 2026600).

The fix skips the hack for a window that has no renderer yet, before the one-shot sIsFirstFullscreenEntry flag is used up, so the hack still applies to the next fullscreen entry. This assumes such a window cannot hit the DWM bug, which targets maximized windows going fullscreen.

When a window opened with sizemode="fullscreen" is the session's first fullscreen entry on Windows 11, nsWindow::TryDwmResizeHack dereferences a null mWindowRenderer, crashing on a null deref in opt and on a MOZ_ASSERT in debug.

The hack targets maximized windows going fullscreen; such a window was never shown maximized. Returning before sIsFirstFullscreenEntry is consumed keeps the hack for the next fullscreen entry. The early return also applies when widget.windows.apply_dwm_resize_hack forces the hack.

This removes the Windows standalone skip of test_fullscreen.xhtml added in bug 2026600.

Severity: -- → S3
Blocks: 2086769
Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/60ce1ea25c7e https://hg.mozilla.org/integration/autoland/rev/69a158a7e67c Skip the DWM resize hack for windows entering fullscreen before their first paint, r=win-reviewers,gstoll.
Status: ASSIGNED → RESOLVED
Closed: 24 days ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
QA Whiteboard: [qa-triage-done-c162/b161]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: