Closed Bug 1857032 Opened 1 year ago Closed 1 year ago

Perma dom/tests/mochitest/bugs/test_sizetocontent_clamp.html failure on new Ubuntu 22.04 Wayland pool

Categories

(Core :: Widget: Gtk, defect, P3)

defect

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: ahal, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

This is happening on a new Ubuntu 22.04 Wayland enabled pool we're in the process of standing up.

Example failure log:
https://treeherder.mozilla.org/logviewer?job_id=431033476&repo=try&lineNumber=8932

[task 2023-10-02T16:24:20.751Z] 16:24:20     INFO - TEST-START | dom/tests/mochitest/bugs/test_sizetocontent_clamp.html
[task 2023-10-02T16:24:21.690Z] 16:24:21     INFO - TEST-INFO | started process screentopng
[task 2023-10-02T16:24:25.717Z] 16:24:25     INFO - TEST-INFO | screentopng: exit 0
[task 2023-10-02T16:24:25.717Z] 16:24:25     INFO - Buffered messages logged at 16:24:20
[task 2023-10-02T16:24:25.717Z] 16:24:25     INFO - must wait for load
[task 2023-10-02T16:24:25.717Z] 16:24:25     INFO - Buffered messages logged at 16:24:21
[task 2023-10-02T16:24:25.717Z] 16:24:25     INFO - must wait for load
[task 2023-10-02T16:24:25.718Z] 16:24:25     INFO - must wait for focus
[task 2023-10-02T16:24:25.720Z] 16:24:25     INFO - got resize: 300 300
[task 2023-10-02T16:24:25.721Z] 16:24:25     INFO - got resize: 122 100
[task 2023-10-02T16:24:25.721Z] 16:24:25     INFO - Buffered messages finished
[task 2023-10-02T16:24:25.723Z] 16:24:25     INFO - TEST-UNEXPECTED-FAIL | dom/tests/mochitest/bugs/test_sizetocontent_clamp.html | innerWidth should be between 100 and 100 but it was: 122 
[task 2023-10-02T16:24:25.723Z] 16:24:25     INFO -     SimpleTest.ok@SimpleTest/SimpleTest.js:426:16
[task 2023-10-02T16:24:25.723Z] 16:24:25     INFO -     test/</w.onresize@dom/tests/mochitest/bugs/test_sizetocontent_clamp.html:53:9
[task 2023-10-02T16:24:25.723Z] 16:24:25     INFO -     EventHandlerNonNull*test/<@dom/tests/mochitest/bugs/test_sizetocontent_clamp.html:44:5
[task 2023-10-02T16:24:25.724Z] 16:24:25     INFO -     SimpleTest.waitForFocus/<@SimpleTest/SimpleTest.js:1058:13
[task 2023-10-02T16:24:25.725Z] 16:24:25     INFO - TEST-PASS | dom/tests/mochitest/bugs/test_sizetocontent_clamp.html | innerHeight should be around 100 but it was: 100 
[task 2023-10-02T16:24:25.726Z] 16:24:25     INFO - must wait for focus
[task 2023-10-02T16:24:25.731Z] 16:24:25     INFO - GECKO(14376) | 1696263861782	Marionette	TRACE	Received observer notification browser-delayed-startup-finished
[task 2023-10-02T16:24:25.732Z] 16:24:25     INFO - GECKO(14376) | console.error: (new TypeError("error loading dynamically imported module: chrome://global/content/elements/moz-button-group.mjs", ""))
[task 2023-10-02T16:24:25.733Z] 16:24:25     INFO - GECKO(14376) | MEMORY STAT | vsize 2443MB | residentFast 122MB | heapAllocated 14MB
[task 2023-10-02T16:24:25.733Z] 16:24:25     INFO - TEST-OK | dom/tests/mochitest/bugs/test_sizetocontent_clamp.html | took 1326ms

It's unclear whether this is a result of Wayland, upgrading to Ubuntu 22.04 or hardware characteristics of the new workers. The test will be skipped on this new platform.

No longer depends on: 1857022
Severity: -- → S3

It's Wayland only. XWayland works fine:

Works:
MOZ_ENABLE_WAYLAND=0 ./mach test dom/tests/mochitest/bugs/test_sizetocontent_clamp.html

Fails:
MOZ_ENABLE_WAYLAND=1 ./mach test dom/tests/mochitest/bugs/test_sizetocontent_clamp.html

Looks like widget issue.

Assignee: nobody → stransky
Component: DOM: Core & HTML → Widget: Gtk
Priority: -- → P3
Flags: needinfo?(stransky)

Looks like we fail to resize hidden (unmapped) window on Wayland.

(In reply to Martin Stránský [:stransky] (ni? me) from comment #2)

Looks like we fail to resize hidden (unmapped) window on Wayland.

I'm wrong here; It's because mutter (Wayland compositor) set's minimal window sizes as:

 0:05.34 GECKO(72201) [2745786.884]  -> xdg_toplevel@61.set_min_size(180, 132)
 0:05.34 GECKO(72201) [2745786.886]  -> xdg_toplevel@61.set_max_size(8140, 8140)

Min window size is based on screen size so it differs with screen resolution. For 4K/200% scale is 180.

I investigated it more and it's caused directly by Gtk/Wayland backend (or a bug in Gtk/X11 code).

We use CSD window decorations which means GtkWindow contains GtkHeaderbar widget. If widget minimal size is computed it checks minimal size of child widgets which is GtkHeaderbar and 180 pixels in Adwaita theme.

But why we don't see this bug on X11? Because gtk_window_should_use_csd() returns false by default on X11 so we create GtkWindow without CSD/GtkHeaderbar widget. GtkHeaderbar is added later in nsWindow::SetDrawsInTitlebar() where we enable rendering to GtkWindow titlebar and force GtkWindow to use CSD.

But widget minimal sizes are cached by Gtk so widget size cache on X11 contains old non-CSD widget size which is 0 for non-CSD GtkWindow.

There are some options:

  1. Make gtk_window_should_use_csd() return true on both X11 and Wayland. We can set GTK_CSD env variable to force CSD for X11 from beginning and adjust the tests for both X11 and Wayland (and perhaps other tests which may fail here as widget minimal size is changed).
  2. Adjust the tests for Wayland only.
Flags: needinfo?(stransky)

Andrew, what do you think?

Flags: needinfo?(ahal)

I don't really have expertise or opinions on specific issues like this, and I see you're already a peer in this module so happy to defer to your judgement. Maybe :karlt has thoughts?

Flags: needinfo?(ahal) → needinfo?(karlt)

I guess I do have an opinion after all..

If option 1 means we might fix other tests, that sounds great to me. But I have no idea what other consequences changing gtk_window_should_use_csd might have.

Thank you, Martin for identifying the reasons for the difference in behavior.

Should the bug summary say "permafail" instead of "intermittent" then?

Given bug 764240, I expected the test to be testing that the window is not too small. I don't know why it cares if the window is slightly too large.

The test already has variations across platforms. I'd just adjust innerWidthMax in the test on Linux to be large enough to accommodate the variability of GTK themes, or at least accommodate the default GTK theme.

Flags: needinfo?(karlt)

Hm, yeah I don't see it passing anywhere.. must have been a copy/paste error from one of the dozens of other bugs I was filing.

Summary: Intermittent dom/tests/mochitest/bugs/test_sizetocontent_clamp.html failure on new Ubuntu 22.04 Wayland pool → Perma dom/tests/mochitest/bugs/test_sizetocontent_clamp.html failure on new Ubuntu 22.04 Wayland pool

(In reply to Andrew Halberstadt [:ahal] from comment #8)

I guess I do have an opinion after all..

If option 1 means we might fix other tests, that sounds great to me. But I have no idea what other consequences changing gtk_window_should_use_csd might have.

That means we create the widgets as intended but they have a minimal size by default. It may break tests but we'll test what we ship (as CSD will be enabled later anyway). You can try to set GTK_CSD=1 env variable and look at test results on X11.

Will look at the GTK_CSD variant to use correct window creation on both X11 and Wayland.

Flags: needinfo?(stransky)

Set GTK_CSD env variable if we use CSD decorations. It ensures that correct GtkWindow sizes are cached
by Gtk size cache on X11 on gtk_widget_realize() call.

Let's look at try how it passes.

Flags: needinfo?(stransky)
Attachment #9358844 - Attachment description: Bug 1857032 [Linux] If we use CSD decorations for GtkWindow set CSD early to use correct GtkWindow sizes r?emilio → Bug 1857032 [Linux] Don't explicily call widget realize on nsWindow::Create() r?emilio
Attachment #9358845 - Attachment description: Bug 1857032 [Linux] Set minimal window size to 180 pixels to count CSD decorations size for test_sizetocontent_clamp.html r?ahal → Bug 1857032 [Linux] Test GtkWidget minimal window size range between 100 and 180 pixels on Linux due to CSD decorations size for test_sizetocontent_clamp.html r?ahal
Pushed by stransky@redhat.com: https://hg.mozilla.org/integration/autoland/rev/0d8b97ff600c [Linux] Don't explicily call widget realize on nsWindow::Create() r=emilio https://hg.mozilla.org/integration/autoland/rev/e9280f35a02b [Linux] Test GtkWidget minimal window size range between 100 and 180 pixels on Linux due to CSD decorations size for test_sizetocontent_clamp.html r=ahal
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: