gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (99550b00 -> 7f3ce304)


From: gnunet
Subject: [taler-wallet-core] branch master updated (99550b00 -> 7f3ce304)
Date: Sun, 20 Jun 2021 21:15:04 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository wallet-core.

    from 99550b00 hide internal wallet state, keep it internal to package
     new 221e71b9 remove missing debugger
     new 7f3ce304 missing globalThis Polyfill, remove duplicate url util

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-util/src/i18n.ts                    |  1 -
 packages/taler-util/src/index.ts                   |  1 +
 packages/taler-util/src/url.ts                     | 15 +++++
 .../src/integrationtests/libeufin.ts               |  2 +-
 .../taler-wallet-cli/src/integrationtests/sync.ts  |  2 +-
 .../integrationtests/test-exchange-management.ts   |  4 +-
 .../test-merchant-instances-delete.ts              |  2 +-
 .../integrationtests/test-merchant-instances.ts    |  2 +-
 .../integrationtests/test-merchant-longpolling.ts  |  3 +-
 .../integrationtests/test-merchant-refund-api.ts   |  4 +-
 .../src/integrationtests/test-pay-abort.ts         |  4 +-
 .../src/integrationtests/test-pay-paid.ts          |  3 +-
 .../src/integrationtests/test-payment-transient.ts |  3 +-
 .../taler-wallet-core/src/headless/NodeHttpLib.ts  |  3 +-
 packages/taler-wallet-core/src/index.ts            |  1 -
 .../src/operations/backup/index.ts                 |  2 +-
 .../taler-wallet-core/src/operations/deposits.ts   |  2 +-
 .../taler-wallet-core/src/operations/exchanges.ts  |  2 +-
 packages/taler-wallet-core/src/operations/pay.ts   |  2 +-
 .../taler-wallet-core/src/operations/recoup.ts     |  3 +-
 .../taler-wallet-core/src/operations/refresh.ts    |  2 +-
 .../taler-wallet-core/src/operations/refund.ts     |  2 +-
 .../taler-wallet-core/src/operations/reserves.ts   |  3 +-
 .../taler-wallet-core/src/operations/testing.ts    |  2 +-
 packages/taler-wallet-core/src/operations/tip.ts   |  2 +-
 .../taler-wallet-core/src/operations/withdraw.ts   |  2 +-
 .../taler-wallet-core/src/util/RequestThrottler.ts |  2 +-
 packages/taler-wallet-core/src/util/url.ts         | 74 ----------------------
 packages/taler-wallet-webextension/src/compat.ts   | 15 +++++
 29 files changed, 60 insertions(+), 105 deletions(-)
 delete mode 100644 packages/taler-wallet-core/src/util/url.ts

diff --git a/packages/taler-util/src/i18n.ts b/packages/taler-util/src/i18n.ts
index 4a938410..0324d8e0 100644
--- a/packages/taler-util/src/i18n.ts
+++ b/packages/taler-util/src/i18n.ts
@@ -17,7 +17,6 @@ export function setupI18n(lang: string, strings: { [s: 
string]: any }): any {
     lang = "en-US";
     logger.warn(`language ${lang} not found, defaulting to english`);
   }
-  debugger;
   jed = new jedLib.Jed(strings[lang]);
 }
 
diff --git a/packages/taler-util/src/index.ts b/packages/taler-util/src/index.ts
index 2e1c6876..3e49cea1 100644
--- a/packages/taler-util/src/index.ts
+++ b/packages/taler-util/src/index.ts
@@ -19,3 +19,4 @@ export * from "./transactionsTypes.js";
 export * from "./walletTypes.js";
 export * from "./i18n.js";
 export * from "./logging.js";
+export * from "./url.js";
diff --git a/packages/taler-util/src/url.ts b/packages/taler-util/src/url.ts
index b50b4b46..a52d8036 100644
--- a/packages/taler-util/src/url.ts
+++ b/packages/taler-util/src/url.ts
@@ -56,6 +56,21 @@ export interface URLCtor {
   new (url: string, base?: string | URL): URL;
 }
 
+// globalThis polyfill, see https://mathiasbynens.be/notes/globalthis
+(function () {
+  if (typeof globalThis === "object") return;
+  Object.defineProperty(Object.prototype, "__magic__", {
+    get: function () {
+      return this;
+    },
+    configurable: true, // This makes it possible to `delete` the getter later.
+  });
+  // @ts-ignore: polyfill magic
+  __magic__.globalThis = __magic__; // lolwat
+  // @ts-ignore: polyfill magic
+  delete Object.prototype.__magic__;
+})();
+
 // @ts-ignore
 const _URL = globalThis.URL;
 if (!_URL) {
diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts 
b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
index 4b14cc02..eb501f57 100644
--- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
@@ -18,7 +18,7 @@
  * Imports.
  */
 import axios from "axios";
-import { URL } from "@gnu-taler/taler-wallet-core";
+import { URL } from "@gnu-taler/taler-util";
 import { getRandomIban, getRandomString } from "./helpers";
 import {
   GlobalTestState,
diff --git a/packages/taler-wallet-cli/src/integrationtests/sync.ts 
b/packages/taler-wallet-cli/src/integrationtests/sync.ts
index 695f9a47..73d3c9dd 100644
--- a/packages/taler-wallet-cli/src/integrationtests/sync.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/sync.ts
@@ -18,7 +18,7 @@
  * Imports.
  */
 import axios from "axios";
-import { URL } from "@gnu-taler/taler-wallet-core";
+import { URL } from "@gnu-taler/taler-util";
 import * as fs from "fs";
 import * as util from "util";
 import {
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
index 4f3446f7..a5cdd8da 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-exchange-management.ts
@@ -27,8 +27,8 @@ import {
   BankApi,
   BankAccessApi,
 } from "./harness";
-import { URL, WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import { ExchangesListRespose, TalerErrorCode } from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { ExchangesListRespose, URL, TalerErrorCode } from 
"@gnu-taler/taler-util";
 import {
   FaultInjectedExchangeService,
   FaultInjectionResponseContext,
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts
 
b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts
index 09353715..8b89b076 100644
--- 
a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts
+++ 
b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts
@@ -17,7 +17,7 @@
 /**
  * Imports.
  */
-import { URL } from "@gnu-taler/taler-wallet-core";
+import { URL } from "@gnu-taler/taler-util";
 import axios from "axios";
 import {
   ExchangeService,
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts
index 539203b9..73d4a022 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts
@@ -17,7 +17,7 @@
 /**
  * Imports.
  */
-import { URL } from "@gnu-taler/taler-wallet-core";
+import { URL } from "@gnu-taler/taler-util";
 import axios from "axios";
 import {
   ExchangeService,
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts
index 04888ecc..d9178763 100644
--- 
a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts
+++ 
b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts
@@ -23,9 +23,10 @@ import {
   PreparePayResultType,
   codecForMerchantOrderStatusUnpaid,
   ConfirmPayResultType,
+  URL
 } from "@gnu-taler/taler-util";
 import axios from "axios";
-import { URL, WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 
 /**
  * Run test for basic, bank-integrated withdrawal.
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts
index 4d431099..53a6b167 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts
@@ -30,9 +30,9 @@ import {
   withdrawViaBank,
   SimpleTestEnvironment,
 } from "./helpers";
-import { durationFromSpec, PreparePayResultType } from "@gnu-taler/taler-util";
+import { URL, durationFromSpec, PreparePayResultType } from 
"@gnu-taler/taler-util";
 import axios from "axios";
-import { URL, WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 
 async function testRefundApiWithFulfillmentUrl(
   t: GlobalTestState,
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
index 29e0fd0a..709ad106 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-pay-abort.ts
@@ -22,8 +22,8 @@
 /**
  * Imports.
  */
-import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util";
-import { URL, WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { URL, PreparePayResultType, TalerErrorCode } from 
"@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import {
   FaultInjectionRequestContext,
   FaultInjectionResponseContext,
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts
index 3155898a..1fb0b3c9 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts
@@ -26,10 +26,11 @@ import {
   PreparePayResultType,
   codecForMerchantOrderStatusUnpaid,
   ConfirmPayResultType,
+  URL,
 } from "@gnu-taler/taler-util";
 import axios from "axios";
 import { FaultInjectionRequestContext } from "./faultInjection";
-import { URL, WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 
 /**
  * Run test for the wallets repurchase detection mechanism
diff --git 
a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts 
b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts
index 102c3c59..ce0502b2 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts
@@ -33,8 +33,9 @@ import {
   PreparePayResultType,
   TalerErrorCode,
   TalerErrorDetails,
+  URL,
 } from "@gnu-taler/taler-util";
-import { URL, WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 
 /**
  * Run test for a payment where the merchant has a transient
diff --git a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts 
b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
index 1dd20734..1186ea4d 100644
--- a/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
+++ b/packages/taler-wallet-core/src/headless/NodeHttpLib.ts
@@ -28,10 +28,9 @@ import {
 import { RequestThrottler } from "../util/RequestThrottler.js";
 import Axios, { AxiosResponse } from "axios";
 import { OperationFailedError, makeErrorDetails } from "../errors.js";
-import { URL } from "../util/url.js";
 import { Logger } from "@gnu-taler/taler-util";
 import { bytesToString } from "../crypto/talerCrypto.js";
-import { TalerErrorCode } from "@gnu-taler/taler-util";
+import { TalerErrorCode, URL } from "@gnu-taler/taler-util";
 
 const logger = new Logger("NodeHttpLib.ts");
 
diff --git a/packages/taler-wallet-core/src/index.ts 
b/packages/taler-wallet-core/src/index.ts
index 822c1aa2..1c97bf7c 100644
--- a/packages/taler-wallet-core/src/index.ts
+++ b/packages/taler-wallet-core/src/index.ts
@@ -22,7 +22,6 @@
 export * from "./errors.js";
 
 // Util functionality
-export { URL } from "./util/url.js";
 export * from "./util/promiseUtils.js";
 export * from "./util/query.js";
 export * from "./util/http.js";
diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts 
b/packages/taler-wallet-core/src/operations/backup/index.ts
index 8a0aad56..041c927a 100644
--- a/packages/taler-wallet-core/src/operations/backup/index.ts
+++ b/packages/taler-wallet-core/src/operations/backup/index.ts
@@ -59,8 +59,8 @@ import {
   getTimestampNow,
   Timestamp,
   timestampAddDuration,
+  URL
 } from "@gnu-taler/taler-util";
-import { URL } from "../../util/url.js";
 import {
   buildCodecForObject,
   Codec,
diff --git a/packages/taler-wallet-core/src/operations/deposits.ts 
b/packages/taler-wallet-core/src/operations/deposits.ts
index 5051fd32..9dee7557 100644
--- a/packages/taler-wallet-core/src/operations/deposits.ts
+++ b/packages/taler-wallet-core/src/operations/deposits.ts
@@ -36,6 +36,7 @@ import {
   timestampTruncateToSecond,
   TrackDepositGroupRequest,
   TrackDepositGroupResponse,
+  URL
 } from "@gnu-taler/taler-util";
 import { InternalWalletState } from "../common.js";
 import { kdf } from "../crypto/primitives/kdf.js";
@@ -49,7 +50,6 @@ import { guardOperationException } from "../errors.js";
 import { selectPayCoins } from "../util/coinSelection.js";
 import { readSuccessResponseJsonOrThrow } from "../util/http.js";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { URL } from "../util/url.js";
 import { getExchangeDetails } from "./exchanges.js";
 import {
   applyCoinSpend,
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts 
b/packages/taler-wallet-core/src/operations/exchanges.ts
index 65cc8f5e..85455cf9 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -37,6 +37,7 @@ import {
   parsePaytoUri,
   Recoup,
   TalerErrorCode,
+  URL,
   TalerErrorDetails,
   Timestamp,
 } from "@gnu-taler/taler-util";
@@ -59,7 +60,6 @@ import {
 } from "../util/http.js";
 import { DbAccess, GetReadOnlyAccess } from "../util/query.js";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { URL } from "../util/url.js";
 import {
   guardOperationException,
   makeErrorDetails,
diff --git a/packages/taler-wallet-core/src/operations/pay.ts 
b/packages/taler-wallet-core/src/operations/pay.ts
index 2a9bf154..464c3136 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -51,6 +51,7 @@ import {
   PreparePayResultType,
   parsePayUri,
   Logger,
+  URL,
   getDurationRemaining,
 } from "@gnu-taler/taler-util";
 import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js";
@@ -99,7 +100,6 @@ import {
   OperationFailedAndReportedError,
   OperationFailedError,
 } from "../errors.js";
-import { URL } from "../util/url.js";
 
 /**
  * Logger.
diff --git a/packages/taler-wallet-core/src/operations/recoup.ts 
b/packages/taler-wallet-core/src/operations/recoup.ts
index 40211112..4510bda1 100644
--- a/packages/taler-wallet-core/src/operations/recoup.ts
+++ b/packages/taler-wallet-core/src/operations/recoup.ts
@@ -45,9 +45,8 @@ import {
 } from "../db.js";
 
 import { readSuccessResponseJsonOrThrow } from "../util/http.js";
-import { Logger } from "@gnu-taler/taler-util";
+import { Logger, URL } from "@gnu-taler/taler-util";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { URL } from "../util/url.js";
 import { guardOperationException } from "../errors.js";
 import { createRefreshGroup, processRefreshGroup } from "./refresh.js";
 import { getReserveRequestTimeout, processReserve } from "./reserves.js";
diff --git a/packages/taler-wallet-core/src/operations/refresh.ts 
b/packages/taler-wallet-core/src/operations/refresh.ts
index 06d73564..cf8b4ddd 100644
--- a/packages/taler-wallet-core/src/operations/refresh.ts
+++ b/packages/taler-wallet-core/src/operations/refresh.ts
@@ -50,8 +50,8 @@ import {
   timestampAddDuration,
   timestampDifference,
   timestampMin,
+  URL,
 } from "@gnu-taler/taler-util";
-import { URL } from "../util/url.js";
 import { guardOperationException } from "../errors.js";
 import { updateExchangeFromUrl } from "./exchanges.js";
 import { EXCHANGE_COINS_LOCK, InternalWalletState } from "../common.js";
diff --git a/packages/taler-wallet-core/src/operations/refund.ts 
b/packages/taler-wallet-core/src/operations/refund.ts
index 09006b81..4ea80689 100644
--- a/packages/taler-wallet-core/src/operations/refund.ts
+++ b/packages/taler-wallet-core/src/operations/refund.ts
@@ -42,6 +42,7 @@ import {
   RefreshReason,
   TalerErrorCode,
   TalerErrorDetails,
+  URL,
   timestampAddDuration,
 } from "@gnu-taler/taler-util";
 import {
@@ -56,7 +57,6 @@ import { readSuccessResponseJsonOrThrow } from 
"../util/http.js";
 import { checkDbInvariant } from "../util/invariants.js";
 import { GetReadWriteAccess } from "../util/query.js";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { URL } from "../util/url.js";
 import { guardOperationException } from "../errors.js";
 import { createRefreshGroup, getTotalRefreshCost } from "./refresh.js";
 import { InternalWalletState } from "../common.js";
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts 
b/packages/taler-wallet-core/src/operations/reserves.ts
index fca4d214..162b5b40 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -64,13 +64,12 @@ import {
   getBankWithdrawalInfo,
 } from "./withdraw.js";
 import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js";
-import { Logger } from "@gnu-taler/taler-util";
+import { Logger, URL } from "@gnu-taler/taler-util";
 import {
   readSuccessResponseJsonOrErrorCode,
   readSuccessResponseJsonOrThrow,
   throwUnexpectedRequestError,
 } from "../util/http.js";
-import { URL } from "../util/url.js";
 import { GetReadOnlyAccess } from "../util/query.js";
 
 const logger = new Logger("reserves.ts");
diff --git a/packages/taler-wallet-core/src/operations/testing.ts 
b/packages/taler-wallet-core/src/operations/testing.ts
index 8a0c2020..c9786801 100644
--- a/packages/taler-wallet-core/src/operations/testing.ts
+++ b/packages/taler-wallet-core/src/operations/testing.ts
@@ -31,11 +31,11 @@ import {
   IntegrationTestArgs,
   Amounts,
   TestPayArgs,
+  URL,
   PreparePayResultType,
 } from "@gnu-taler/taler-util";
 import { createTalerWithdrawReserve } from "./reserves.js";
 import { InternalWalletState } from "../common.js";
-import { URL } from "../util/url.js";
 import { confirmPay, preparePayForUri } from "./pay.js";
 import { getBalances } from "./balance.js";
 import { runUntilDone } from "../wallet.js";
diff --git a/packages/taler-wallet-core/src/operations/tip.ts 
b/packages/taler-wallet-core/src/operations/tip.ts
index 1da2c887..892a3b58 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -29,6 +29,7 @@ import {
   TalerErrorCode,
   codecForTipResponse,
   Logger,
+  URL,
 } from "@gnu-taler/taler-util";
 import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js";
 import {
@@ -50,7 +51,6 @@ import {
   selectWithdrawalDenominations,
   denomSelectionInfoToState,
 } from "./withdraw.js";
-import { URL } from "../util/url.js";
 import {
   getHttpResponseErrorDetails,
   readSuccessResponseJsonOrThrow,
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts 
b/packages/taler-wallet-core/src/operations/withdraw.ts
index 6cf20259..e966f6a1 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -39,6 +39,7 @@ import {
   timestampCmp,
   timestampSubtractDuraction,
   WithdrawResponse,
+  URL,
   WithdrawUriInfoResponse,
 } from "@gnu-taler/taler-util";
 import {
@@ -56,7 +57,6 @@ import {
 import { walletCoreDebugFlags } from "../util/debugFlags.js";
 import { readSuccessResponseJsonOrThrow } from "../util/http.js";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries.js";
-import { URL } from "../util/url.js";
 import {
   guardOperationException,
   makeErrorDetails,
diff --git a/packages/taler-wallet-core/src/util/RequestThrottler.ts 
b/packages/taler-wallet-core/src/util/RequestThrottler.ts
index 56242a23..d79afe47 100644
--- a/packages/taler-wallet-core/src/util/RequestThrottler.ts
+++ b/packages/taler-wallet-core/src/util/RequestThrottler.ts
@@ -26,8 +26,8 @@ import {
   timestampDifference,
   timestampCmp,
   Logger,
+  URL,
 } from "@gnu-taler/taler-util";
-import { URL } from "./url.js";
 
 const logger = new Logger("RequestThrottler.ts");
 
diff --git a/packages/taler-wallet-core/src/util/url.ts 
b/packages/taler-wallet-core/src/util/url.ts
deleted file mode 100644
index b50b4b46..00000000
--- a/packages/taler-wallet-core/src/util/url.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
- */
-
-interface URL {
-  hash: string;
-  host: string;
-  hostname: string;
-  href: string;
-  toString(): string;
-  readonly origin: string;
-  password: string;
-  pathname: string;
-  port: string;
-  protocol: string;
-  search: string;
-  readonly searchParams: URLSearchParams;
-  username: string;
-  toJSON(): string;
-}
-
-interface URLSearchParams {
-  append(name: string, value: string): void;
-  delete(name: string): void;
-  get(name: string): string | null;
-  getAll(name: string): string[];
-  has(name: string): boolean;
-  set(name: string, value: string): void;
-  sort(): void;
-  toString(): string;
-  forEach(
-    callbackfn: (value: string, key: string, parent: URLSearchParams) => void,
-    thisArg?: any,
-  ): void;
-}
-
-export interface URLSearchParamsCtor {
-  new (
-    init?: string[][] | Record<string, string> | string | URLSearchParams,
-  ): URLSearchParams;
-}
-
-export interface URLCtor {
-  new (url: string, base?: string | URL): URL;
-}
-
-// @ts-ignore
-const _URL = globalThis.URL;
-if (!_URL) {
-  throw Error("FATAL: URL not available");
-}
-
-export const URL: URLCtor = _URL;
-
-// @ts-ignore
-const _URLSearchParams = globalThis.URLSearchParams;
-
-if (!_URLSearchParams) {
-  throw Error("FATAL: URLSearchParams not available");
-}
-
-export const URLSearchParams: URLSearchParamsCtor = _URLSearchParams;
diff --git a/packages/taler-wallet-webextension/src/compat.ts 
b/packages/taler-wallet-webextension/src/compat.ts
index 4635abd8..36846e61 100644
--- a/packages/taler-wallet-webextension/src/compat.ts
+++ b/packages/taler-wallet-webextension/src/compat.ts
@@ -19,6 +19,21 @@
  * WebExtension APIs consistently.
  */
 
+// globalThis polyfill, see https://mathiasbynens.be/notes/globalthis
+(function () {
+  if (typeof globalThis === "object") return;
+  Object.defineProperty(Object.prototype, "__magic__", {
+    get: function () {
+      return this;
+    },
+    configurable: true, // This makes it possible to `delete` the getter later.
+  });
+  // @ts-ignore: polyfill magic
+  __magic__.globalThis = __magic__; // lolwat
+  // @ts-ignore: polyfill magic
+  delete Object.prototype.__magic__;
+})();
+
 export function isFirefox(): boolean {
   const rt = chrome.runtime as any;
   if (typeof rt.getBrowserInfo === "function") {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]