I haven't compiled ELinks with CONFIG_ECMASCRIPT yet, but the code
that calls the onsubmit script seems to be in the wrong place.
It is now (commit 6fe1a431f1ce4614c31eb4fcfe9d088c7a2c42f6)
in call_onsubmit_and_submit() in src/viewer/text/link.c.
goto_current_link() calls that if link_is_form(link) returns true.
Then, call_onsubmit_and_submit() executes the onsubmit script if
any, and calls get_form_uri() in src/viewer/text/form.c.  It in
turn checks whether fc->type is FC_RESET or something else.  So,
it looks like the onsubmit script is being run even for FC_RESET.

I suppose the onsubmit code should be called from get_form_uri(),
after it has checked that fc->type == FC_SUBMIT.  And then, a
"side_effects_ok" parameter should be added in get_form_uri()
and get_link_uri(), so that calls from e.g. pass_uri_to_command()
or copy_current_link_to_clipboard() won't run any scripts or
reset the form.

Attachment: pgpsETwN0DRDA.pgp
Description: PGP signature

_______________________________________________
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to