From 043d88a7693ede5256b6a91c2b7cfa712545fa18 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Tue, 16 Aug 2016 04:41:05 +0300 Subject: [PATCH] Make console-extra safe against Duktape.enc change --- extras/console/duk_console.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/extras/console/duk_console.c b/extras/console/duk_console.c index af8a369b..eef25d84 100644 --- a/extras/console/duk_console.c +++ b/extras/console/duk_console.c @@ -113,13 +113,15 @@ void duk_console_init(duk_context *ctx, duk_uint_t flags) { * to ToString(v). */ duk_eval_string(ctx, - "(function format(v){" - "try{" - "return Duktape.enc('jx',v);" - "}catch(e){" - "return ''+v;" - "}" - "})"); + "(function (E) {" + "return function format(v){" + "try{" + "return E('jx',v);" + "}catch(e){" + "return ''+v;" + "}" + "};" + "})(Duktape.enc)"); duk_put_prop_string(ctx, -2, "format"); duk__console_reg_vararg_func(ctx, duk__console_assert, "assert");