1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[spidermonkey] casts

This commit is contained in:
Witold Filipczyk 2022-02-25 20:38:38 +01:00
parent 70a0ccb9cb
commit 8336e242a1
3 changed files with 13 additions and 18 deletions

View File

@ -91,7 +91,7 @@ spidermonkey_DefineFunctions(JSContext *cx, JSObject *obj,
* @relates spidermonkeyFunctionSpec */ * @relates spidermonkeyFunctionSpec */
JSObject * JSObject *
spidermonkey_InitClass(JSContext *cx, JSObject *obj, spidermonkey_InitClass(JSContext *cx, JSObject *obj,
JSObject *parent_proto, JSClass *clasp, JSObject *parent_proto, const JSClass *clasp,
JSNative constructor, unsigned int nargs, JSNative constructor, unsigned int nargs,
JSPropertySpec *ps, JSPropertySpec *ps,
const spidermonkeyFunctionSpec *fs, const spidermonkeyFunctionSpec *fs,

View File

@ -30,7 +30,7 @@ typedef struct spidermonkeyFunctionSpec {
bool spidermonkey_DefineFunctions(JSContext *cx, JSObject *obj, bool spidermonkey_DefineFunctions(JSContext *cx, JSObject *obj,
const spidermonkeyFunctionSpec *fs); const spidermonkeyFunctionSpec *fs);
JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj, JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj,
JSObject *parent_proto, JSClass *clasp, JSObject *parent_proto, const JSClass *clasp,
JSNative constructor, unsigned int nargs, JSNative constructor, unsigned int nargs,
JSPropertySpec *ps, JSPropertySpec *ps,
const spidermonkeyFunctionSpec *fs, const spidermonkeyFunctionSpec *fs,

View File

@ -80,7 +80,7 @@ error_reporter(JSContext *ctx, JSErrorReport *report)
if (!comp) { if (!comp) {
return; return;
} }
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp); struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
struct session *ses = interpreter->vs->doc_view->session; struct session *ses = interpreter->vs->doc_view->session;
struct terminal *term; struct terminal *term;
struct string msg; struct string msg;
@ -143,8 +143,6 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
JSObject *console_obj, *document_obj, /* *forms_obj,*/ *history_obj, *location_obj, JSObject *console_obj, *document_obj, /* *forms_obj,*/ *history_obj, *location_obj,
*statusbar_obj, *menubar_obj, *navigator_obj, *localstorage_obj, *screen_obj; *statusbar_obj, *menubar_obj, *navigator_obj, *localstorage_obj, *screen_obj;
static int initialized = 0;
assert(interpreter); assert(interpreter);
if (!js_module_init_ok) return NULL; if (!js_module_init_ok) return NULL;
@ -244,7 +242,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
if (!menubar_obj) { if (!menubar_obj) {
goto release_and_fail; goto release_and_fail;
} }
JS_SetPrivate(menubar_obj, "t"); /* to @menubar_class */ JS_SetPrivate(menubar_obj, (char *)"t"); /* to @menubar_class */
statusbar_obj = JS_InitClass(ctx, window_obj, nullptr, statusbar_obj = JS_InitClass(ctx, window_obj, nullptr,
&statusbar_class, NULL, 0, &statusbar_class, NULL, 0,
@ -253,7 +251,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
if (!statusbar_obj) { if (!statusbar_obj) {
goto release_and_fail; goto release_and_fail;
} }
JS_SetPrivate(statusbar_obj, "s"); /* to @statusbar_class */ JS_SetPrivate(statusbar_obj, (char *)"s"); /* to @statusbar_class */
navigator_obj = JS_InitClass(ctx, window_obj, nullptr, navigator_obj = JS_InitClass(ctx, window_obj, nullptr,
&navigator_class, NULL, 0, &navigator_class, NULL, 0,
@ -293,12 +291,9 @@ release_and_fail:
void void
spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter) spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter)
{ {
JSContext *ctx;
assert(interpreter); assert(interpreter);
if (!js_module_init_ok) return; if (!js_module_init_ok) return;
ctx = interpreter->backend_data;
if (interpreter->ac2) { if (interpreter->ac2) {
delete (JSAutoRealm *)interpreter->ac2; delete (JSAutoRealm *)interpreter->ac2;
} }
@ -353,8 +348,8 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter,
if (!js_module_init_ok) { if (!js_module_init_ok) {
return; return;
} }
ctx = interpreter->backend_data; ctx = (JSContext *)interpreter->backend_data;
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac); JS::Realm *comp = JS::EnterRealm(ctx, (JSObject *)interpreter->ac);
interpreter->heartbeat = add_heartbeat(interpreter); interpreter->heartbeat = add_heartbeat(interpreter);
interpreter->ret = ret; interpreter->ret = ret;
@ -386,8 +381,8 @@ spidermonkey_call_function(struct ecmascript_interpreter *interpreter,
if (!js_module_init_ok) { if (!js_module_init_ok) {
return; return;
} }
ctx = interpreter->backend_data; ctx = (JSContext *)interpreter->backend_data;
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac); JS::Realm *comp = JS::EnterRealm(ctx, (JSObject *)interpreter->ac);
interpreter->heartbeat = add_heartbeat(interpreter); interpreter->heartbeat = add_heartbeat(interpreter);
interpreter->ret = ret; interpreter->ret = ret;
@ -411,11 +406,11 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
assert(interpreter); assert(interpreter);
if (!js_module_init_ok) return NULL; if (!js_module_init_ok) return NULL;
ctx = interpreter->backend_data; ctx = (JSContext *)interpreter->backend_data;
interpreter->ret = NULL; interpreter->ret = NULL;
interpreter->heartbeat = add_heartbeat(interpreter); interpreter->heartbeat = add_heartbeat(interpreter);
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac); JS::Realm *comp = JS::EnterRealm(ctx, (JSObject *)interpreter->ac);
JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx)); JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx));
JS::RootedValue r_rval(ctx, rval); JS::RootedValue r_rval(ctx, rval);
@ -458,10 +453,10 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
assert(interpreter); assert(interpreter);
if (!js_module_init_ok) return 0; if (!js_module_init_ok) return 0;
ctx = interpreter->backend_data; ctx = (JSContext *)interpreter->backend_data;
interpreter->ret = NULL; interpreter->ret = NULL;
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac); JS::Realm *comp = JS::EnterRealm(ctx, (JSObject *)interpreter->ac);
JS::CompileOptions options(ctx); JS::CompileOptions options(ctx);
JS::RootedObjectVector ag(ctx); JS::RootedObjectVector ag(ctx);