It doesn’t seem to work by default with FirefoxPWA
However, it works after running flatpak permission-set webextensions firefoxpwa snap.firefox yes. I’m certain I have not seen any permissions request dialog. Is this a bug that it automatically denies access?
$ snap version
snap 2.57.1
snapd 2.57.1
series 16
ubuntu 22.04
kernel 5.15.0-47-generic
$ snap info firefox
...
installed: 105.0b9-1 (1836) 187MB -
MOZ_LOG=NativeMessagingPortal:5 snap run firefox
[Parent 99494: Main Thread]: D/NativeMessagingPortal creating session with handle suffix firefox_firefoxpwa_80670177
[Parent 99494: Main Thread]: D/NativeMessagingPortal session created with handle /org/freedesktop/portal/desktop/session/1_1212/firefox_firefoxpwa_80670177
[Parent 99494: Main Thread]: D/NativeMessagingPortal starting firefoxpwa, requested by firefoxpwa@filips.si in session /org/freedesktop/portal/desktop/session/1_1212/firefox_firefoxpwa_80670177
[Parent 99494: Main Thread]: D/NativeMessagingPortal native application start requested in session /org/freedesktop/portal/desktop/session/1_1212/firefox_firefoxpwa_80670177, pending response for /org/freedesktop/portal/desktop/request/1_1212/firefox/630856936
[Parent 99494: Main Thread]: D/NativeMessagingPortal got response signal for /org/freedesktop/portal/desktop/request/1_1212/firefox/630856936 in session /org/freedesktop/portal/desktop/session/1_1212/firefox_firefoxpwa_80670177
[Parent 99494: Main Thread]: D/NativeMessagingPortal native application start canceled by user in session /org/freedesktop/portal/desktop/session/1_1212/firefox_firefoxpwa_80670177
[Parent 99494: Main Thread]: D/NativeMessagingPortal session /org/freedesktop/portal/desktop/session/1_1212/firefox_firefoxpwa_80670177 was closed by the portal
[Parent 99494: Main Thread]: D/NativeMessagingPortal cannot close session /org/freedesktop/portal/desktop/session/1_1212/firefox_firefoxpwa_80670177, unknown handle
[Parent 99494: Main Thread]: D/NativeMessagingPortal will be used
[Parent 99494: Main Thread]: D/NativeMessagingPortal is available
EDIT: I just got the permissions request dialog for KeepassXC, and now I’m 200% sure I did not get this dialog for firefoxpwa.
I noticed there’s a 105.0-2 version on latest/candidate channel. Unfortunately, native messaging seems to be broken on it. - works fine with 105.0b9-1 on beta channel Is this by design? Will 105.0 official release not include native messaging support?
Yes, this is expected: the native messaging support requires a patch that isn’t merged upstream yet, and until it is merged it will be available only in the beta channel, regardless of version number.
The native messaging support continues to work (using KeePassXC extension), but unlike the stable FF version, there continues to be a problem with the cursor (FFsnap 106.0b1; Ubuntu 22.04 on thinkpad). With a hi DPI screen, the cursor size is so small it is difficult to see.
On the stable version of FF and all other programs including Chromium and other snaps, the cursor is much larger - as set by the user.
This is probably of low consequence, but one side effect of using xdg-desktop-portal is that the native messaging host cannot be identified with the Firefox process from outside, as it’s now running under a different PID;
The context is (i’ll try to make it short) -
I have a window switcher GUI application, that also lists currently running browser tabs. In order to get the tabs info, it communicates with an extension in the running browser, via the native messaging host.
It then knows which tabs to associate to which browser instance, because the native messaging host runs under the browser’s PID. However this is not the case with snap Firefox.
I realize that having the same PID was not guaranteed in the first place.
But do you know of any way around it? (is there a way to tell which browser started the xdg-desktop-portal?)
Thanks. And apologies if this is not the right place to post this.
That’s a very interesting use of native messaging, and I must admit I’m not sure how to make this work in a confined snap where the external process is a child of the portal, not of the browser.
I just noticed a lock file in my firefox profile directory that’s a broken symlink to a file called 127.0.0.1:+PID (where PID is the pid of the main firefox process). Could that be of any use?
It’s a manual step only if you missed the initial modal dialog requesting your permission, or if your desktop environment doesn’t have the required wiring to present this dialog. Can you share details about your desktop environment?
Regardless, we definitely need a UI to allow changing these permissions, having to use the flatpak CLI doesn’t cut it, of course. There’s no good reason for this permissions database management tool to be flatpak really, other than “it was originally written by flatpak developers, and no-one else used it at the time”. I agree this is confusing.
The installation of the extension was pre-existing, that is, firefox latched on to a pre-existing firefox nightly profile folder. Not sure if that would make the permission dialog not appear.
systemctl --user status xdg-desktop-portal
● xdg-desktop-portal.service - Portal service
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
Active: active (running) since Sun 2022-11-20 11:13:50 AEDT; 22min ago
Main PID: 2730 (xdg-desktop-por)
Tasks: 7 (limit: 19119)
Memory: 4.1M
CPU: 1.041s
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
└─2730 /usr/libexec/xdg-desktop-portal
Nov 20 11:13:49 ubuntu-virtio systemd[2394]: Starting Portal service...
Nov 20 11:13:50 ubuntu-virtio systemd[2394]: Started Portal service.
Nov 20 11:25:04 ubuntu-virtio xdg-desktop-por[2730]: Could not find WebExtensions backend: cannot find native messaging server
Nov 20 11:34:57 ubuntu-virtio xdg-desktop-por[2730]: Could not find WebExtensions backend: cannot find native messaging server
and now via the Firefox Gnome Shell Extension add-on I can control and install extensions. The website has a warning about the latest API not being supported, but the integration with Firefox works none the less, Firefox beta 108.