mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Neither SEE nor SpiderMonkey tolerate return outside functions
This commit is contained in:
parent
b4d9b7f5a6
commit
1dae2926fd
@ -865,22 +865,18 @@ try_submit_given_form(struct session *ses, struct document_view *doc_view,
|
|||||||
if (init_string(&code)) {
|
if (init_string(&code)) {
|
||||||
struct view_state *vs = doc_view->vs;
|
struct view_state *vs = doc_view->vs;
|
||||||
struct ecmascript_interpreter *interpreter;
|
struct ecmascript_interpreter *interpreter;
|
||||||
int res = 1;
|
unsigned char *ret = form->onsubmit;
|
||||||
|
int res;
|
||||||
|
|
||||||
if (vs->ecmascript_fragile)
|
if (vs->ecmascript_fragile)
|
||||||
ecmascript_reset_state(vs);
|
ecmascript_reset_state(vs);
|
||||||
interpreter = vs->ecmascript;
|
interpreter = vs->ecmascript;
|
||||||
assert(interpreter);
|
assert(interpreter);
|
||||||
#ifdef CONFIG_ECMASCRIPT_SEE
|
/* SEE and SpiderMonkey do not like return outside
|
||||||
{
|
* functions. */
|
||||||
unsigned char *ret = form->onsubmit;
|
while ((ret = strstr(ret, "return "))) {
|
||||||
|
while (*ret != ' ') *ret++ = ' ';
|
||||||
/* SEE doesn't like return outside functions */
|
|
||||||
while ((ret = strstr(ret, "return "))) {
|
|
||||||
while (*ret != ' ') *ret++ = ' ';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
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…
Reference in New Issue
Block a user