commit 6c124075b9a8540d848cd02cc3ba170eae052915 parent c58349ebaa173881a4201e83e928325707758eb8 Author: Sebastian <sebasjm@gmail.com> Date: Mon, 4 Mar 2024 12:07:35 -0300 fix #8371 Diffstat:
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/packages/taler-wallet-webextension/src/context/alert.ts b/packages/taler-wallet-webextension/src/context/alert.ts @@ -222,7 +222,7 @@ function isWalletNotAvailable(i18n: InternationalizationAPI, detail: TalerErrorD && detail.lastError) { const le = detail.lastError as TalerErrorDetail if (le.code === TalerErrorCode.WALLET_DB_UNAVAILABLE) { - if (platform.isFirefox()) { + if (platform.isFirefox() && platform.runningOnPrivateMode()) { return i18n.str`Could not open the wallet database. Firefox is known to run into this problem under "permanent private mode".` } else { return i18n.str`Could not open the wallet database.` diff --git a/packages/taler-wallet-webextension/src/platform/api.ts b/packages/taler-wallet-webextension/src/platform/api.ts @@ -234,6 +234,11 @@ export interface BackgroundPlatformAPI { } export interface ForegroundPlatformAPI { /** + * Check if the extension is running under + * chrome incognito or firefox private mode. + */ + runningOnPrivateMode(): boolean; + /** * FIXME: should not be needed * * check if the platform is firefox diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts b/packages/taler-wallet-webextension/src/platform/chrome.ts @@ -16,12 +16,11 @@ import { Logger, - TalerErrorCode, - TalerUriAction, TalerError, - parseTalerUri, + TalerErrorCode, TalerUri, - stringifyTalerUri, + TalerUriAction, + stringifyTalerUri } from "@gnu-taler/taler-util"; import { WalletOperations } from "@gnu-taler/taler-wallet-core"; import { BackgroundOperations } from "../wxApi.js"; @@ -33,9 +32,8 @@ import { MessageFromBackend, MessageFromFrontend, MessageResponse, - Permissions, Settings, - defaultSettings, + defaultSettings } from "./api.js"; const api: BackgroundPlatformAPI & ForegroundPlatformAPI = { @@ -44,6 +42,7 @@ const api: BackgroundPlatformAPI & ForegroundPlatformAPI = { findTalerUriInActiveTab, findTalerUriInClipboard, getPermissionsApi, + runningOnPrivateMode, getWalletWebExVersion, triggerWalletEvent, listenToWalletBackground, @@ -739,3 +738,6 @@ function listenNetworkConnectionState( }; } +function runningOnPrivateMode(): boolean { + return chrome.extension.inIncognitoContext +} +\ No newline at end of file diff --git a/packages/taler-wallet-webextension/src/platform/dev.ts b/packages/taler-wallet-webextension/src/platform/dev.ts @@ -29,6 +29,7 @@ import { const logger = new Logger("dev.ts"); const api: BackgroundPlatformAPI & ForegroundPlatformAPI = { + runningOnPrivateMode: () => false, isFirefox: () => false, getSettingsFromStorage: () => Promise.resolve(defaultSettings), keepAlive: (cb: VoidFunction) => cb(),