1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -05:00

print JavaScript errors etc for -test

This commit is contained in:
John Sebastian Peterson 2024-09-09 13:00:36 +03:00
parent 657625db40
commit 3e8ce96c08
3 changed files with 6 additions and 6 deletions

View File

@ -179,7 +179,7 @@ mujs_get_interpreter(struct ecmascript_interpreter *interpreter)
interpreter->backend_data = ctx;
JS_SetContextOpaque(ctx, interpreter);
// JS::SetWarningReporter(ctx, error_reporter);
JS::SetWarningReporter(ctx, error_reporter);
JS_SetInterruptHandler(rt, js_heartbeat_callback, interpreter);
// JS::RealmOptions options;
@ -267,7 +267,7 @@ mujs_eval(struct ecmascript_interpreter *interpreter,
struct string *code, struct string *ret)
{
assert(interpreter);
LOG_JS("%.100s...", code->source);
js_State *J = (js_State *)interpreter->backend_data;
interpreter->ret = ret;
js_dostring(J, code->source);

View File

@ -371,12 +371,10 @@ error_reporter(struct ecmascript_interpreter *interpreter, JSContext *ctx)
set_led_value(ses->status.ecmascript_led, 'J');
#endif
if (!get_opt_bool("ecmascript.error_reporting", ses)) {
return;
}
if (init_string(&f)) {
js_dump_error(ctx, &f);
LOG_JS("%s", f);
if (!get_opt_bool("ecmascript.error_reporting", ses)) return;
if (!init_string(&msg)) {
done_string(&f);
@ -401,6 +399,7 @@ quickjs_eval(struct ecmascript_interpreter *interpreter,
// if (!js_module_init_ok) {
// return;
// }
LOG_JS("%.100s...", code->source);
ctx = (JSContext *)interpreter->backend_data;
interpreter->heartbeat = add_heartbeat(interpreter);
interpreter->ret = ret;

View File

@ -84,6 +84,7 @@ js_console_log_common(JSContext *ctx, JSValueConst this_val, int argc, JSValueCo
if (!str) {
return JS_EXCEPTION;
}
LOG_JS("%s",str);
FILE *f = fopen(log_filename, "a");
if (f)