mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[ecmascript] Added element_offset parameter to eval
This commit is contained in:
parent
0ff62b5ee8
commit
7a9ba1184d
@ -143,7 +143,7 @@ process_snippets(struct ecmascript_interpreter *interpreter,
|
||||
|
||||
if (*string->source != '^') {
|
||||
/* Evaluate <script>code</script> snippet */
|
||||
ecmascript_eval(interpreter, string, NULL);
|
||||
ecmascript_eval(interpreter, string, NULL, (*current)->element_offset);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ process_snippets(struct ecmascript_interpreter *interpreter,
|
||||
if (fragment) {
|
||||
struct string code = INIT_STRING(fragment->data, (int)fragment->length);
|
||||
|
||||
ecmascript_eval(interpreter, &code, NULL);
|
||||
ecmascript_eval(interpreter, &code, NULL, (*current)->element_offset);
|
||||
}
|
||||
}
|
||||
check_for_rerender(interpreter, "eval");
|
||||
|
@ -389,12 +389,13 @@ check_for_rerender(struct ecmascript_interpreter *interpreter, const char* text)
|
||||
|
||||
void
|
||||
ecmascript_eval(struct ecmascript_interpreter *interpreter,
|
||||
struct string *code, struct string *ret)
|
||||
struct string *code, struct string *ret, int element_offset)
|
||||
{
|
||||
if (!get_ecmascript_enable(interpreter))
|
||||
return;
|
||||
assert(interpreter);
|
||||
interpreter->backend_nesting++;
|
||||
interpreter->element_offset = element_offset;
|
||||
#ifdef CONFIG_MUJS
|
||||
mujs_eval(interpreter, code, ret);
|
||||
#elif defined(CONFIG_QUICKJS)
|
||||
@ -637,7 +638,7 @@ ecmascript_timeout_handler(void *val)
|
||||
interpreter->vs->ecmascript_fragile);
|
||||
t->tid = TIMER_ID_UNDEF;
|
||||
/* The expired timer ID has now been erased. */
|
||||
ecmascript_eval(interpreter, &t->code, NULL);
|
||||
ecmascript_eval(interpreter, &t->code, NULL, 0);
|
||||
|
||||
del_from_list(t);
|
||||
done_string(&t->code);
|
||||
|
@ -106,6 +106,7 @@ struct ecmascript_interpreter {
|
||||
const char *fun;
|
||||
#endif
|
||||
bool changed;
|
||||
int element_offset;
|
||||
};
|
||||
|
||||
struct ecmascript_timeout {
|
||||
@ -157,7 +158,7 @@ void ecmascript_moved_form_state(struct form_state *fs);
|
||||
|
||||
void ecmascript_reset_state(struct view_state *vs);
|
||||
|
||||
void ecmascript_eval(struct ecmascript_interpreter *interpreter, struct string *code, struct string *ret);
|
||||
void ecmascript_eval(struct ecmascript_interpreter *interpreter, struct string *code, struct string *ret, int element_offset);
|
||||
char *ecmascript_eval_stringback(struct ecmascript_interpreter *interpreter, struct string *code);
|
||||
/* Returns -1 if undefined. */
|
||||
int ecmascript_eval_boolback(struct ecmascript_interpreter *interpreter, struct string *code);
|
||||
|
Loading…
Reference in New Issue
Block a user