aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-09-09 14:07:54 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-09-09 14:11:55 +0200
commit7352b62aab893a55e761ad2d8ea3cbc3834f760e (patch)
tree36c9402a46242ab93ad69456f833db63198b8411 /lib
parenta164ea91838b0dd2506acbd67e1b3720abaa7e01 (diff)
Make JSless payments work.
Diffstat (limited to 'lib')
-rw-r--r--lib/wallet/wxMessaging.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/wallet/wxMessaging.ts b/lib/wallet/wxMessaging.ts
index 95dcb929a..3ab56af71 100644
--- a/lib/wallet/wxMessaging.ts
+++ b/lib/wallet/wxMessaging.ts
@@ -54,7 +54,9 @@ function makeHandlers(db: IDBDatabase,
return exportDb(db);
},
["ping"]: function(detail, sender) {
- return Promise.resolve(paymentRequestCache[sender.tab.id]);
+ let info = paymentRequestCookies[sender.tab.id];
+ delete paymentRequestCookies[sender.tab.id];
+ return Promise.resolve(info);
},
["reset"]: function(detail, sender) {
if (db) {
@@ -240,7 +242,7 @@ class ChromeNotifier implements Notifier {
/**
* Mapping from tab ID to payment information (if any).
*/
-let paymentRequestCache = {};
+let paymentRequestCookies = {};
function handleHttpPayment(headerList: chrome.webRequest.HttpHeader[],
url: string, tabId: number): any {
@@ -251,7 +253,7 @@ function handleHttpPayment(headerList: chrome.webRequest.HttpHeader[],
const contractUrl = headers["x-taler-contract-url"];
if (contractUrl !== undefined) {
- paymentRequestCache[tabId] = {type: "fetch", contractUrl};
+ paymentRequestCookies[tabId] = {type: "fetch", contractUrl};
return;
}
@@ -266,7 +268,7 @@ function handleHttpPayment(headerList: chrome.webRequest.HttpHeader[],
// Offer URL is optional
const offerUrl = headers["x-taler-offer-url"];
- paymentRequestCache[tabId] = {
+ paymentRequestCookies[tabId] = {
type: "execute",
offerUrl,
payUrl,