Avoid unnecessary prompt resizing.

This commit is contained in:
hackademix 2023-05-21 21:33:23 +02:00
parent 41774cbeb7
commit 7d335ed787
No known key found for this signature in database
GPG Key ID: 231A83AFDA9C2434
1 changed files with 7 additions and 3 deletions

View File

@ -70,11 +70,15 @@ var Prompts = (() => {
if (width && height && (popupWidth !== width || popupHeight !== height)) { if (width && height && (popupWidth !== width || popupHeight !== height)) {
left += Math.round((popupWidth - width) / 2); left += Math.round((popupWidth - width) / 2);
top += Math.round((popupHeight - height) / 2); top += Math.round((popupHeight - height) / 2);
}
for (let attempts = 2; attempts-- > 0;) // position gets set only 2nd time, moz bug?
await browser.windows.update(popup.id, await browser.windows.update(popup.id,
{left, top, width, height, focused: false}); {left, top, width, height, focused: false});
}
for (let attempts = 2; attempts-- > 0;) {
// position gets set only 2nd time, moz bug?
await browser.windows.update(popup.id,
{left, top, focused: false});
}
if (parent) { if (parent) {
await browser.windows.update(parent.id, {focused: true}); await browser.windows.update(parent.id, {focused: true});
} }