mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
current_link_evhook: return effaced
This commit is contained in:
parent
1dae2926fd
commit
fa93d05b7e
@ -63,13 +63,19 @@ current_link_evhook(struct document_view *doc_view, enum script_event_hook_type
|
|||||||
if (!doc_view->vs->ecmascript) return -1;
|
if (!doc_view->vs->ecmascript) return -1;
|
||||||
|
|
||||||
foreach (evhook, *link->event_hooks) {
|
foreach (evhook, *link->event_hooks) {
|
||||||
struct string src = INIT_STRING(evhook->src, strlen(evhook->src));
|
unsigned char *ret;
|
||||||
|
|
||||||
if (evhook->type != type) continue;
|
if (evhook->type != type) continue;
|
||||||
|
ret = evhook->src;
|
||||||
|
while ((ret = strstr(ret, "return ")))
|
||||||
|
while (*ret != ' ') *ret++ = ' ';
|
||||||
|
{
|
||||||
|
struct string src = INIT_STRING(evhook->src, strlen(evhook->src));
|
||||||
/* TODO: Some even handlers return a bool. */
|
/* TODO: Some even handlers return a bool. */
|
||||||
if (!ecmascript_eval_boolback(doc_view->vs->ecmascript, &src))
|
if (!ecmascript_eval_boolback(doc_view->vs->ecmascript, &src))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
@ -874,9 +880,9 @@ try_submit_given_form(struct session *ses, struct document_view *doc_view,
|
|||||||
assert(interpreter);
|
assert(interpreter);
|
||||||
/* SEE and SpiderMonkey do not like return outside
|
/* SEE and SpiderMonkey do not like return outside
|
||||||
* functions. */
|
* functions. */
|
||||||
while ((ret = strstr(ret, "return "))) {
|
while ((ret = strstr(ret, "return ")))
|
||||||
while (*ret != ' ') *ret++ = ' ';
|
while (*ret != ' ') *ret++ = ' ';
|
||||||
}
|
|
||||||
add_to_string(&code, form->onsubmit);
|
add_to_string(&code, form->onsubmit);
|
||||||
res = ecmascript_eval_boolback(interpreter, &code);
|
res = ecmascript_eval_boolback(interpreter, &code);
|
||||||
done_string(&code);
|
done_string(&code);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user