Loading src/client/js-duk.c +6 −6 Original line number Diff line number Diff line Loading @@ -895,15 +895,14 @@ static const duk_function_list_entry store_handlers[] = { }; /* The owning object must be at the top of the stack when calling this */ static void define_store_object(void) static void define_store_object(const char *name) { duk_push_string(ctx, "Store"); /* To be used by duk_def_prop() below */ duk_push_string(ctx, name); /* To be used by duk_def_prop() below */ duk_get_prop_string(ctx, -2, "Proxy"); /* Push the built-in Proxy constructor */ duk_push_object(ctx); /* Store */ duk_push_object(ctx); /* Store object */ duk_push_object(ctx); /* Handler object */ duk_put_function_list(ctx, -1, store_handlers); duk_new(ctx, 2); /* js equiv: new Proxy(Store, handler); */ duk_push_proxy(ctx, 0); /* Define the Store object in the global object */ duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE); Loading Loading @@ -964,6 +963,7 @@ static void define_api(void) define_func("beep", js_beep, 1); define_func("input", js_input, 1); define_func("termsize", js_termsize, 0); define_store_object("store"); /* mw object */ duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE); Loading Loading @@ -1005,7 +1005,7 @@ int setup_js(void) define_func("termsize", js_termsize, 0); define_func("bind", js_bind, 3); define_func("unbind", js_unbind, 2); define_store_object(); define_store_object("Store"); if (is_local) // Don't allow bbs user to use dbquery define_func("dbquery", js_dbquery, 2); duk_pop(ctx); Loading Loading
src/client/js-duk.c +6 −6 Original line number Diff line number Diff line Loading @@ -895,15 +895,14 @@ static const duk_function_list_entry store_handlers[] = { }; /* The owning object must be at the top of the stack when calling this */ static void define_store_object(void) static void define_store_object(const char *name) { duk_push_string(ctx, "Store"); /* To be used by duk_def_prop() below */ duk_push_string(ctx, name); /* To be used by duk_def_prop() below */ duk_get_prop_string(ctx, -2, "Proxy"); /* Push the built-in Proxy constructor */ duk_push_object(ctx); /* Store */ duk_push_object(ctx); /* Store object */ duk_push_object(ctx); /* Handler object */ duk_put_function_list(ctx, -1, store_handlers); duk_new(ctx, 2); /* js equiv: new Proxy(Store, handler); */ duk_push_proxy(ctx, 0); /* Define the Store object in the global object */ duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE); Loading Loading @@ -964,6 +963,7 @@ static void define_api(void) define_func("beep", js_beep, 1); define_func("input", js_input, 1); define_func("termsize", js_termsize, 0); define_store_object("store"); /* mw object */ duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_VALUE); Loading Loading @@ -1005,7 +1005,7 @@ int setup_js(void) define_func("termsize", js_termsize, 0); define_func("bind", js_bind, 3); define_func("unbind", js_unbind, 2); define_store_object(); define_store_object("Store"); if (is_local) // Don't allow bbs user to use dbquery define_func("dbquery", js_dbquery, 2); duk_pop(ctx); Loading