From f3861431f8a78e8b2dc9ad6cfac7371573c98ea6 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 12 Jan 2024 12:31:18 +0900 Subject: [PATCH] [webview_flutter] Add ewk_set_version_policy() call If EWK, the web engine of webview flutter, has an upgrade as a UWE feature, `ewk_set_version_policy(1)` must be called before set arguments. + Add missing ewk_shutdown(). --- .../tizen/src/ewk_internal_api_binding.cc | 10 +++++++--- .../tizen/src/ewk_internal_api_binding.h | 2 ++ packages/webview_flutter/tizen/src/webview.cc | 4 ++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/tizen/src/ewk_internal_api_binding.cc b/packages/webview_flutter/tizen/src/ewk_internal_api_binding.cc index e09a5692d..4ac4a78ce 100644 --- a/packages/webview_flutter/tizen/src/ewk_internal_api_binding.cc +++ b/packages/webview_flutter/tizen/src/ewk_internal_api_binding.cc @@ -42,6 +42,9 @@ bool EwkInternalApiBinding::Initialize() { main.SetArguments = reinterpret_cast( dlsym(handle_, "ewk_set_arguments")); + main.SetVersionPolicy = reinterpret_cast( + dlsym(handle_, "ewk_set_version_policy")); + // ewk_settings settings.ImePanelEnabledSet = reinterpret_cast( @@ -60,7 +63,8 @@ bool EwkInternalApiBinding::Initialize() { return view.SetBackgroundColor && view.FeedTouchEvent && view.SendKeyEvent && view.OffscreenRenderingEnabledSet && view.ImeWindowSet && view.KeyEventsEnabledSet && view.SupportVideoHoleSet && - main.SetArguments && settings.ImePanelEnabledSet && - console_message.LevelGet && console_message.TextGet && - console_message.LineGet && console_message.SourceGet; + main.SetArguments && main.SetVersionPolicy && + settings.ImePanelEnabledSet && console_message.LevelGet && + console_message.TextGet && console_message.LineGet && + console_message.SourceGet; } diff --git a/packages/webview_flutter/tizen/src/ewk_internal_api_binding.h b/packages/webview_flutter/tizen/src/ewk_internal_api_binding.h index c259a9a0a..d3c82f5c9 100644 --- a/packages/webview_flutter/tizen/src/ewk_internal_api_binding.h +++ b/packages/webview_flutter/tizen/src/ewk_internal_api_binding.h @@ -53,9 +53,11 @@ typedef struct { } EwkViewProcTable; typedef void (*EwkSetArgumentsFnPtr)(int argc, char** argv); +typedef void (*EwkSetVersionPolicyFnPtr)(int preference); typedef struct { EwkSetArgumentsFnPtr SetArguments = nullptr; + EwkSetVersionPolicyFnPtr SetVersionPolicy = nullptr; } EwkMainProcTable; typedef struct Ewk_Settings Ewk_Settings; diff --git a/packages/webview_flutter/tizen/src/webview.cc b/packages/webview_flutter/tizen/src/webview.cc index 8fe79c97b..0de9a36c6 100644 --- a/packages/webview_flutter/tizen/src/webview.cc +++ b/packages/webview_flutter/tizen/src/webview.cc @@ -196,6 +196,8 @@ void WebView::Dispose() { &WebView::OnUrlChange); evas_object_del(webview_instance_); } + + ewk_shutdown(); } void WebView::Offset(double left, double top) { @@ -286,6 +288,8 @@ void WebView::SetDirection(int direction) { } void WebView::InitWebView() { + EwkInternalApiBinding::GetInstance().main.SetVersionPolicy(1); + char* chromium_argv[] = { const_cast("--disable-pinch"), const_cast("--js-flags=--expose-gc"),