Summary: | www/firefox: Can't open URL in running instance | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Michael Eriksson <mer> | ||||
Component: | Individual Port(s) | Assignee: | freebsd-gecko (Nobody) <gecko> | ||||
Status: | Closed Works As Intended | ||||||
Severity: | Affects Many People | CC: | cmt, grahamperrin | ||||
Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(gecko) |
||||
Version: | Latest | ||||||
Hardware: | amd64 | ||||||
OS: | Any | ||||||
Attachments: |
|
Can't reproduce, works as expected. My first guess would be some dbus problem - you could use dbus-monitor to watch for the messages there. You are right that this was a dbus problem. However, 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. 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. 3. firefox can be built without the DBUS option, how will this work then? (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 instead # 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 fi else eval $(dbus-launch --sh-syntax --exit-with-session 2>/dev/null) fi > 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. https://searchfox.org/mozilla-release/rev/dbc7c5ca1e5a/toolkit/components/remote/nsXRemoteClient.cpp#31-37 $ xwininfo -root -children | awk '/^[[:space:]]*0x/ { print $1 }' | xargs -n1 xprop -id | fgrep _MOZILLA _MOZILLA_PROFILE(STRING) = "default-esr" _MOZILLA_PROGRAM(STRING) = "firefox" _MOZILLA_USER(STRING) = "you" _MOZILLA_VERSION(STRING) = "5.1" $ 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 (In reply to Jan Beich from comment #3) (Thanks for the link to the Firefox commit, it's now clear why dbus is needed.) The point with "making the machine ready for dbus" was that Firefox would then autolaunch dbus for the user. Having to update global or personal shell rc files to run Firefox seems suboptimal. OK, Firefox without DBUS continues to use the old method for communication between instances, fine. |
Created attachment 229923 [details] Log printout from firefox-esr (good) and firefox (broken) Executing "firefox <URL>" to open a URL in a running instance does not work with the recent versions of the firefox port, the latest I have tried with is firefox-95.0,2. It still works with firefox-esr. Symptoms when running "firefox freebsd.org" when another Firefox instance is running: 1. A popup window is shown with the text "Firefox is already running, but is not responding. To use Firefox, you must first close the existing Firefox process, restart your device, or use a different profile." 2. Firefox writes this five times to standard error: JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. I have tested in a completely empty home directory (by setting $HOME). The logs from the running instances are attached. The file includes two logs: - firefox-esr-91.4.0,1, where opening the URL worked - firefox-95.0,2, where opening the URL failed