[Bug 260239] www/firefox: Can't open URL in running instance

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 07 Dec 2021 11:03:27 UTC

--- Comment #3 from Jan Beich <jbeich@FreeBSD.org> ---
(In reply to Michael Eriksson from comment #2)
> 1. firefox-esr, and most likely also earlier versions of mainline firefox,
> don't use dbus for opening URLs in running instances. This can be verified by
> testing without dbus running or by watching dbus-monitor.

Before https://hg.mozilla.org/mozilla-central/rev/ef22d8cbf4ef one had to
define MOZ_DBUS_REMOTE via environ(7) to use DBus on X11 to open a window in an
existing Firefox instance.

> 2. The firefox port doesn't make sure that the machine is ready for running
> dbus (mainly by running "dbus-uuidgen --ensure"), and does not mention dbus in
> the pkg-message.

machine-id is mainly used by autolaunch and generic to all DBus consumers. If
you start session bus (as user after login) manually then neither "dbus-uuidgen
--ensure" nor "service dbus onestart" are required e.g.,

  $ cat >>/etc/profile
  # WARNING: zsh doesn't read this file by default, so use /etc/zprofile
  # XDG_RUNTIME_DIR is preferred but usually requires pam_xdg or consolekit2
(pam_ck_connector or ck_launch_session)
  if [ -n "$XDG_RUNTIME_DIR" ]; then
      if ! pgrep -qf -U ${USER:-$(id -u)} dbus.\*--session; then
          dbus-daemon --session --fork --address=unix:runtime=yes 2>/dev/null
          # Only necessary for some apps that fail to find default session bus
(e.g., Emacs, Chrome)
          # https://gitlab.freedesktop.org/dbus/dbus/-/commit/e3f117e7610b
          export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
      eval $(dbus-launch --sh-syntax --exit-with-session 2>/dev/null)

> 3. firefox can be built without the DBUS option, how will this work then?

On X11 by snooping X atoms to find matching window then setting
_MOZILLA_COMMANDLINE on that window.


$ xwininfo -root -children | awk '/^[[:space:]]*0x/ { print $1 }' | xargs -n1
xprop -id | fgrep _MOZILLA
_MOZILLA_PROFILE(STRING) = "default-esr"

$ pkg install go git
$ git clone https://github.com/siebenmann/ffox-remote
$ cd ffox-remote
$ go build
$ ./ffox-remote -P default-esr https://lists.freebsd.org/
$ ./ffox-remote -P default-esr http://itisatrap.org/firefox/its-a-trap.html

You are receiving this mail because:
You are the assignee for the bug.