Bug 249909 - www/firefox is launching dbus-launcher even if compiled with DBUS=off
Summary: www/firefox is launching dbus-launcher even if compiled with DBUS=off
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gecko (Nobody)
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2020-09-26 09:57 UTC by jakub_lach
Modified: 2023-11-11 10:15 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (gecko)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jakub_lach 2020-09-26 09:57:19 UTC
Since update to 80(?) Firefox is launching dbus if it's present in the system. As I don't use D-bus, but unfortunately have to have it installed, I consider it a POLA violation (change of behaviour).
Comment 1 jakub_lach 2020-09-26 14:47:05 UTC
FWIW, YouTube videos don't start properly until dbus-launcher is present.

media.cubeb.baclend=oss
Comment 2 Mateusz Piotrowski freebsd_committer freebsd_triage 2020-10-03 16:48:05 UTC
Thanks for the report. Would you be able to provide a patch fixing the issue?
Comment 3 jakub_lach 2020-10-03 21:13:37 UTC
I would, if I could. FWIW, I've observed that Firefox is launching not only dbus-launcher but also dbus-deamon when loading video on YouTube. 

What's more is on YouTube only first video plays till end, next one never starts playing after loading (if you start it in a new tab it plays fine). 

Could anybody confirm the problem with playlists/autoplaylists? It's something recent.
Comment 4 jakub_lach 2020-10-04 22:26:23 UTC
JavaScript error: https://cfl.dropboxstatic.com/static/js/alameda_bundle/alameda_bundle_firefox_pl-vflWjthMc.js, line 2: NS_ERROR_NOT_INITIALIZED: 
JavaScript error: , line 0: NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
Port.onMessage event fired while context is inactive.
console.warn: LoginRecipes: "getRecipes: falling back to a synchronous message for:" "https://consent.youtube.com"
[Child 932, MediaDecoderStateMachine #1] WARNING: Decoder=823701800 Decode error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - RefPtr<MediaSourceTrackDemuxer::SamplesPromise> mozilla::MediaSourceTrackDemuxer::DoGetSamples(int32_t): manager is detached.: file /usr/obj/usr/ports/www/firefox/work/firefox-81.0.1/dom/media/MediaDecoderStateMachine.cpp, line 3470

<...>

[Child 932, MediaDecoderStateMachine #1] WARNING: Decoder=823701800 Decode error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - RefPtr<MediaSourceTrackDemuxer::SamplesPromise> mozilla::MediaSourceTrackDemuxer::DoGetSamples(int32_t): manager is detached.: file /usr/obj/usr/ports/www/firefox/work/firefox-81.0.1/dom/media/MediaDecoderStateMachine.cpp, line 3470
console.warn: services.settings: Could not determine network status. Message: TypeError: Cc[aContract] is undefined
Comment 5 Christian Weisgerber freebsd_committer freebsd_triage 2020-10-05 18:41:16 UTC
(In reply to jakub_lach from comment #3)
I see the same YouTube problem with Firefox-81.0.1,2 on FreeBSD/amd64 12.2-STABLE. It doesn't require playlists.

My "desktop environment" is mwm and a bunch of xterms. I do not launch dbus explicitly myself.
Comment 6 jakub_lach 2020-10-05 21:33:38 UTC
(In reply to Christian Weisgerber from comment #5)

Similar here - dwm/xterm.
Comment 7 Christian Weisgerber freebsd_committer freebsd_triage 2020-10-06 18:33:26 UTC
I'm sorry, I think we're mixing up unrelated problems here.

I'm now running dbus in the background, I added...

if [ -x /usr/local/bin/dbus-launch -a -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
        eval $(dbus-launch --sh-syntax --exit-with-x11)
fi

...to my ~/.xsession, and the problem with YouTube persists.
Comment 8 jakub_lach 2020-10-08 18:34:59 UTC
I'm sorry for the confusion, here it look like that:

1. Firefox is launching dbus-* before playing YouTube videos.
2. Nevertheless, autoplay doesn't work (only first video plays).
Comment 9 jakub_lach 2020-10-08 23:06:28 UTC
(In reply to jakub_lach from comment #8)

2. No longer occurs with firefox-81.0.1_1,2  (autoplay works)
Comment 10 jakub_lach 2021-10-30 10:24:59 UTC
Confirmed with www/firefox 94.0_2,2 with DBUS=off (running firefox launches dbus-deamon and dbus-launcher, killing dbus-deamon kills firefox)
Comment 11 santosd99 2023-11-10 14:32:22 UTC
DBus is also being launched with:
www/firefox-esr 115.3.1,1
math/qalculate-gtk 4.8.1
graphics/zathura 0.5.2_1

A fix for this bug is to rebuild dbus with X11=off.
Comment 12 jakub_lach 2023-11-10 19:33:30 UTC
(In reply to santosd99 from comment #11)

Does firefox work without dbus at all now (considering YouTube video issues above)? I would prefer to not cripple DBUS in case other app needs it (with X11).
Comment 13 santosd99 2023-11-10 20:02:01 UTC
(In reply to jakub_lach from comment #12)

It does, actually. My firefox-esr build options are:
	ALSA           : off
	CANBERRA       : off
	DBUS           : off
	DEBUG          : off
	FFMPEG         : on
	JACK           : on
	LIBPROXY       : off
	LTO            : off
	OPTIMIZED_CFLAGS: on
	PROFILE        : on
	PULSEAUDIO     : on
	SNDIO          : on
	TEST           : off

I couldn't build with PULSEAUDIO=off, so the solution was to change the audio backend to OSS and then uninstall pulseaudio after firefox was compiled.

The dbus build options are:
	EXAMPLES       : on
	MANPAGES       : on
	X11            : off

Another important note is that I'm not using a desktop environment, just wm/i3. The other programs that were launching dbus are not doing so now. There is no
dbus running on my machine ATM. I also use X11.
Comment 14 santosd99 2023-11-10 20:26:05 UTC
I almost forgot. It was necessary to build accessibility/at-spi2-core like this:
        ATKONLY        : on
	X11            : off

And x11-toolkits/gtk30 like this:
	ATK_BRIDGE     : off
	BROADWAY       : on
	COLORD         : off
	CUPS           : off
	DEBUG          : off
	WAYLAND        : off
	X11            : on

Building those like that makes dbus not required for the gtk programs that I use.

I only have dbus installed because of virtualbox (qt5-gui needs it), but it also
doesn't spawn dbus processes. Here are the build options for vbox, if you're interested:
	AIO            : on
	ALSA           : off
	DBUS           : off
	DEBUG          : off
	DOCS           : on
	GUESTADDITIONS : off
	NLS            : off
	OPUS           : off
	PYTHON         : off
	QT5            : on
	R0LOGGING      : off
	UDPTUNNEL      : on
	VDE            : off
	VNC            : on
	VPX            : off
	WEBSERVICE     : on
	X11            : on
Comment 15 jakub_lach 2023-11-10 21:55:05 UTC
(In reply to santosd99 from comment #13)

Thanks, as far as I can tell - www/firefox with devel/dbus X11: off indeed works. Not sure about other consumers though.
Comment 16 santosd99 2023-11-10 22:24:02 UTC
No problem. Maybe change the status of this bug to closed/fixed?
Comment 17 jakub_lach 2023-11-11 10:15:02 UTC
(In reply to santosd99 from comment #16)

Strictly speaking bug still exist - www/firefox launches dbus even if compiled without.