summaryrefslogtreecommitdiff
path: root/content/handlers/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'content/handlers/javascript')
-rw-r--r--content/handlers/javascript/duktape/dukky.c8
-rw-r--r--content/handlers/javascript/js.h2
-rw-r--r--content/handlers/javascript/none/none.c2
3 files changed, 8 insertions, 4 deletions
diff --git a/content/handlers/javascript/duktape/dukky.c b/content/handlers/javascript/duktape/dukky.c
index e9e72650c..171736338 100644
--- a/content/handlers/javascript/duktape/dukky.c
+++ b/content/handlers/javascript/duktape/dukky.c
@@ -716,7 +716,7 @@ duk_int_t dukky_pcall(duk_context *ctx, duk_size_t argc, bool reset_timeout)
}
-bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
+bool js_exec(jscontext *ctx, const char *txt, size_t txtlen, const char *name)
{
assert(ctx);
if (txt == NULL || txtlen == 0) return false;
@@ -724,7 +724,11 @@ bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
NSLOG(dukky, DEEPDEBUG, "%zd bytes: %s", txtlen, txt);
(void) nsu_getmonotonic_ms(&ctx->exec_start_time);
- duk_push_string(CTX, "?unknown source?");
+ if (name != NULL) {
+ duk_push_string(CTX, name);
+ } else {
+ duk_push_string(CTX, "?unknown source?");
+ }
if (duk_pcompile_lstring_filename(CTX, DUK_COMPILE_EVAL, txt, txtlen) != 0) {
NSLOG(dukky, INFO, "Failed to compile JavaScript input");
goto handle_error;
diff --git a/content/handlers/javascript/js.h b/content/handlers/javascript/js.h
index 2929d0b5e..89a87afe3 100644
--- a/content/handlers/javascript/js.h
+++ b/content/handlers/javascript/js.h
@@ -67,7 +67,7 @@ void js_destroycontext(jscontext *ctx);
jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv);
/* execute some javascript in a context */
-bool js_exec(jscontext *ctx, const char *txt, size_t txtlen);
+bool js_exec(jscontext *ctx, const char *txt, size_t txtlen, const char *name);
/* fire an event at a dom node */
diff --git a/content/handlers/javascript/none/none.c b/content/handlers/javascript/none/none.c
index 9a8b0a49d..e1c992ebf 100644
--- a/content/handlers/javascript/none/none.c
+++ b/content/handlers/javascript/none/none.c
@@ -51,7 +51,7 @@ jsobject *js_newcompartment(jscontext *ctx, void *win_priv, void *doc_priv)
return NULL;
}
-bool js_exec(jscontext *ctx, const char *txt, size_t txtlen)
+bool js_exec(jscontext *ctx, const char *txt, size_t txtlen, const char *name)
{
return true;
}