I got sick of FF forgetting where windows were between sessions and investigated. (Well, really I got sick of having to locate the windows and move them back to the right place on restart).
I believe the source of at least some problems is that the FF code treats Virtual Desktop (WorkSpace in its jargon) = 0 as indicating a missing value. Unfortunately, under KDE, and probably most X window managers, the first desktop is numbered 0. A window that appears in all desktops even has a Workspace ID of -1 (in my experiments windows that appear on all desktops are restored properly since -1 is not 0). The result is that windows on desktop 0 are treated by FF as having no valid info, and are simply left where they are. -> My workaround is to launch FF from desktop 0; that way when the windows from desktop 0 are left alone by FF they are already in the right place :) After restarts from desktop 0 I have twice been switched to a different virtual desktop--a different one each time. Possibly this is the desktop I was in when I shut FF down. But the windows that should have been on desktop 0 stayed there. I opened an upstream bug https://bugzilla.mozilla.org/show_bug.cgi?id=1707415 that has additional details. The session management code was originally written for cocoa (Mac); the assumption the work space ids are all positive may be correct there. Ross P.S. The various providers all seem reluctant to provide calls for getting and setting the workspaces of Windows. The notes on getting this working indicate Apple for a long time would not provide any guaranteed method to get the info, and I think the current code in FF uses some unsanctioned trick. Somewhat similarly, the FF's gtk implementation relies on a method that is apparently deprecated, or causes some other warnings when used. This is at least partly from a philosophical issue about whether applications should have any awareness of virtual desktops, or if that should be left entirely to the window manager. There additional things that I believe are beyond the scope of EWMH (https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html) like KDE tasks, that one could also imagine FF making some note of.