mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-04 11:51:55 +03:00
use macro to compare
This commit is contained in:
parent
4fbeacf830
commit
71577f214d
@ -225,37 +225,33 @@ operation dispatchEvent %{
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* caution, this must match the struct generated from event.bnd */
|
/* caution, this must match the struct generated from event.bnd */
|
||||||
if (event == JSVAL_VOID) {
|
struct {
|
||||||
|
dom_event *event;
|
||||||
|
} *event_private;
|
||||||
|
dom_string *type_dom = NULL;
|
||||||
|
dom_exception exc;
|
||||||
|
jsval eventval = JSVAL_VOID;
|
||||||
|
jsval event_argv[1];
|
||||||
|
jsval event_rval;
|
||||||
|
|
||||||
|
event_private = JS_GetInstancePrivate(cx, event, &JSClass_Event, NULL);
|
||||||
|
if (event_private->event == NULL) {
|
||||||
|
/** @todo type error? */
|
||||||
jsret = JS_FALSE;
|
jsret = JS_FALSE;
|
||||||
} else {
|
} else {
|
||||||
struct {
|
exc = dom_event_get_type(event_private->event, &type_dom);
|
||||||
dom_event *event;
|
if (exc == DOM_NO_ERR) {
|
||||||
} *event_private;
|
|
||||||
dom_string *type_dom = NULL;
|
|
||||||
dom_exception exc;
|
|
||||||
jsval eventval = JSVAL_VOID;
|
|
||||||
jsval event_argv[1];
|
|
||||||
jsval event_rval;
|
|
||||||
|
|
||||||
event_private = JS_GetInstancePrivate(cx, event, &JSClass_Event, NULL);
|
if (dom_string_isequal(type_dom, corestring_dom_load)) {
|
||||||
if (event_private->event == NULL) {
|
JS_GetProperty(cx, JSAPI_THIS_OBJECT(cx, vp), "onload", &eventval);
|
||||||
/** @todo type error? */
|
}
|
||||||
jsret = JS_FALSE;
|
|
||||||
} else {
|
|
||||||
exc = dom_event_get_type(event_private->event, &type_dom);
|
|
||||||
if (exc == DOM_NO_ERR) {
|
|
||||||
|
|
||||||
if (dom_string_isequal(type_dom, corestring_dom_load)) {
|
if (JSVAL_IS_VOID(eventval)) {
|
||||||
JS_GetProperty(cx, JSAPI_THIS_OBJECT(cx, vp), "onload", &eventval);
|
event_argv[0] = eventval;
|
||||||
}
|
jsret = JS_CallFunctionValue(cx, NULL, eventval, 1, event_argv, &event_rval);
|
||||||
|
|
||||||
if (eventval != JSVAL_VOID) {
|
|
||||||
event_argv[0] = eventval;
|
|
||||||
jsret = JS_CallFunctionValue(cx, NULL, eventval, 1, event_argv, &event_rval);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
getter EventHandler %{
|
getter EventHandler %{
|
||||||
|
Loading…
Reference in New Issue
Block a user