commit 2445b1879a29ac6bc453e1dee08dab452685b579
parent 7c5baabe16266a309c16c3afdec277fdb4f0cb7b
Author: Florian Dold <florian@dold.me>
Date: Wed, 28 Feb 2024 11:49:46 +0100
embedded: testing call to directly eval JS
Useful to test the native HTTP implementation
Diffstat:
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/packages/taler-wallet-embedded/src/wallet-qjs.ts b/packages/taler-wallet-embedded/src/wallet-qjs.ts
@@ -233,7 +233,19 @@ export function installNativeWalletListener(): void {
try {
if (msg.operation.startsWith("anastasis")) {
respMsg = await handleAnastasisRequest(operation, id, msg.args ?? {});
- } else {
+ } else if (msg.operation === "testing-dangerously-eval") {
+ // Eval code, used only for testing. No client may rely on this.
+ logger.info(`evaluating ${msg.args.jscode}`);
+ const f = new Function(msg.args.jscode);
+ f();
+ respMsg = {
+ type: "response",
+ result: {},
+ operation: "testing-dangerously-eval",
+ id: msg.id,
+ };
+ }
+ {
respMsg = await handler.handleMessage(operation, id, msg.args ?? {});
}
} catch (e) {