From 05e1455280db48d51fd4bf02911f51fe1e9222fa Mon Sep 17 00:00:00 2001
From: tophf <tophf@gmx.com>
Date: Sat, 26 Dec 2020 19:06:13 +0300
Subject: [PATCH] ff bug workaround for simple editor window

---
 background/background.js | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/background/background.js b/background/background.js
index 35690c16..371e8253 100644
--- a/background/background.js
+++ b/background/background.js
@@ -48,16 +48,20 @@ Object.assign(API, {
      }} params
    * @returns {Promise<chrome.tabs.Tab>}
    */
-  openEditor(params) {
+  async openEditor(params) {
     const u = new URL(chrome.runtime.getURL('edit.html'));
     u.search = new URLSearchParams(params);
-    return openURL({
+    const wnd = prefs.get('openEditInWindow');
+    const wndPos = wnd && prefs.get('windowPosition');
+    const wndBase = wnd && prefs.get('openEditInWindow.popup') ? {type: 'popup'} : {};
+    const ffBug = wnd && FIREFOX; // https://bugzil.la/1271047
+    const tab = await openURL({
       url: `${u}`,
       currentWindow: null,
-      newWindow: prefs.get('openEditInWindow') && Object.assign({},
-        prefs.get('openEditInWindow.popup') && {type: 'popup'},
-        prefs.get('windowPosition')),
+      newWindow: Object.assign(wndBase, !ffBug && wndPos),
     });
+    if (ffBug) await browser.windows.update(tab.windowId, wndPos);
+    return tab;
   },
 
   /** @returns {Promise<chrome.tabs.Tab>} */