summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-03-04 12:07:35 -0300
committerSebastian <sebasjm@gmail.com>2024-03-04 12:07:35 -0300
commit6c124075b9a8540d848cd02cc3ba170eae052915 (patch)
tree6c509d89f63c6cd4a29026c32f0d3f8f74082aec
parentc58349ebaa173881a4201e83e928325707758eb8 (diff)
downloadwallet-core-6c124075b9a8540d848cd02cc3ba170eae052915.tar.gz
wallet-core-6c124075b9a8540d848cd02cc3ba170eae052915.tar.bz2
wallet-core-6c124075b9a8540d848cd02cc3ba170eae052915.zip
fix #8371
-rw-r--r--packages/taler-wallet-webextension/src/context/alert.ts2
-rw-r--r--packages/taler-wallet-webextension/src/platform/api.ts5
-rw-r--r--packages/taler-wallet-webextension/src/platform/chrome.ts14
-rw-r--r--packages/taler-wallet-webextension/src/platform/dev.ts1
4 files changed, 15 insertions, 7 deletions
diff --git a/packages/taler-wallet-webextension/src/context/alert.ts b/packages/taler-wallet-webextension/src/context/alert.ts
index 45fc9d9d9..36de7c7e4 100644
--- 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
index 57e7c51f4..4ae629dc3 100644
--- 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
index 68b065853..2cdc4d8b6 100644
--- 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
index 7cbbe5b25..1e43476ea 100644
--- 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(),