diff options
author | Vincent Sanders <vince@kyllikki.org> | 2018-09-26 17:14:25 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2018-09-26 17:21:48 +0100 |
commit | 5c96acd6f119b71fc75e5d48465afca9fd13e87f (patch) | |
tree | ebe6b2b07b6767f1c892a35ba99295b4cd17ec59 /content/handlers/html/html_interaction.c | |
parent | 9100fcb4095cf8858d4cd2c613bff69ceb4f71ec (diff) | |
download | netsurf-5c96acd6f119b71fc75e5d48465afca9fd13e87f.tar.gz netsurf-5c96acd6f119b71fc75e5d48465afca9fd13e87f.tar.bz2 |
fix url encoding to be compatible with nsurl API changes.
As part of this fix the form submission error handling and
reporting has been improved.
Diffstat (limited to 'content/handlers/html/html_interaction.c')
-rw-r--r-- | content/handlers/html/html_interaction.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/content/handlers/html/html_interaction.c b/content/handlers/html/html_interaction.c index 648d27467..04d14aa81 100644 --- a/content/handlers/html/html_interaction.c +++ b/content/handlers/html/html_interaction.c @@ -389,6 +389,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw, BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2 | BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2); + nserror res; + if (drag_type != DRAGGING_NONE && !mouse && html->visible_select_menu != NULL) { /* drag end: select menu */ @@ -875,9 +877,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } } else if (url) { if (nsoption_bool(display_decoded_idn) == true) { - if (nsurl_get_utf8(url, &url_s, &url_l) != NSERROR_OK) { - /* Unable to obtain a decoded IDN. This is not a fatal error. - * Ensure the string pointer is NULL so we use the encoded version. */ + res = nsurl_get_utf8(url, &url_s, &url_l); + if (res != NSERROR_OK) { + /* Unable to obtain a decoded IDN. This is not + * a fatal error. Ensure the string pointer + * is NULL so we use the encoded version. + */ url_s = NULL; } } @@ -1072,22 +1077,32 @@ void html_mouse_action(struct content *c, struct browser_window *bw, */ switch (action) { case ACTION_SUBMIT: - form_submit(content_get_url(c), - browser_window_find_target(bw, target, mouse), - gadget->form, gadget); + res = form_submit(content_get_url(c), + browser_window_find_target(bw, target, mouse), + gadget->form, + gadget); break; + case ACTION_GO: - browser_window_navigate(browser_window_find_target(bw, target, mouse), - url, - content_get_url(c), - BW_NAVIGATE_HISTORY, - NULL, - NULL, - NULL); + res = browser_window_navigate( + browser_window_find_target(bw, target, mouse), + url, + content_get_url(c), + BW_NAVIGATE_HISTORY, + NULL, + NULL, + NULL); break; + case ACTION_NONE: + res = NSERROR_OK; break; } + + if (res != NSERROR_OK) { + guit->misc->warning(messages_get_errorcode(res), NULL); + } + } |