commit: 85fbb9c3ed2364bce83e6860192969f6d359ef27
parent: c56301974701162b8159fc0f04a90c364404da5d
author: Chris Noxz <chris@noxz.tech>
date: Tue, 4 Apr 2023 11:34:19 +0200
update code to work with webkit2gtk v2.40.0 release
Some functions used in the adji source code have been deprecated since this
release, requiring rework. Specifically, the following functions are now
deprecated:
* webkit_web_view_run_javascript
* webkit_web_view_run_javascript_finish
* webkit_web_context_set_process_model
This commit updates the codebase to use the new, non-deprecated functions.
Additionally, the webkit_web_context_set_process_model function is no longer
needed at all in this release, as the only allowed process model is
WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES.
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/browser.c b/browser.c
@@ -932,7 +932,9 @@ run_user_scripts(WebKitWebView *web_view)
while ((e = g_dir_read_name(s)) != NULL) {
if (g_str_has_suffix((p = g_build_filename(b, e, NULL)), ".js")
&& g_file_get_contents(p, &c, NULL, NULL)) {
- webkit_web_view_run_javascript(web_view, c, NULL, NULL, NULL);
+ webkit_web_view_evaluate_javascript(
+ web_view, c, -1, NULL, NULL, NULL, NULL, NULL
+ );
g_free(c);
}
g_free(p);
@@ -1031,9 +1033,12 @@ search(struct Client *c,
void
selection_search(struct Client *c)
{
- webkit_web_view_run_javascript(
+ webkit_web_view_evaluate_javascript(
WEBKIT_WEB_VIEW(c->wv),
"encodeURIComponent(window.getSelection().toString());",
+ -1,
+ NULL,
+ NULL,
NULL,
cb_selection_search_finished,
c
@@ -1044,25 +1049,21 @@ void
selection_search_finished(struct Client *c,
GAsyncResult *result)
{
- WebKitJavascriptResult *r;
JSCValue *v = NULL;
- gchar *s,
- *u;
+ gchar *s = NULL,
+ *u = NULL;
- if ((r = webkit_web_view_run_javascript_finish(
+ if ((v = webkit_web_view_evaluate_javascript_finish(
WEBKIT_WEB_VIEW(c->wv), result, NULL
)) == NULL)
return;
- v = webkit_javascript_result_get_js_value(r);
-
if (jsc_value_is_string(v)
&& strlen(s = jsc_value_to_string(v))
&& !jsc_context_get_exception(jsc_value_get_context(v))
&& (u = resolve_uri(s)) != NULL)
client_create(u, NULL, TRUE, FALSE);
- webkit_javascript_result_unref(r);
g_free(u);
g_free(s);
}
@@ -1078,9 +1079,6 @@ set_default_web_context(void)
return;
c = webkit_web_context_get_default();
- webkit_web_context_set_process_model(
- c, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES
- );
p = g_build_filename(g_get_user_config_dir(), __NAME__, CFG_S(WeDir), NULL);
#if GTK_CHECK_VERSION(3, 98, 0) /* seems to be fixed in 3.98.0, we'll see */