Bug 1796408 - Restore previous timing. r=Gijs

Big hack, but this ensures that the dialog is at the right position when it's a
subdialog positioned by the front-end... Otherwise we fire this before setting
the vertical margin in the opener, and sadness ensues.

I'd try to find a nicer solution to this, but:

 * This is the easiest that is potentially upliftable.
 * I'm a bit swamped with some other work.
 * This is an extra one-liner, for a very niche feature.

Differential Revision: https://phabricator.services.mozilla.com/D160420
This commit is contained in:
Emilio Cobos Álvarez 2022-10-26 21:35:33 +00:00
Родитель 8a1837ddfb
Коммит ee0ed03f53
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -343,6 +343,11 @@
return;
}
try {
// FIXME(emilio, bug 1797624): This setTimeout() ensures enough time
// has passed so that the dialog vertical margin has been set by the
// front-end. For subdialogs, cursor positioning should probably be
// done by the opener instead, once the dialog is positioned.
await new Promise(r => setTimeout(r, 0));
await window.promiseDocumentFlushed(() => {});
window.notifyDefaultButtonLoaded(defaultButton);
} catch (e) {}