summaryrefslogtreecommitdiff
path: root/content/handlers/html/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'content/handlers/html/html.c')
-rw-r--r--content/handlers/html/html.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index c66d2aca1..e47ee7f4f 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -77,6 +77,28 @@ static const char *html_types[] = {
"text/html"
};
+/**
+ * Fire an event at the DOM
+ *
+ * Helper that swallows DOM errors.
+ *
+ * \param[in] event the event to fire at the DOM
+ * \param[in] target the event target
+ * \return true on success
+ */
+static bool fire_dom_event(dom_event *event, dom_node *target)
+{
+ dom_exception exc;
+ bool result;
+
+ exc = dom_event_target_dispatch_event(target, event, &result);
+ if (exc != DOM_NO_ERR) {
+ return false;
+ }
+
+ return result;
+}
+
/* Exported interface, see html_internal.h */
bool fire_generic_dom_event(dom_string *type, dom_node *target,
bool bubbles, bool cancelable)
@@ -94,10 +116,7 @@ bool fire_generic_dom_event(dom_string *type, dom_node *target,
}
NSLOG(netsurf, INFO, "Dispatching '%*s' against %p",
dom_string_length(type), dom_string_data(type), target);
- exc = dom_event_target_dispatch_event(target, evt, &result);
- if (exc != DOM_NO_ERR) {
- result = false;
- }
+ result = fire_dom_event(evt, target);
dom_event_unref(evt);
return result;
}