Closed Bug 1444313 Opened 6 years ago Closed 6 years ago

setting as default browser in snap fails


(Firefox :: Shell Integration, defect)

59 Branch
Not set



Firefox 61
Tracking Status
firefox59 + fixed
firefox60 --- verified
firefox61 --- fixed


(Reporter: olivier, Assigned: olivier)




(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.88 Chrome/65.0.3325.88 Safari/537.36

Steps to reproduce:

Attempting to set firefox as the default browser from within the application's preferences, when run as a snap, fails.

This is due to snapd's xdg-settings wrapper that prepends $SNAP_ to the desktop file name that is passed. The current snap-specific code in firefox does the prepending itself:

(from within the snap)$ /usr/bin/xdg-settings set default-web-browser firefox_firefox.desktop
Error org.freedesktop.DBus.Error.Failed: cannot set setting "default-web-browser" to value "firefox_firefox.desktop": value not allowed

Actual results:

Default browser is not changed to be the firefox snap.

Expected results:

Default browser should be changed to be the firefox snap.
Mentor: olivier
Mentor: olivier
Follow of bug 512305
Assignee: nobody → olivier
Blocks: snappy
Component: Untriaged → Shell Integration
Depends on: 512305
Attachment #8957477 - Flags: review?(jhorak)
Comment on attachment 8957477 [details]
Bug 1444313 - Fix desktop file name for snapd's xdg-setting wrapper.
Attachment #8957477 - Flags: review+
Pushed by
Fix desktop file name for snapd's xdg-setting wrapper. r=mkaply
Comment on attachment 8957477 [details]
Bug 1444313 - Fix desktop file name for snapd's xdg-setting wrapper.

Approval Request Comment
[Feature/Bug causing the regression]: Setting default browser on Snap isn't working
[User impact if declined]: Unable to set default browser on Snap
[Is this code covered by automated tests?]: No
[Has the fix been verified in Nightly?]: No
[Needs manual test from QE? If yes, steps to reproduce]: No
[List of other uplifts needed for the feature/fix]: Non
[Is the change risky?]: No
[Why is the change risky/not risky?]: Snap only. Update internal string.
[String changes made/needed]: None
Attachment #8957477 - Flags: review?(jhorak) → approval-mozilla-beta?
Comment on attachment 8957477 [details]
Bug 1444313 - Fix desktop file name for snapd's xdg-setting wrapper.

NPOTB but helps Snap, Release59+
Attachment #8957477 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Hi Julia! I heard you would like to test out the beta branch. You can fetch the latest beta thanks to:
> snap install firefox --channel=edge

(edge will eventually become beta, at some point)

Speaking of which, I'm surprised it worked on 59.0.x. Bug 1444140 didn't make Firefox 59. If I understand correctly 1444140 is a dependency to make this feature work. It's for sure on beta, though. Ken VanDine from Canonical told me (without 1444140) Firefox would fail silently. Could you tell me what you see on your end?
Blocks: 1444140
Flags: needinfo?(iulia.cristescu)
(In reply to Iulia Cristescu, QA [:JuliaC] from comment #10)
> I can confirm that the initial issue is verified fixed on Ubuntu 16.04 x64,
> using the latest Firefox snap version (59.0.2-1). The browser is
> successfully set as default and no errors are thrown.

It still says "Firefox is not your default browser" for the snap (59.0.2-1, stable channel) in 16.04 and 18.04 for me. Ubuntu correctly sets Firefox as the default, but Firefox itself still fails to recognize it. Maybe you have the "Always check if Firefox is your default browser" unchecked?
(In reply to Johan Lorenzo [:jlorenzo] from comment #11)
> You can fetch the latest beta thanks to:
> > snap install firefox --channel=edge

If the Firefox snap is already present this will not work, instead use:
> snap switch firefox --channel=edge

Then do:
> snap refresh

However, it's not much to test there yet as you will currently just stir on a blank Firefox window :P
Think I know what's really going on for you Iulia.

Do you have Firefox from the Ubuntu repository still installed? If you do it can be that you are trying to launch the snap but are instead launching the deb (where this issue do not occur). It's currently not easy to distinguish multiple versions of the same application, but work is being done to improve this.
Another explanation could be if you have the Firefox deb open and you're trying to launch the Firefox snap, it will then launch another Firefox deb window instead of the snap. Firefox is a little weird on this.

If you would like to recheck, please quit all open Firefox windows and do 
> sudo apt remove firefox -y

Now that the Firefox snap is the only present, launch Firefox and recheck.
Sorry for the late response! 
Thank you Herald for all the clarifications, they were very useful! 
So re-investigated the issue and concluded that, indeed, I also had another Firefox deb installed and it seems I didn't manage to differentiate them properly. 
This time I firstly assured that no other version of Firefox are installed 
> sudo apt remove firefox -y 
> snap remove firefox
and after that properly installed Firefox snap:
> snap install firefox 
for the release version of Firefox snap 
> snap install firefox --channel=edge
for the beta branch. 

After that I also rechecked in the Ubuntu Software section if the Firefox snap is the only one installed and opened the About Firefox section to verify if the current version is a snap one in each case.
That being said: 
- 60.0b9 snap version is verified fixed (Firefox is successfully made the default browser after the setting confirmation is allowed; this setting is properly kept after restart and with/without the option "Always check if Firefox is your default browser" checked; confirmed that the setting was properly made by opening a locally saved .html file).
- 59.0.2 snap version is still affected (the user is not able to set Firefox as the default browser using the about:preferences option; the "Make Default..." option is not triggering any action and is not changed; confirmed this by opening a locally saved .html file).
Flags: needinfo?(iulia.cristescu)
You need to log in before you can comment on or make changes to this bug.