nsIFilePicker invokes callback before another modal can be safely launched
Categories
(Core :: Widget: Cocoa, defect)
Tracking
()
People
(Reporter: jtracey, Assigned: spohl)
References
Details
Attachments
(3 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-release+
|
Details | Review |
In bug 2052844, Thunderbird is seeing a new behavior on macOS 25 ("new" with the OS version, not "new" with an application update) where launching another dialog immediately after the callback for filePicker.open resolves causes the application to hang. Adding an await new Promise(resolve => Services.tm.dispatchToMainThread(resolve)); line between them makes the problem disappear, which makes me suspect something is causing the callback to invoke when the file is chosen instead of when the modal is fully unwound. We can work around it in the meantime, but I suspect this is something that should be fixed more generally.
| Assignee | ||
Updated•7 days ago
|
| Assignee | ||
Updated•7 days ago
|
| Assignee | ||
Comment 1•7 days ago
|
||
On macOS 26, the NSSavePanel/NSOpenPanel sheet completion handler can run before the panel's modal session has fully unwound. We invoke nsIFilePickerShownCallback::Done() synchronously from inside that completion handler, so a consumer that opens another modal from Done() (for example Thunderbird's "Backup Secret Key to File" flow in bug 2052844) starts the new modal on top of a session that is still tearing down, which hangs.
Defer Done() to a fresh main-thread turn in all four picker modes (open, open-multiple, folder, save) so the modal finishes unwinding first. This matches the JS-side workaround of bouncing off Services.tm.dispatchToMainThread before launching the next modal, but fixes it once for every file-picker consumer. The callback still runs on the main thread exactly once with the same ResultCode; only its timing moves one turn later.
Comment 3•7 days ago
|
||
| bugherder | ||
| Reporter | ||
Updated•6 days ago
|
Comment 6•4 days ago
|
||
Apparently this is affecting 153 (and even earlier) versions too (when they get the OS update). Can we uplift?
Comment 7•4 days ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: Opening a second file picker dialog can cause a hang.
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: This simply defers invoking filepicker callbacks to another main thread turn.
- String changes made/needed?: none
- Is Android affected?: no
| Assignee | ||
Comment 8•4 days ago
|
||
On macOS 26, the NSSavePanel/NSOpenPanel sheet completion handler can run before the panel's modal session has fully unwound. We invoke nsIFilePickerShownCallback::Done() synchronously from inside that completion handler, so a consumer that opens another modal from Done() (for example Thunderbird's "Backup Secret Key to File" flow in bug 2052844) starts the new modal on top of a session that is still tearing down, which hangs.
Defer Done() to a fresh main-thread turn in all four picker modes (open, open-multiple, folder, save) so the modal finishes unwinding first. This matches the JS-side workaround of bouncing off Services.tm.dispatchToMainThread before launching the next modal, but fixes it once for every file-picker consumer. The callback still runs on the main thread exactly once with the same ResultCode; only its timing moves one turn later.
Original Revision: https://phabricator.services.mozilla.com/D310869
Comment 9•4 days ago
|
||
firefox-release Uplift Approval Request
- User impact if declined/Reason for urgency: Opening a second file picker dialog can cause a hang.
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing:
- Risk associated with taking this patch: low
- Explanation of risk level: This simply defers invoking filepicker callbacks to another main thread turn.
- String changes made/needed?: none
- Is Android affected?: no
| Assignee | ||
Comment 10•4 days ago
|
||
On macOS 26, the NSSavePanel/NSOpenPanel sheet completion handler can run before the panel's modal session has fully unwound. We invoke nsIFilePickerShownCallback::Done() synchronously from inside that completion handler, so a consumer that opens another modal from Done() (for example Thunderbird's "Backup Secret Key to File" flow in bug 2052844) starts the new modal on top of a session that is still tearing down, which hangs.
Defer Done() to a fresh main-thread turn in all four picker modes (open, open-multiple, folder, save) so the modal finishes unwinding first. This matches the JS-side workaround of bouncing off Services.tm.dispatchToMainThread before launching the next modal, but fixes it once for every file-picker consumer. The callback still runs on the main thread exactly once with the same ResultCode; only its timing moves one turn later.
Original Revision: https://phabricator.services.mozilla.com/D310869
Updated•2 days ago
|
Updated•2 days ago
|
Comment 11•2 days ago
|
||
| uplift | ||
Updated•1 day ago
|
Updated•1 day ago
|
Comment 12•1 day ago
|
||
| uplift | ||
Updated•22 hours ago
|
Description
•