mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[ecmascript] fix form_view issue
This commit is contained in:
parent
e4b0131e62
commit
5698608b5a
@ -549,8 +549,21 @@ js_form_get_property_elements(JSContext *ctx, JSValueConst this_val)
|
||||
#endif
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextOpaque(ctx);
|
||||
struct view_state *vs = interpreter->vs;
|
||||
struct form_view *fv = vs->forms.next;
|
||||
if (!fv) {
|
||||
|
||||
struct form *form = form_GetOpaque(this_val);
|
||||
assert(form);
|
||||
|
||||
struct form_view *fv = nullptr;
|
||||
bool found = false;
|
||||
|
||||
foreach (fv, vs->forms) {
|
||||
if (form->form_num == fv->form_num) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found || !fv) {
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
|
@ -994,12 +994,30 @@ form_get_property_elements(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
return false;
|
||||
}
|
||||
|
||||
struct form_view *fv = vs->forms.next;
|
||||
if (!fv) {
|
||||
struct form *form = JS_GetInstancePrivate(ctx, hobj, &form_class, nullptr);
|
||||
|
||||
if (!form) {
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
return false; /* detached */
|
||||
return false;
|
||||
}
|
||||
|
||||
struct form_view *fv = nullptr;
|
||||
bool found = false;
|
||||
|
||||
foreach (fv, vs->forms) {
|
||||
if (fv->form_num == form->form_num) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found || !fv) {
|
||||
#ifdef ECMASCRIPT_DEBUG
|
||||
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/* jsform ('form') is form_elements' parent; who knows is that's correct */
|
||||
|
Loading…
x
Reference in New Issue
Block a user