Closed Bug 1720497 Opened 3 months ago Closed 3 months ago

[Wayland] Run Firefox without X11

Categories

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

Firefox 89
Unspecified
Linux
enhancement

Tracking

()

RESOLVED FIXED
92 Branch
Tracking Status
firefox91 --- fixed
firefox92 --- fixed

People

(Reporter: hugo, Assigned: rmader)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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

Steps to reproduce:

DISPLAY is unset and WAYLAND_DISPLAY is unset (and the system is running a Wayland compositor, e.g.: sway).

Run firefox https://ddg.gg.

Actual results:

Firefox crashes trying to connect to Xorg.

Additionally, if an instance of Firefox is already running (with MOZ_ENABLE_WAYLAND=1), the new instance does not communicate with the existing one, but crashes trying to connect to Xorg.

Expected results:

Firefox should use its Wayland backend if Wayland is the only thing available on the system.

This is somewhat related to 1543600, however, that issue is about using Wayland BY DEFAULT, whereas this issue is about using Wayland as a fallback when it's the only thing available in the system.

Side note: This issue came up when clicking links on Flatpak, since the xdg-desktop-portal spawns a copy of Firefox without MOZ_ENABLE_WAYLAND=1, which is only set to my regular desktop environment and not for services.

OS: Unspecified → Linux

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

Component: Untriaged → Graphics
Product: Firefox → Core
Severity: -- → S3
Component: Graphics → Widget: Gtk
Priority: -- → P3

This is somehow expected.

Blocks: wayland

@Hugo: why would a compositor ever not set WAYLAND_DISPLAY?

Flags: needinfo?(hugo)
See Also: → 1709382

Sorry, that was a dumb typo on my part, that should read:

DISPLAY is unset and WAYLAND_DISPLAY is set (and the system is running a Wayland compositor, e.g.: sway).

Ah right, makes sense :) We just had another bug where someone writing their own compositor really did not set it.

I think this should be trivial to fix by checking for DISPLAY not being set at https://searchfox.org/mozilla-central/source/toolkit/xre/nsAppRunner.cpp#4091-4093 - will create a patch.

Flags: needinfo?(hugo)
Summary: When DISPLAY is unset and WAYLAND_DISPLAY is set, Firefox crashes → [Wayland] Run Firefox wihout X11
Type: defect → enhancement
Summary: [Wayland] Run Firefox wihout X11 → [Wayland] Run Firefox without X11
Assignee: nobody → robert.mader
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

If WAYLAND_DISPLAY is set but DISPLAY is not, we have every reason
to assume that we are in a Wayland-only session. Enable the Wayland
backend unconditionally in this case.

Note: We do not bother to further sanity check the content of the env
variables as these can be considered client setup bugs.

Pushed by robert.mader@posteo.de:
https://hg.mozilla.org/integration/autoland/rev/442fae932235
Do not require MOZ_ENABLE_WAYLAND if Xwayland is not available, r=stransky
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch

Comment on attachment 9231894 [details]
Bug 1720497 - Do not require MOZ_ENABLE_WAYLAND if Xwayland is not available, r=stransky

Beta/Release Uplift Approval Request

  • User impact if declined: FF will not start on Wayland-only systems without setting the MOZ_ENABLE_WAYLAND env var. While such setups are not yet very common, it is likely that we will see a strong increase of them over the lifetime of the ESR release as several distributions will switch to Wayland by default.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): - the patch is trivial
  • it only toggles between Wayland and X11 backend
  • should not affect any already common setups
  • String changes made/needed:
Attachment #9231894 - Flags: approval-mozilla-beta?

Comment on attachment 9231894 [details]
Bug 1720497 - Do not require MOZ_ENABLE_WAYLAND if Xwayland is not available, r=stransky

Fallback to Wayland is better than crashing, approved for 91 beta 6, thanks.

Attachment #9231894 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.