mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[quickjs] Do not create location object every time
infinite2.html shows dialog box.
This commit is contained in:
parent
725231eb4f
commit
e155378c10
@ -379,7 +379,7 @@ ecmascript_put_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
free_list(interpreter->timeouts);
|
||||
#ifdef CONFIG_QUICKJS
|
||||
if (!JS_IsNull(interpreter->location_obj)) {
|
||||
//JS_FreeValue(t->ctx, interpreter->location_obj);
|
||||
JS_FreeValue((JSContext *)interpreter->backend_data, interpreter->location_obj);
|
||||
}
|
||||
if (!JS_IsNull(interpreter->document_obj)) {
|
||||
//JS_FreeValue(t->ctx, interpreter->document_obj);
|
||||
|
@ -360,6 +360,7 @@ quickjs_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
js_image_init(ctx);
|
||||
|
||||
interpreter->document_obj = getDocument(ctx, document->dom);
|
||||
interpreter->location_obj = getLocation(ctx);
|
||||
js_document_init(ctx);
|
||||
|
||||
JS_SetModuleLoaderFunc(interpreter->rt, NULL, el_js_module_loader, NULL);
|
||||
|
@ -638,7 +638,11 @@ js_document_get_property_location(JSContext *ctx, JSValueConst this_val)
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
REF_JS(this_val);
|
||||
JSValue ret = getLocation(ctx);
|
||||
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
|
||||
|
||||
JSValue ret = interpreter->location_obj;
|
||||
|
||||
JS_DupValue(ctx, ret);
|
||||
|
||||
RETURN_JS(ret);
|
||||
}
|
||||
|
@ -538,7 +538,11 @@ js_window_get_property_location(JSContext *ctx, JSValueConst this_val)
|
||||
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
|
||||
#endif
|
||||
REF_JS(this_val);
|
||||
JSValue ret = getLocation(ctx);
|
||||
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx);
|
||||
|
||||
JSValue ret = interpreter->location_obj;
|
||||
|
||||
JS_DupValue(ctx, ret);
|
||||
|
||||
RETURN_JS(ret);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user