fix: revert required portal version for file chooser dialogs#44426
fix: revert required portal version for file chooser dialogs#44426
Conversation
ckerr
left a comment
There was a problem hiding this comment.
Need to tweak the lambda capture to fix a the build, but otherwise looks good
2024-10-28T16:06:16.0232728Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:304:26: error: variable 'xdg_portal_required_version' cannot be implicitly captured in a lambda with no capture-default specified
2024-10-28T16:06:16.0234398Z 304 | xdg_portal_required_version) {
2024-10-28T16:06:16.0235038Z | ^
2024-10-28T16:06:16.0236274Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:279:18: note: 'xdg_portal_required_version' declared here
2024-10-28T16:06:16.0237693Z 279 | unsigned int xdg_portal_required_version) {
2024-10-28T16:06:16.0238343Z | ^
2024-10-28T16:06:16.0239107Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:11: note: lambda expression begins here
2024-10-28T16:06:16.0257715Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0258347Z | ^
2024-10-28T16:06:16.0259550Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: capture 'xdg_portal_required_version' by value
2024-10-28T16:06:16.0260754Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0261332Z | ^
2024-10-28T16:06:16.0261795Z | xdg_portal_required_version
2024-10-28T16:06:16.0263318Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: capture 'xdg_portal_required_version' by reference
2024-10-28T16:06:16.0264786Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0265383Z | ^
2024-10-28T16:06:16.0265861Z | &xdg_portal_required_version
2024-10-28T16:06:16.0266833Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: default capture by value
2024-10-28T16:06:16.0267775Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0268299Z | ^
2024-10-28T16:06:16.0268662Z | =
2024-10-28T16:06:16.0269428Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: default capture by reference
2024-10-28T16:06:16.0270436Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0271011Z | ^
2024-10-28T16:06:16.0271410Z | &
2024-10-28T16:06:16.0273104Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:311:68: error: variable 'xdg_portal_required_version' cannot be implicitly captured in a lambda with no capture-default specified
2024-10-28T16:06:16.0275101Z 311 | VLOG(1) << "File chooser portal expected version: " << xdg_portal_required_version;
2024-10-28T16:06:16.0276082Z | ^
2024-10-28T16:06:16.0277430Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:279:18: note: 'xdg_portal_required_version' declared here
2024-10-28T16:06:16.0278864Z 279 | unsigned int xdg_portal_required_version) {
2024-10-28T16:06:16.0279470Z | ^
2024-10-28T16:06:16.0280276Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:11: note: lambda expression begins here
2024-10-28T16:06:16.0281219Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0281756Z | ^
2024-10-28T16:06:16.0282850Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: capture 'xdg_portal_required_version' by value
2024-10-28T16:06:16.0283949Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0284514Z | ^
2024-10-28T16:06:16.0284949Z | xdg_portal_required_version
2024-10-28T16:06:16.0286220Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: capture 'xdg_portal_required_version' by reference
2024-10-28T16:06:16.0287410Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0287985Z | ^
2024-10-28T16:06:16.0288440Z | &xdg_portal_required_version
2024-10-28T16:06:16.0289419Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: default capture by value
2024-10-28T16:06:16.0290697Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0291290Z | ^
2024-10-28T16:06:16.0291669Z | =
2024-10-28T16:06:16.0292501Z ../../ui/shell_dialogs/select_file_dialog_linux_portal.cc:291:12: note: default capture by reference
2024-10-28T16:06:16.0293563Z 291 | [](scoped_refptr<dbus::Bus> bus,
2024-10-28T16:06:16.0294133Z | ^
2024-10-28T16:06:16.0294535Z | &
2024-10-28T16:06:16.0294919Z 2 errors generated.
docs/api/command-line-switches.md
Outdated
|
|
||
| Sets the minimum required version of XDG portal implementation to `version` | ||
| inorder to use the portal backend for file dialogs on linux. Current | ||
| default is set to `4`. |
There was a problem hiding this comment.
Who is the intended consumer for this switch? Application developers, users, or both? For the recent bump to v4, is this so application users can switch back the behavior if they require it?
I also wonder if we should consider reverting the default to v3. #43570 contained an undocument breaking change in behavior that application developers may not be expecting.
There was a problem hiding this comment.
I don't think we should revert the default, since it looks like the change was accepted upstream (see https://chromium-review.googlesource.com/c/chromium/src/+/5786982), but we probably should document this as a breaking change, at least retroactively, so people know
There was a problem hiding this comment.
@VerteDinde I do think (in agreement w/ deepak below) that we should change back the default, since as of now v4 is so rarely available that every app might be required to float this flag for potentially years.
|
Sorry for the delay, I was testing some idea to see if we can repurpose the function Rethinking this PR, based on the conversations from #43819 it seems the affected scenarios with the portal version bump is harder to recover (generic filechooser inside the flatpak application is opened without read/write access to any file on the host) than the scenario with
|
ebc72ab to
ee73cf9
Compare
samuelmaddock
left a comment
There was a problem hiding this comment.
API LGTM
Have a question for clarity, but won't block merging this.
| -constexpr int kXdgPortalRequiredVersion = 3; | ||
| +// Version 4 includes support for current_folder option to the OpenFile method via | ||
| +// https://github.com/flatpak/xdg-desktop-portal/commit/71165a5. | ||
| +constexpr int kXdgPortalRequiredVersion = 4; |
There was a problem hiding this comment.
There's a suggestion in the GH issue about querying for the available portal version rather than hardcoding to 3 or 4. Would that be a viable approach?
There was a problem hiding this comment.
SelectFileDialogLinuxPortal::CheckPortalAvailabilityOnBusThread already performs this check, the hardcoded value is the minimum value we check against to use the portal path. The issue is we don't know if a version of portal supports the feature on an interface by querying and this availability check is performed once when the application initializes.
jkleinsc
left a comment
There was a problem hiding this comment.
Overall, LGTM, just a small grammar correction and I also wonder if we should be more explicit about explaining that the portal version needs to be 4 or greater to use defaultPath.
docs/api/dialog.md
Outdated
| The `filters` specifies an array of file types that can be displayed, see | ||
| `dialog.showOpenDialog` for an example. | ||
|
|
||
| **Note:** On Linux `defaultPath` is not supported when using portal file chooser |
There was a problem hiding this comment.
defaultPath is only unsupported on versions <4 for open dialogs - save dialogs work as expected.
There was a problem hiding this comment.
Thanks for catching.
For reference, flatpak/xdg-desktop-portal#796
|
@deepak1556 i think a rebase should fix windows |
|
Release Notes Persisted
|
|
I was unable to backport this PR to "33-x-y" cleanly; |
|
I was unable to backport this PR to "32-x-y" cleanly; |
|
I have automatically backported this PR to "34-x-y", please check out #44681 |
|
@VerteDinde has manually backported this PR to "32-x-y", please check out #45193 |
|
Testing with electron fiddle, this seems to be missing from 35? Is that possible? |
|
The changes are present but there could be a regression to the patch from a chromium version bump since portal code path was refactored in upstream. Can you open an issue with a repro and we can take a look into it. |
|
@deepak1556 I've opened that repro issue here #46652 |
Description of Change
3, to help address [Bug]: Electron 32.1 does not use the portals inside a flatpak application #43819xdg-portal-required-versionflag for application developers to control the portal usage (ex: requires support ofcurrent_folder)default_pathis performed then log a warning pointing to the above flag.Release Notes
Notes: fix file chooser dialogs for flaptak applications