Closed Bug 1883532 Opened 5 months ago Closed 12 days ago

X11: Firefox does not set Override Redirect flag on notification windows

Categories

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

Firefox 123
Desktop
Linux
defect

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: illia, Assigned: stransky, NeedInfo)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0

Steps to reproduce:

This is specific to X11.

Notification windows created for web notifications do not have the Override Redirect flag set. As a result, window managers start managing those window positions.
In particular, tiling window managers will treat the notification window as a top level application window, most likely positioning it incorrectly.

  1. Go to https://www.bennish.net/web-notifications.html.
    Click "Authorize" and allow notifications from this website.
    Click "Show".

    Depending on your window manager, the notification window may appear in an unexpected location on the screen. For a tiling window manager I use, it is resized to take the whole screen, as if I've started a new application.

  2. Run xwininfo and click on the created notification window to see if the Override redirect flag is set.

Actual results:

I see this:

xwininfo: Window id: 0x2800209 (has no name)
  [...position properties...]
  Depth: 32
  Visual: 0x82
  Visual Class: TrueColor
  Border width: 3
  Class: InputOutput
  Colormap: 0x280002c (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  [...size-properties...]

Expected results:

As Override Redirect State: no is not set, my window manager treats this notification window as a top level window. Positioning and resizing it incorrectly.

I've noticed this behavior over the last couple of weeks or a month or so.

Here is an xwininfo output from Chrome for the same notification window:

xwininfo: Window id: 0x740001b (has no name)
  [...position properties...]
  Depth: 24
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: yes
  [...size-properties...]

Firefox sets the _NET_WM_WINDOW_TYPE property to _NET_WM_WINDOW_TYPE_NOTIFICATION for the notification windows.
The EWMH specification also suggests the following:

This property is typically used on override-redirect windows.

Full xprop output for a notification window created by Firefox:

_NET_WM_OPAQUE_REGION(CARDINAL) =
_NET_WM_DESKTOP(CARDINAL) = 6
_NET_WM_STATE(ATOM) =
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                window id # of group leader: 0x2800001
_GTK_THEME_VARIANT(UTF8_STRING) = "dark"
_NET_WM_BYPASS_COMPOSITOR(CARDINAL) = 2
WM_WINDOW_ROLE(STRING) = "alert"
XdndAware(ATOM) = BITMAP
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x2, 0x0, 0x0, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NOTIFICATION
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 41943423, 41943424
_NET_WM_USER_TIME(CARDINAL) = 1427931
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x280017e
WM_CLIENT_LEADER(WINDOW): window id # 0x2800001
_NET_WM_PID(CARDINAL) = 75017
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "[cut]"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                program specified location: 0, 0
                program specified minimum size: 0 by 0
                program specified maximum size: 16384 by 16384
                program specified base size: 0 by 0
                window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "Alert", "firefox"
WM_ICON_NAME(STRING) =
_NET_WM_ICON_NAME(UTF8_STRING) =
WM_NAME(STRING) =
_NET_WM_NAME(UTF8_STRING) =

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Marking as new for engineering input. If component is not correct please update. Thank you.

Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → Linux
Hardware: Unspecified → Desktop

Is that a recent regression or it worked before?
Thanks.

Flags: needinfo?(illia.bobyr)
Priority: -- → P3

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

Is that a recent regression or it worked before?
Thanks.

I've noticed this behavior over the last couple of weeks or a month or so.
Currently, I'm observing it on 123.0.
An I'm running Firefox stable in Ubuntu, updating automatically.
So, my guess, is that this behavior was charged in the last one or two releases.

I do not think Firefox was showing any notification windows before at all.
My setup does not have a notification system on dbus, so I didn't see anything previously.
And now I see windows that open to cover the whole screen :)

Flags: needinfo?(illia.bobyr)

Can you use mozregression to find broken commit?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Use_Mozregression_tool

Which desktop do you use? Please attach your about:support page.
Thanks.

Flags: needinfo?(illia.bobyr)

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

Can you use mozregression to find broken commit?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Use_Mozregression_tool

Which desktop do you use? Please attach your about:support page.
Thanks.

I can do it, but I'll will not have access to the machine where I've experienced the issue until about 2 weeks from now.
If nobody beats me to it, I'll post the mozregression results.

Similarly, would be able to post the output of about:support only in 2 weeks or so.
I'm running an xmonad based X11 desktop, with some components from the stock Ubuntu desktop (whatevern it is).
I do not have a notification service running.
And, it seems, Firefox reacts to an inability to send a notification by creating a window by itself.

I've added a small utility to xmonad, to deal with the fact that Firefox does not manage those notification windows, and in the same PR people suggested that this is a Firefox bug.
Based on the EWMH specification, it seems like a fair statement to me.
I've proveded a link to EWMH above.

Flags: needinfo?(illia.bobyr)

Sorry for a slow response.

mozregresson helped me find a specific change that introduced this issue.
It is this one: https://hg.mozilla.org/integration/autoland/rev/7fd01e6f31ce57069cf70c613f2002a828d068c7
Here is the bug that was tracking the change: https://bugzilla.mozilla.org/show_bug.cgi?id=1870512

From a cursory read of the bug text and the change text, I can not understand if the X11 breakage was intentional, or was just a side effect.
I also do not have a working Wayland setup at hand. But considering the issue is X11 specific, I am not sure if there is anything useful I can check on Wayland.

Emilio Cobos Álvarez (:emilio) maybe you could take a quick look?

Flags: needinfo?(emilio)

Isn't this bug 1882033, which was fixed for 125?

Flags: needinfo?(emilio) → needinfo?(illia.bobyr)

I see the issue in 126 still.
Though, it does look similar to the bug you linked.

Flags: needinfo?(illia.bobyr)

Not sure if there is anything else you would want to add here, Emilio Cobos Álvarez.
Added you to needinfo, just to make sure you've seen my reply.

Flags: needinfo?(emilio)

I can't check right now (just went through surgery and I don't have my usual workstation around), but we're explicitly calling gdk_window_set_override_redirect(.., true), so if that's not working it'd be good figuring out why.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #13)

I can't check right now (just went through surgery and I don't have my usual workstation around), but we're explicitly calling gdk_window_set_override_redirect(.., true), so if that's not working it'd be good figuring out why.

No rush, as you can see, it has been an issue for some time now.
I think only people who run their desktop without a DBus notification daemon are affected.

Hope you'll recover with no issues!
And if you'll have time to look into it afterward - that would be great :)

The gdk_window_set_override_redirect(..., true) call indeed made me think it is related, as you pointed out.
But I am not familiar with the codebase enough to track all the ins and outs.
You are probably going to set up your desktop to be able to reproduce it yourself.
But if not, I can help by testing any changes.

We call gdk_window_set_override_redirect() on GdkWindow which is derived from mContainer now. We should rather redirect toplevel GdkWindow owned by mShell.

Flags: needinfo?(emilio)
Assignee: nobody → stransky

I wonder if there are more places where we wrongly use child mGdkWindow instead of top level one.

Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/62cb82d3700e
[Linux] Call gdk_window_set_override_redirect() on toplevel GdkWindow r=emilio"
Status: NEW → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch

Thank you for the fix!

Flags: needinfo?(illia.bobyr)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: