fix usage of chrome.windows in android

This commit is contained in:
tophf 2022-07-01 07:55:11 +03:00
parent a10003ee80
commit d68433c867
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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,