Browse Source

Merge pull request #906 from svaarala/console-extra-avoid-duktape-dependency

Make console-extra safe against Duktape.enc change
pull/910/head
Sami Vaarala 8 years ago
committed by GitHub
parent
commit
8dc563bcce
  1. 16
      extras/console/duk_console.c

16
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");

Loading…
Cancel
Save