Work-around for window position not always changing on first update() call.

This commit is contained in:
hackademix 2022-11-21 22:21:29 +01:00
parent 2731eeaa45
commit 9ba2ae0749
No known key found for this signature in database
GPG Key ID: 231A83AFDA9C2434
1 changed files with 7 additions and 5 deletions

View File

@ -136,11 +136,13 @@
} }
let win = await browser.windows.getCurrent(); let win = await browser.windows.getCurrent();
let delta = document.documentElement.offsetHeight - window.innerHeight; let delta = document.documentElement.offsetHeight - window.innerHeight;
await browser.windows.update(win.id, { for (let attempts = 2; attempts-- > 0;) {
height: win.height + delta, await browser.windows.update(win.id, {
top: win.top - Math.round(delta / 2), height: win.height + delta,
focused: false top: win.top - Math.round(delta / 2),
}); focused: false
});
}
await browser.windows.update(win.id, {focused: true}); await browser.windows.update(win.id, {focused: true});
} }
if (document.readyState === "complete") { if (document.readyState === "complete") {