Mercurial > dwindows
changeset 2010:617a78dc70aa
Added a number of possible javascript snippets to test.
Pass NULL in the result field of the html result callback in the case of a
non-string javascript result, instead of a generic error message.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 07 Nov 2019 02:07:49 +0000 |
parents | 8577d533b371 |
children | 2dfce1ced00f |
files | dwtest.c gtk3/dw.c |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/dwtest.c Thu Nov 07 01:39:52 2019 +0000 +++ b/dwtest.c Thu Nov 07 02:07:49 2019 +0000 @@ -1738,7 +1738,8 @@ /* Handle web javascript result */ int DWSIGNAL web_html_result(HWND html, int status, char *result, void *user_data, void *script_data) { - dw_messagebox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION), result); + dw_messagebox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION), + result ? result : "Javascript result is not a string value"); return TRUE; } @@ -1845,7 +1846,10 @@ HWND htmlstatus; HWND hbox = dw_box_new(DW_HORZ, 0); HWND item; - HWND javascript = dw_entryfield_new("window.scrollTo(0,500);", 0); + HWND javascript = dw_combobox_new("", 0); + + dw_listbox_append(javascript, "window.scrollTo(0,500);"); + dw_listbox_append(javascript, "window.document.title;"); dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>");
--- a/gtk3/dw.c Thu Nov 07 01:39:52 2019 +0000 +++ b/gtk3/dw.c Thu Nov 07 02:07:49 2019 +0000 @@ -1247,7 +1247,7 @@ g_free (str_value); } else if(htmlresultfunc) - htmlresultfunc((HWND)object, DW_ERROR_UNKNOWN, "Unknown javascript error", user_data, script_data); + htmlresultfunc((HWND)object, DW_ERROR_UNKNOWN, NULL, user_data, script_data); webkit_javascript_result_unref (js_result); #endif }