mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[spidermonkey] console.warn
This commit is contained in:
parent
539bb84e1e
commit
597280940d
@ -115,6 +115,7 @@ static INIT_LIST_OF(struct string_list_item, disallowed_urls);
|
||||
|
||||
char *console_error_filename;
|
||||
char *console_log_filename;
|
||||
char *console_warn_filename;
|
||||
|
||||
char *local_storage_filename;
|
||||
|
||||
@ -706,6 +707,7 @@ init_ecmascript_module(struct module *module)
|
||||
if (xdg_config_home) {
|
||||
/* ecmascript console log */
|
||||
console_log_filename = straconcat(xdg_config_home, "/console.log", NULL);
|
||||
console_warn_filename = straconcat(xdg_config_home, "/console.warn", NULL);
|
||||
console_error_filename = program.testjs ? stracpy("/dev/stderr") : straconcat(xdg_config_home, "/console.err", NULL);
|
||||
/* ecmascript local storage db location */
|
||||
#ifdef CONFIG_OS_DOS
|
||||
@ -731,6 +733,7 @@ done_ecmascript_module(struct module *module)
|
||||
free_string_list(&disallowed_urls);
|
||||
mem_free_if(console_log_filename);
|
||||
mem_free_if(console_error_filename);
|
||||
mem_free_if(console_warn_filename);
|
||||
mem_free_if(local_storage_filename);
|
||||
done_map_timer();
|
||||
}
|
||||
|
@ -196,6 +196,7 @@ void location_goto_const(struct document_view *doc_view, const char *url, int re
|
||||
|
||||
extern char *console_error_filename;
|
||||
extern char *console_log_filename;
|
||||
extern char *console_warn_filename;
|
||||
|
||||
extern char *local_storage_filename;
|
||||
extern int local_storage_ready;
|
||||
|
@ -58,12 +58,14 @@ static bool console_assert(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool console_error(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool console_exit(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool console_log(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool console_warn(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
const spidermonkeyFunctionSpec console_funcs[] = {
|
||||
{ "assert", console_assert, 2 },
|
||||
{ "log", console_log, 1 },
|
||||
{ "error", console_error, 1 },
|
||||
{ "exit", console_exit, 0 },
|
||||
{ "log", console_log, 1 },
|
||||
{ "warn", console_warn, 1 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@ -154,6 +156,15 @@ console_error(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
return console_log_common(ctx, argc, vp, console_error_filename);
|
||||
}
|
||||
|
||||
static bool
|
||||
console_warn(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
return console_log_common(ctx, argc, vp, console_warn_filename);
|
||||
}
|
||||
|
||||
static bool
|
||||
console_exit(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user