mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[spidermonkey] element.addEventListener fixes
This commit is contained in:
parent
5c3ab7781d
commit
f7e3626a7d
@ -3873,7 +3873,18 @@ element_addEventListener(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
}
|
||||
char *method = jsval_to_string(ctx, args[0]);
|
||||
JS::RootedValue fun(ctx, args[1]);
|
||||
struct ele_listener *l;
|
||||
|
||||
foreach(l, el_private->listeners) {
|
||||
if (strcmp(l->typ, method)) {
|
||||
continue;
|
||||
}
|
||||
if (l->fun == fun) {
|
||||
mem_free(method);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
struct ele_listener *n = (struct ele_listener *)mem_calloc(1, sizeof(*n));
|
||||
|
||||
if (!n) {
|
||||
@ -5407,9 +5418,9 @@ element_event_handler(dom_event *event, void *pw)
|
||||
JSObject *obj_ev = getEvent(ctx, event);
|
||||
interpreter->heartbeat = add_heartbeat(interpreter);
|
||||
|
||||
struct ele_listener *l;
|
||||
struct ele_listener *l, *next;
|
||||
|
||||
foreach(l, el_private->listeners) {
|
||||
foreachsafe(l, next, el_private->listeners) {
|
||||
if (strcmp(l->typ, dom_string_data(typ))) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user