changeset 2989:fed8a986d565

GTK3: Fix compiling with pre-2.22 WebKit2GTK. Missing exception variable, so just introduce a NULL one. Also the WebKitUserContentManager is NULL, causing it not to work. So make one during widget creation, allowing proper function. Might want to do this in the GTK4 code too just in case.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 04 Apr 2023 07:06:20 +0000
parents dfab2dfa9bc1
children 9220cbf90ed3
files gtk3/dw.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gtk3/dw.c	Tue Apr 04 01:08:14 2023 +0000
+++ b/gtk3/dw.c	Tue Apr 04 07:06:20 2023 +0000
@@ -1340,11 +1340,12 @@
 #else
     context = webkit_javascript_result_get_global_context(js_result);
     value = webkit_javascript_result_get_value(js_result);
-    if (JSValueIsString(context, value))
+    if(JSValueIsString(context, value))
     {
         JSStringRef js_str_value;
         gchar *str_value;
         gsize str_length;
+        void *exception = NULL;
 
         js_str_value = JSValueToStringCopy(context, value, NULL);
         str_length = JSStringGetMaximumUTF8CStringSize(js_str_value);
@@ -12057,12 +12058,18 @@
    WebKitWebView *web_view;
 #ifdef USE_WEBKIT2
    WebKitSettings *settings;
+   WebKitUserContentManager *manager;
 #else
    WebKitWebSettings *settings;
 #endif
 
    DW_MUTEX_LOCK;
+#ifdef USE_WEBKIT2
+   manager = webkit_user_content_manager_new();
+   web_view = (WebKitWebView *)webkit_web_view_new_with_user_content_manager(manager);
+#else
    web_view = (WebKitWebView *)webkit_web_view_new();
+#endif
    /* WebKit2 no longer requires a scrolled window...
     * So only create a scrolled window and pack it in older versions.
     */