On Thu, 29 Oct 2026 10:58:19 GMT, Thiago Milczarek Sayao <[email protected]> 
wrote:

> ## Description
> 
> On Linux/Wayland, the robot uses the XDG Desktop Portal (ScreenCast and 
> RemoteDesktop) and stores the `restore_token` returned by `Start` in 
> `~/.java/robot/remote-desktop-tokens.properties`. Later sessions send it 
> back, so the permission dialog is shown only once.
> 
> `validateToken()` in `screencast_portal.c` accepts a token only if 
> `g_uuid_string_is_valid()` returns true. The portal documentation only 
> specifies `restore_token` as a string (`s`) and does not define its format 
> ([RemoteDesktop](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.RemoteDesktop.html),
>  
> [ScreenCast](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.ScreenCast.html)).
> 
> Recent xdg-desktop-portal versions (seen with 1.22.1) no longer generate 
> UUIDs. Their tokens look like `vjebXVIEGhjtuuqCsiwYoQ`, and the frontend 
> accepts both formats (see 
> [`xdp_session_persistence_validate_restore_token()`](https://github.com/flatpak/xdg-desktop-portal/blob/1.22.1/src/xdp-session-persistence.c)).
> 
> Because the new tokens fail the UUID check, the robot never sends 
> `restore_token` in `SelectDevices` / `SelectSources`. Every new robot 
> iteration shows the permission dialog again. 
> 
> ## Steps to reproduce
> 
> 1. Fedora 44 GNOME (xdg-desktop-portal 1.22.1, xdg-desktop-portal-gnome 
> 50.0), Wayland session.
> 2. Run a system test that uses the robot, e.g. 
> `test.robot.javafx.scene.RobotTest`.
> 3. Approve the "Remote Desktop" dialog with "Allow Remote Interaction" turned 
> on.
> 4. The approval dialog will reappear
> 
> **Expected:** the session is restored from the stored token and no dialog is 
> shown.
> **Actual:** the dialog is shown on every new robot iteration.
> 
> ## Fix
> Do not assume a format for the token: accept any non-empty, valid UTF-8 strie 
> it. It still has to be valid UTF-8, since it is passed 
> to`g_variant_new_string()`.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Looks good, CI run also works well.

Running all system tests locally on last Fedora 44 VM with Gnome and KDE (both 
behaved the same) I still had the problem with `LinuxScreencastHangCrashTest` 
but it is a test using Swing/AWT Robot - will be addressed separately as 
[JDK-8396405](https://bugs.openjdk.org/browse/JDK-8396405) as mentioned before.

I'll approve once other comments are responded to/resolved.

-------------

PR Review: https://git.openjdk.org/jfx/pull/2356#pullrequestreview-5755965614

Reply via email to