Session restore can hang when an observer closes a window synchronously during creation
Categories
(Firefox :: Session Restore, defect, P3)
Tracking
()
People
(Reporter: tao, Assigned: tao)
References
Details
Attachments
(1 external file)
A domwindowopened observer can close a newly created restore window synchronously, before Services.ww.openWindow() returns. SessionStore.#openWindowWithState() then registers restore data and a showing promise for that already-closed handle. There will be no subsequent before-show or close notification to settle the promise, so #openWindows() waits indefinitely and the surviving windows are not restored.
A deterministic privileged test case is to intercept the first additional window opened by setBrowserState() with a domwindowopened observer and close it synchronously. The primary window and a second additional window should still complete their restores. The same boundary needs handling when undoCloseWindow() receives an already-closed handle.
The proposed patch returns an already-closed handle before registering restore data or a showing promise. Bulk restoration skips that slot, decrementing the restore count only when a counted restore is active; this preserves the idle counter used by setWindowState(). undoCloseWindow() keeps its return value and closed-object notification but does not wait for first-show on the canceled handle.
This is a small lifecycle extraction from D315350, related to bug 500911. It does not require the focus transaction or native activation changes. Its scope is synchronous closure during creation while another restore participant survives, plus undo-close compatibility. Later closure and completion with no surviving restore participant remain separate cases.
The regression test covers one canceled additional window, all additional windows canceled with the primary surviving, idle setWindowState() notification accounting, and a canceled undo-close followed by a normal undo-close. In Try 112807, the new test and the existing closed-window notification test both pass on Linux opt/debug under headed X11/GNOME. Both builds and all nine source checks pass. An unpatched negative-control run has not been performed for this new test.
Try: Linux opt, Linux debug.
| Assignee | ||
Comment 1•1 month ago
|
||
An observer can close a restore window before Services.ww.openWindow() returns. Registering a showing promise afterwards leaves bulk restoration waiting for a notification that can never arrive.
Skip registering restore state for that closed handle and skip it when opening additional windows. Only decrement an active restore count, preserving the idle sentinel used by setWindowState(). In undoCloseWindow(), keep the returned handle and closed-object notification without assigning the canceled window as the focus target or installing its first-show continuation.
This is an independently useful lifecycle extraction from D315350. It covers synchronous creation-time closure with a surviving restore participant and undo-close compatibility. Later closure and restoration with no surviving participant are outside this patch.
Updated•1 month ago
|
Updated•1 month ago
|
Description
•