diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2012-11-28 22:08:11 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2012-11-28 22:08:11 +0000 |
commit | 71577f214da0e53b845b0c0a41496b0f1d0eead5 (patch) | |
tree | bfac84eb0d7caea0346c4d01bf7638d667a43858 /javascript/jsapi/window.bnd | |
parent | 4fbeacf830b1351646a375169aea05f264425c9b (diff) | |
download | netsurf-71577f214da0e53b845b0c0a41496b0f1d0eead5.tar.gz netsurf-71577f214da0e53b845b0c0a41496b0f1d0eead5.tar.bz2 |
use macro to compare
Diffstat (limited to 'javascript/jsapi/window.bnd')
-rw-r--r-- | javascript/jsapi/window.bnd | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/javascript/jsapi/window.bnd b/javascript/jsapi/window.bnd index 610aa71ab..7ad54dbac 100644 --- a/javascript/jsapi/window.bnd +++ b/javascript/jsapi/window.bnd @@ -225,37 +225,33 @@ operation dispatchEvent %{ */ /* 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; } else { - 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; - } 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)) { - JS_GetProperty(cx, JSAPI_THIS_OBJECT(cx, vp), "onload", &eventval); - } - - if (eventval != JSVAL_VOID) { - event_argv[0] = eventval; - jsret = JS_CallFunctionValue(cx, NULL, eventval, 1, event_argv, &event_rval); - } + exc = dom_event_get_type(event_private->event, &type_dom); + if (exc == DOM_NO_ERR) { + + if (dom_string_isequal(type_dom, corestring_dom_load)) { + JS_GetProperty(cx, JSAPI_THIS_OBJECT(cx, vp), "onload", &eventval); + } + + if (JSVAL_IS_VOID(eventval)) { + event_argv[0] = eventval; + jsret = JS_CallFunctionValue(cx, NULL, eventval, 1, event_argv, &event_rval); } } - } + } %} getter EventHandler %{ |