diff --git a/background/background.js b/background/background.js index c2fc7898..a8e5dd02 100644 --- a/background/background.js +++ b/background/background.js @@ -70,7 +70,7 @@ addAPI(/** @namespace API */ { async openEditor(params) { const u = new URL(chrome.runtime.getURL('edit.html')); u.search = new URLSearchParams(params); - const wnd = prefs.get('openEditInWindow'); + const wnd = chrome.windows && 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 diff --git a/background/token-manager.js b/background/token-manager.js index 153165a7..59247ef2 100644 --- a/background/token-manager.js +++ b/background/token-manager.js @@ -59,7 +59,7 @@ const tokenMan = (() => { const NETWORK_LATENCY = 30; // seconds const DEFAULT_REDIRECT_URI = 'https://clngdbkpkpeebahjckkjfobafhncgmne.chromiumapp.org/'; - let alwaysUseTab = FIREFOX ? false : null; + let alwaysUseTab = !chrome.windows || (FIREFOX ? false : null); class TokenError extends Error { constructor(provider, message) { @@ -167,13 +167,13 @@ const tokenMan = (() => { const url = `${provider.authURL}?${new URLSearchParams(query)}`; const width = Math.min(screen.availWidth - 100, 800); const height = Math.min(screen.availHeight - 100, 800); - const wnd = await browser.windows.getLastFocused(); + const wnd = !alwaysUseTab && await browser.windows.getLastFocused(); const finalUrl = await webextLaunchWebAuthFlow({ url, alwaysUseTab, interactive, redirect_uri: query.redirect_uri, - windowOptions: Object.assign({ + windowOptions: wnd && Object.assign({ state: 'normal', width, height,