Open Bug 1891428 Opened 2 years ago Updated 1 year ago

Extension handled scheme passed to system (Flatpak)

Categories

(WebExtensions :: General, defect, P3)

Firefox 123
defect

Tracking

(firefox125 affected)

ASSIGNED
Tracking Status
firefox125 --- affected

People

(Reporter: bugzilla, Assigned: rpl)

References

Details

(Whiteboard: [addons-jira])

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0

Steps to reproduce:

Using https://addons.mozilla.org/en-GB/firefox/addon/open-url-in-container/ I always shows the "Open the ext+container" link with System Handler.

Setting the "network.protocol-handler.prompt-from-external" config option to false still shows that dialogue.

I've reinstalled the extension to no avail. The only difference between a system where this works and a system where it doesn't is that one is from the Flathub Flatpak, and the one where it works from Fedora natively.

Actual results:

"Open the ext+container" link with System Handler shows up.

Expected results:

The ext+container link is opened in a container through the extension.

The bug is similar to already closed https://bugzilla.mozilla.org/show_bug.cgi?id=1700976

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions

Needinfo-ing myself to reproduce this locally and investigate if this is an issue on Firefox of xdg portals side.

Flags: needinfo?(lgreco)

Hello,

I could not reproduce the issue on the latest Nightly (127.0a1/20240416214037) under Ubuntu 22.04 LTS.

I installed the mentioned extension in Nightly and then from the terminal I launched Nightly with the 'ext+container:name=MyContainer&url=https://mozilla.org' params. When first launching the mentioned website in Nightly, I get a link handler pop-up on which I check the “Always use this application to open…” option and make sure the application that is going to be used is the extension. I then click on “Open link” and mozilla.org is opened in a container named “My Container”. On any subsequent Nightly launches with those params, I no longer get prompted.
However, I see no System Handler option as in your screenshot or description.

Would you be able to provide some more detailed steps to reproduce the issue? Thank you !

Is this using the Nightly Flatpak? Do you have instructions on how to access that? Otherwise, you might not be able to reproduce the problem you're using a system-installed package rather than a Flatpak.

I retested with Firefox 125.0.1 from Flathub with the same result.

Hello,

I was using the wrong Nightly indeed, but I installed Firefox 125.0.1 (Build ID 20240416043247) from Flathub and launched it from the terminal with the args from Comment 4.

As you previously mentioned, "open the ext+container" link with System Handler dialogue shows up and the link is not opened in a container. See the attached screenshot.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Hi Gijs, we suspect this issue may not be specific to extension-registered protocol handlers and instead being more generic than that (e.g. due to behaviors of the xdg desktop portals):

  • do you know if we have existing bugs related to web-registered protocol handlers also hitting this?
  • what would be a good bugzilla component to move this bug to if this is a more general issue as it seems likely it to be?
Flags: needinfo?(lgreco) → needinfo?(gijskruitbosch+bugs)

(In reply to Luca Greco [:rpl] [:luca] [:lgreco] from comment #9)

Hi Gijs, we suspect this issue may not be specific to extension-registered protocol handlers and instead being more generic than that (e.g. due to behaviors of the xdg desktop portals):

  • do you know if we have existing bugs related to web-registered protocol handlers also hitting this?

I'm not aware of any. We had to add a carve-out in bug 1700976 to exempt web/extension protocols from this behaviour (which avoids things like bug 1842542 but for protocols instead of files, passed on the command line). I have a vague recollection of something tangentially related to this being filed recently but I can't quite find it or put my finger on it. Too many bugs pass my desk. :-(

I will note that comment 0 does not actually make it clear how the link is opened - is this from the command line? That is what bug 1700976 was about...

  • what would be a good bugzilla component to move this bug to if this is a more general issue as it seems likely it to be?

Firefox File Handling.

Flags: needinfo?(lgreco)
Flags: needinfo?(gijskruitbosch+bugs)
Flags: needinfo?(bugzilla)

I use those URLs from bookmarks. I have at least 4 bookmarks for different containers that all work on my desktop machine from where they are synchronised, and it shows the dialogue from comment 0, just as it does if I type that same URL in the address bar.

I've also tested one from the command-line with an already open Firefox, and it works as well as it does in your case, showing a choice between opening in a system handler, or using the extension. This is different behaviour from a system-installed Firefox with the extension where it would automatically select the extension handling.

Let me know if anything above here wasn't clear.

Flags: needinfo?(bugzilla)

Thanks! That was the memory jogging I needed.

So the related bug I was thinking of is bug 1878648. There the issue is that you are asked to confirm before we open the link (even if it's opened with an extension rather than system handler). There's a bunch of context in the bug about why that is and why it's non-trivial to fix.

The fact that the prompt says "System Handler" is likely a flatpak-specific issue. But I'm surprised that on the Fedora build, you don't get a prompt still (or perhaps when you say "it works" you mean you get a prompt that names the extension?). Is the Fedora copy of Firefox perhaps version 115 extended support release?

If you go to Firefox's settings and look for the ext+container protocol, there should be a dropdown and you should be able to choose "open this with [extension]", I would have thought? And then I'd expect the prompt to show the right thing. It would be interesting to know if that is the case or not. If it is, I suspect bug 1878648 comment 19 (+ code link) may be the explanation for why the flatpak build doesn't default to "just" opening with the extension.

In address bar code, we've had to work around this issue with the flatpak sandboxing (which pretends your system has a handler for any protocol Firefox asks about) - it's documented in bug 1618094, the workaround was implemented in bug 1744243. I expect the webextension code linked above may want to do something similar, and/or extract the "no but really, does the system understand this protocol" logic to a shared helper or w/e.

See Also: → 1878648

Thanks a lot!!! That is exactly the behavior with the xdg portals that I was recalling but I was able to get to the bugzilla issue related to it.

I took a quick look and sharing the same workaround (currently part of URIFIxup.sys.mjs) sis a reasonable way to handle this issue, I'm going to draft a patch asap and discuss the remaining details in the phabricator revision.

Flags: needinfo?(lgreco)
Assignee: nobody → lgreco
Severity: -- → S4
Status: NEW → ASSIGNED
Component: Untriaged → General
Priority: -- → P3
Whiteboard: [addons-jira]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: