Skip to content

Commit

Permalink
fix linux webkit2gtk deprecated error (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzqs committed May 23, 2023
1 parent 3af6636 commit 0eeeb80
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/desktop_webview_window/linux/webview_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,17 @@ gboolean WebviewWindow::DecidePolicy(WebKitPolicyDecision *decision, WebKitPolic
}

void WebviewWindow::EvaluateJavaScript(const char *java_script, FlMethodCall *call) {
webkit_web_view_run_javascript(
WEBKIT_WEB_VIEW(webview_), java_script, nullptr,
webkit_web_view_evaluate_javascript(
WEBKIT_WEB_VIEW(webview_), java_script,-1,nullptr,nullptr, nullptr,
[](GObject *object, GAsyncResult *result, gpointer user_data) {
auto *call = static_cast<FlMethodCall *>(user_data);
GError *error = nullptr;
auto *js_result = webkit_web_view_run_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error);
auto *js_result = webkit_web_view_evaluate_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error);
if (!js_result) {
fl_method_call_respond_error(call, "failed to evaluate javascript.", error->message, nullptr, nullptr);
g_error_free(error);
} else {
auto *js_value = jsc_value_to_json(webkit_javascript_result_get_js_value(js_result), 0);
auto *js_value = jsc_value_to_json(js_result, 0);
fl_method_call_respond_success(call, js_value ? fl_value_new_string(js_value) : nullptr, nullptr);
}
g_object_unref(call);
Expand Down

0 comments on commit 0eeeb80

Please sign in to comment.