mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
[quickjs] JS_DupValue in some places.
This commit is contained in:
parent
1dad777d14
commit
4d79093742
@ -116,7 +116,7 @@ quickjs_done(struct module *xxx)
|
|||||||
attr_delete_map_rev(map_rev_forms);
|
attr_delete_map_rev(map_rev_forms);
|
||||||
attr_delete_map(map_inputs);
|
attr_delete_map(map_inputs);
|
||||||
attr_delete_map(map_nodelist);
|
attr_delete_map(map_nodelist);
|
||||||
attr_delete_map_rev(map_rev_nodelist);
|
// attr_delete_map_rev(map_rev_nodelist);
|
||||||
|
|
||||||
attr_delete_map(map_form_elements);
|
attr_delete_map(map_form_elements);
|
||||||
attr_delete_map_rev(map_form_elements_rev);
|
attr_delete_map_rev(map_form_elements_rev);
|
||||||
|
@ -1778,14 +1778,16 @@ getDocument(JSContext *ctx, void *doc)
|
|||||||
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
|
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
|
||||||
doc_private->interpreter = interpreter;
|
doc_private->interpreter = interpreter;
|
||||||
static int initialized;
|
static int initialized;
|
||||||
|
|
||||||
|
JSValue global_obj = JS_GetGlobalObject(ctx);
|
||||||
|
|
||||||
/* create the element class */
|
/* create the element class */
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
JS_NewClassID(&js_document_class_id);
|
JS_NewClassID(&js_document_class_id);
|
||||||
JS_NewClass(JS_GetRuntime(ctx), js_document_class_id, &js_document_class);
|
JS_NewClass(JS_GetRuntime(ctx), js_document_class_id, &js_document_class);
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
JSValue global_obj = JS_GetGlobalObject(ctx);
|
//REF_JS(global_obj);
|
||||||
REF_JS(global_obj);
|
|
||||||
|
|
||||||
JSValue document_obj = JS_NewObjectClass(ctx, js_document_class_id);
|
JSValue document_obj = JS_NewObjectClass(ctx, js_document_class_id);
|
||||||
JS_SetPropertyFunctionList(ctx, document_obj, js_document_proto_funcs, countof(js_document_proto_funcs));
|
JS_SetPropertyFunctionList(ctx, document_obj, js_document_proto_funcs, countof(js_document_proto_funcs));
|
||||||
@ -1794,12 +1796,8 @@ getDocument(JSContext *ctx, void *doc)
|
|||||||
JS_SetOpaque(document_obj, doc_private);
|
JS_SetOpaque(document_obj, doc_private);
|
||||||
// JS_SetClassProto(ctx, js_document_class_id, document_obj);
|
// JS_SetClassProto(ctx, js_document_class_id, document_obj);
|
||||||
JS_SetPropertyStr(ctx, global_obj, "document", document_obj);
|
JS_SetPropertyStr(ctx, global_obj, "document", document_obj);
|
||||||
|
|
||||||
JSValue rr = JS_DupValue(ctx, document_obj);
|
|
||||||
doc_private->thisval = rr;
|
|
||||||
JS_FreeValue(ctx, rr);
|
|
||||||
|
|
||||||
JS_FreeValue(ctx, global_obj);
|
JS_FreeValue(ctx, global_obj);
|
||||||
|
doc_private->thisval = document_obj;
|
||||||
|
|
||||||
RETURN_JS(rr);
|
RETURN_JS(document_obj);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,9 @@ js_implementation_createHTMLDocument(JSContext *ctx, JSValueConst this_val, int
|
|||||||
done_string(&str);
|
done_string(&str);
|
||||||
JS_FreeCString(ctx, title);
|
JS_FreeCString(ctx, title);
|
||||||
|
|
||||||
return getDocument(ctx, docu);
|
JSValue rr = JS_DupValue(ctx, getDocument(ctx, docu));
|
||||||
|
|
||||||
|
RETURN_JS(rr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSValue
|
static JSValue
|
||||||
@ -152,5 +154,7 @@ getImplementation(JSContext *ctx)
|
|||||||
// JS_SetConstructor(ctx, implementation_class, implementation_obj);
|
// JS_SetConstructor(ctx, implementation_class, implementation_obj);
|
||||||
JS_SetClassProto(ctx, js_implementation_class_id, implementation_obj);
|
JS_SetClassProto(ctx, js_implementation_class_id, implementation_obj);
|
||||||
|
|
||||||
RETURN_JS(implementation_obj);
|
JSValue rr = JS_DupValue(ctx, implementation_obj);
|
||||||
|
|
||||||
|
RETURN_JS(rr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user