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

[spidermonkey] handle second argument for Event constructor

This commit is contained in:
Witold Filipczyk 2024-03-10 18:43:32 +01:00
parent 0d28694b45
commit 48c5e80b31

View File

@ -138,6 +138,21 @@ event_constructor(JSContext* ctx, unsigned argc, JS::Value* vp)
event->type_ = jsval_to_string(ctx, args[0]);
}
if (argc > 1) {
JS::RootedValue v(ctx);
JS::RootedObject v_obj(ctx, &args[1].toObject());
if (JS_GetProperty(ctx, v_obj, "bubbles", &v)) {
event->bubbles = (unsigned int)v.toBoolean();
}
if (JS_GetProperty(ctx, v_obj, "cancelable", &v)) {
event->cancelable = (unsigned int)v.toBoolean();
}
if (JS_GetProperty(ctx, v_obj, "composed", &v)) {
event->composed = (unsigned int)v.toBoolean();
}
}
args.rval().setObject(*newObj);
return true;