0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

Make SpiderMonkey consistent with SEE. Do not cache ecmascript_objs

[ Backported from commit b4d9b7f5a60a64a26fcfffcb66a376cae5b31bc1 in
  ELinks 0.12.GIT, to fix bug 956.  --KON ]
This commit is contained in:
witekfl 2006-01-30 11:15:04 +01:00 committed by Kalle Olavi Niemitalo
parent 19831ea185
commit 3faeda97cb

View File

@ -481,17 +481,19 @@ input_select(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval
static JSObject * static JSObject *
get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs) get_input_object(JSContext *ctx, JSObject *jsform, struct form_state *fs)
{ {
if (!fs->ecmascript_obj) { #if 0
/* jsform ('form') is input's parent */ if (fs->ecmascript_obj)
/* FIXME: That is NOT correct since the real containing element return fs->ecmascript_obj;
* should be its parent, but gimme DOM first. --pasky */ #endif
JSObject *jsinput = JS_NewObject(ctx, (JSClass *) &input_class, NULL, jsform); /* jsform ('form') is input's parent */
/* FIXME: That is NOT correct since the real containing element
* should be its parent, but gimme DOM first. --pasky */
JSObject *jsinput = JS_NewObject(ctx, (JSClass *) &input_class, NULL, jsform);
JS_DefineProperties(ctx, jsinput, (JSPropertySpec *) input_props); JS_DefineProperties(ctx, jsinput, (JSPropertySpec *) input_props);
JS_DefineFunctions(ctx, jsinput, (JSFunctionSpec *) input_funcs); JS_DefineFunctions(ctx, jsinput, (JSFunctionSpec *) input_funcs);
JS_SetPrivate(ctx, jsinput, fs); /* to @input_class */ JS_SetPrivate(ctx, jsinput, fs); /* to @input_class */
fs->ecmascript_obj = jsinput; fs->ecmascript_obj = jsinput;
}
return fs->ecmascript_obj; return fs->ecmascript_obj;
} }
@ -1044,17 +1046,19 @@ form_submit(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
JSObject * JSObject *
get_form_object(JSContext *ctx, JSObject *jsdoc, struct form_view *fv) get_form_object(JSContext *ctx, JSObject *jsdoc, struct form_view *fv)
{ {
if (!fv->ecmascript_obj) { #if 0
/* jsdoc ('document') is fv's parent */ if (fv->ecmascript_obj)
/* FIXME: That is NOT correct since the real containing element return fv->ecmascript_obj;
* should be its parent, but gimme DOM first. --pasky */ #endif
JSObject *jsform = JS_NewObject(ctx, (JSClass *) &form_class, NULL, jsdoc); /* jsdoc ('document') is fv's parent */
/* FIXME: That is NOT correct since the real containing element
* should be its parent, but gimme DOM first. --pasky */
JSObject *jsform = JS_NewObject(ctx, (JSClass *) &form_class, NULL, jsdoc);
JS_DefineProperties(ctx, jsform, (JSPropertySpec *) form_props); JS_DefineProperties(ctx, jsform, (JSPropertySpec *) form_props);
JS_DefineFunctions(ctx, jsform, (JSFunctionSpec *) form_funcs); JS_DefineFunctions(ctx, jsform, (JSFunctionSpec *) form_funcs);
JS_SetPrivate(ctx, jsform, fv); /* to @form_class */ JS_SetPrivate(ctx, jsform, fv); /* to @form_class */
fv->ecmascript_obj = jsform; fv->ecmascript_obj = jsform;
}
return fv->ecmascript_obj; return fv->ecmascript_obj;
} }
static JSBool forms_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp); static JSBool forms_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp);