Fix incorrect truthy check on potentially zero-value properties

This commit is contained in:
hensm
2023-03-25 20:06:54 +00:00
parent 3225eed057
commit 4fe1882f90

View File

@@ -116,7 +116,12 @@ export default class ReceiverSelector extends TypedEventTarget<ReceiverSelectorE
* left/top positions for the popup. * left/top positions for the popup.
*/ */
const refWin = await browser.windows.getCurrent(); const refWin = await browser.windows.getCurrent();
if (refWin.width && refWin.height && refWin.left && refWin.top) { if (
refWin.width !== undefined &&
refWin.height !== undefined &&
refWin.left !== undefined &&
refWin.top !== undefined
) {
const centerX = refWin.left + refWin.width / 2; const centerX = refWin.left + refWin.width / 2;
const centerY = refWin.top + refWin.height / 3; const centerY = refWin.top + refWin.height / 3;