From d9011f157e2a1e9ec842c0ce07fc1f588c9946b0 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Fri, 24 Mar 2017 17:26:30 +0900 Subject: [PATCH 01/16] Explicitly specify that this supports M56 Change-Id: If8d7536bee39f176c8c2ba175a5b3688ef42a1e2 Signed-off-by: jaekuk, lee --- packaging/crosswalk-tizen.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index fb672f9..a948158 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -29,7 +29,7 @@ BuildRequires: pkgconfig(capi-appfw-package-manager) BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-ui-efl-util) -BuildRequires: pkgconfig(chromium-efl) +BuildRequires: pkgconfig(chromium-efl) >= 56.0.0, pkgconfig(chromium-efl) < 57.0.0 BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(deviced) BuildRequires: pkgconfig(dlog) -- 2.7.4 From dfb263d09a538f648e6200ea5e65c0612419fa34 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Mon, 3 Apr 2017 15:22:40 +0900 Subject: [PATCH 02/16] Bringup with updated chromium-efl(m56.0.2924) -------------------------------------------------------------------------------- This patch supports the working of WebApp and WebTCT with new updated chromium-efl(m56.0.2924). - Changed the codes related to including 'ewk_chromium.h' from 'EWebkit.h' - Changed the codes related to dependency of V8 in chromium-efl Bug: http://suprem.sec.samsung.net/jira/browse/RWASP-253 Change-Id: Iee178f03e9926b13d972c975b1e53a9fa20be576 Signed-off-by: Youngcheol Kang ------------------------------------------------------------------------------- Change-Id: I2f4ccb603b5b6e3fabebcef6eeae9f06106163bd Signed-off-by: jaekuk, lee --- extensions/renderer/xwalk_module_system.cc | 12 +++--- extensions/renderer/xwalk_module_system.h | 4 +- extensions/renderer/xwalk_v8tools_module.cc | 61 ++++++++++++++++------------- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/extensions/renderer/xwalk_module_system.cc b/extensions/renderer/xwalk_module_system.cc index b14f12c..2218188 100755 --- a/extensions/renderer/xwalk_module_system.cc +++ b/extensions/renderer/xwalk_module_system.cc @@ -255,7 +255,7 @@ bool XWalkModuleSystem::SetTrampolineAccessorForEntryPoint( params->Set(v8::Integer::New(isolate, 1), entry); // FIXME(cmarcelo): ensure that trampoline is readonly. - value.As()->SetAccessor( + value.As()->SetAccessor(context, v8::String::NewFromUtf8(isolate, basename.c_str()), TrampolineCallback, TrampolineSetterCallback, params); return true; @@ -294,7 +294,7 @@ bool XWalkModuleSystem::InstallTrampoline(v8::Handle context, return false; } - auto it = entry->entry_points.begin(); + std::vector::const_iterator it = entry->entry_points.begin(); for (; it != entry->entry_points.end(); ++it) { ret = SetTrampolineAccessorForEntryPoint(context, *it, entry_ptr); if (!ret) { @@ -326,7 +326,7 @@ void XWalkModuleSystem::Initialize() { MarkModulesWithTrampoline(); - auto it = extension_modules_.begin(); + ExtensionModules::iterator it = extension_modules_.begin(); for (; it != extension_modules_.end(); ++it) { if (it->use_trampoline && InstallTrampoline(context, &*it)) continue; @@ -367,6 +367,7 @@ void XWalkModuleSystem::DeleteExtensionModules() { void XWalkModuleSystem::LoadExtensionForTrampoline( v8::Isolate* isolate, v8::Local data) { + v8::HandleScope handle_scope(isolate); v8::Local params = data.As(); void* ptr = params->Get( v8::Integer::New(isolate, 0)).As()->Value(); @@ -391,7 +392,6 @@ void XWalkModuleSystem::LoadExtensionForTrampoline( isolate, module_system->require_native_template_); - XWalkExtensionModule* module = entry->module; module->LoadExtensionCode(module_system->GetV8Context(), require_native_template->GetFunction()); @@ -417,7 +417,7 @@ v8::Handle XWalkModuleSystem::RefetchHolder( // static void XWalkModuleSystem::TrampolineCallback( - v8::Local property, + v8::Local property, const v8::PropertyCallbackInfo& info) { XWalkModuleSystem::LoadExtensionForTrampoline(info.GetIsolate(), info.Data()); v8::Handle holder = RefetchHolder(info.GetIsolate(), info.Data()); @@ -429,7 +429,7 @@ void XWalkModuleSystem::TrampolineCallback( // static void XWalkModuleSystem::TrampolineSetterCallback( - v8::Local property, + v8::Local property, v8::Local value, const v8::PropertyCallbackInfo& info) { XWalkModuleSystem::LoadExtensionForTrampoline(info.GetIsolate(), info.Data()); diff --git a/extensions/renderer/xwalk_module_system.h b/extensions/renderer/xwalk_module_system.h index b70603a..e8bf6bf 100755 --- a/extensions/renderer/xwalk_module_system.h +++ b/extensions/renderer/xwalk_module_system.h @@ -77,10 +77,10 @@ class XWalkModuleSystem { ExtensionModuleEntry* entry); static void TrampolineCallback( - v8::Local property, + v8::Local property, const v8::PropertyCallbackInfo& info); static void TrampolineSetterCallback( - v8::Local property, + v8::Local property, v8::Local value, const v8::PropertyCallbackInfo& info); static void LoadExtensionForTrampoline( diff --git a/extensions/renderer/xwalk_v8tools_module.cc b/extensions/renderer/xwalk_v8tools_module.cc index 72e1a4d..4fcad37 100755 --- a/extensions/renderer/xwalk_v8tools_module.cc +++ b/extensions/renderer/xwalk_v8tools_module.cc @@ -21,43 +21,48 @@ void ForceSetPropertyCallback( info[0].As()->ForceSet(info[1], info[2]); } +// ================ +// lifecycleTracker +// ================ +struct LifecycleTrackerWrapper { + v8::Global handle; + v8::Global destructor; +}; + void LifecycleTrackerCleanup( - const v8::WeakCallbackData >& data) { - v8::Isolate* isolate = data.GetIsolate(); - v8::HandleScope handle_scope(isolate); + const v8::WeakCallbackInfo& data) { + LifecycleTrackerWrapper* wrapper = data.GetParameter(); - v8::Local tracker = data.GetValue(); - v8::Handle function = - tracker->Get(v8::String::NewFromUtf8(isolate, "destructor")); + if (!wrapper->destructor.IsEmpty()) { + v8::HandleScope handle_scope(data.GetIsolate()); + v8::Local context = v8::Context::New(data.GetIsolate()); + v8::Context::Scope scope(context); - if (function.IsEmpty() || !function->IsFunction()) { - LOGGER(WARN) << "Destructor function not set for LifecycleTracker."; - data.GetParameter()->Reset(); - delete data.GetParameter(); - return; - } + v8::Local destructor = + wrapper->destructor.Get(data.GetIsolate()); - v8::Handle context = v8::Context::New(isolate); + v8::MicrotasksScope microtasks( + data.GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); - v8::TryCatch try_catch; - v8::Handle::Cast(function)->Call(context->Global(), 0, NULL); - if (try_catch.HasCaught()) - LOGGER(WARN) << "Exception when running LifecycleTracker destructor"; + v8::TryCatch try_catch(data.GetIsolate()); + destructor->Call(context->Global(), 0, nullptr); - data.GetParameter()->Reset(); - delete data.GetParameter(); + if (try_catch.HasCaught()) { + LOGGER(WARN) << "Exception when running LifecycleTracker destructor"; + } + } } void LifecycleTracker(const v8::FunctionCallbackInfo& info) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::HandleScope handle_scope(isolate); - - v8::Persistent* tracker = - new v8::Persistent(isolate, v8::Object::New(isolate)); - tracker->SetWeak(tracker, &LifecycleTrackerCleanup); - - info.GetReturnValue().Set(*tracker); + v8::Isolate* isolate = info.GetIsolate(); + v8::HandleScope handle_scope(info.GetIsolate()); + + v8::Local tracker = v8::Object::New(isolate); + LifecycleTrackerWrapper* wrapper = new LifecycleTrackerWrapper; + wrapper->handle.Reset(isolate, tracker); + wrapper->handle.SetWeak(wrapper, LifecycleTrackerCleanup, + v8::WeakCallbackType::kParameter); + info.GetReturnValue().Set(wrapper->handle); } } // namespace -- 2.7.4 From 5d23503b2179b7ce94de69137911ba2bf31bd26b Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Tue, 11 Apr 2017 17:29:26 +0900 Subject: [PATCH 03/16] Initialized constructor Following members are initialized. => main_loop, session_counter Change-Id: Ibbea601f7dd087eb01a498fca97199c1f253ef4a Signed-off-by: jaekuk, lee --- runtime/browser/web_application.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index bd2bbc5..ccfe850 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -474,6 +474,14 @@ bool WebApplication::Initialize() { if (TIZEN_FEATURE_manual_rotate_support) window_->EnableManualRotation(true); + main_loop.application = NULL; + main_loop.timer = NULL; + session_counter.application = NULL; + session_counter.timer = NULL; + m_tizenCompatibilitySettings.m_major = 0; + m_tizenCompatibilitySettings.m_minor = 0; + m_tizenCompatibilitySettings.m_release = 0; + return true; } -- 2.7.4 From 358dc24e34026bc13444d2408e43f3b3c06dc783 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Wed, 19 Apr 2017 14:03:07 +0900 Subject: [PATCH 04/16] Changed the order of elm_exit() and elm_shutdown() Change-Id: Id8699768ee55faa3da46c677675d5ece135457ba Signed-off-by: jaekuk, lee --- runtime/browser/runtime_process.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/browser/runtime_process.cc b/runtime/browser/runtime_process.cc index e51887a..4a1576b 100755 --- a/runtime/browser/runtime_process.cc +++ b/runtime/browser/runtime_process.cc @@ -135,8 +135,8 @@ int real_main(int argc, char* argv[]) { } LOGGER(DEBUG) << "ewk_shutdown"; ewk_shutdown(); - elm_shutdown(); elm_exit(); + elm_shutdown(); LOGGER(DEBUG) << "EXIT_SUCCESS"; return EXIT_SUCCESS; -- 2.7.4 From 05e10fc455b2863ac79512c8d24e267bec6eca0c Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 14 Apr 2017 10:49:25 +0900 Subject: [PATCH 05/16] Add codes to enable web voice touch This commit adds codes to enable web voice touch. Web voice touch is enabled by the vconfkey value. To use web voice touch, vc-webview module must be needed. Change-Id: I082c537423e6d3a7b1c0943ae2119f69aabb93fe Signed-off-by: Suyeon Hwang --- packaging/crosswalk-tizen.spec | 1 + runtime/browser/web_application.cc | 37 +++++++++++++++++++++++++++++++++++++ runtime/browser/web_application.h | 2 ++ runtime/runtime.gyp | 1 + 4 files changed, 41 insertions(+) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index a948158..baed898 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -48,6 +48,7 @@ BuildRequires: pkgconfig(uuid) BuildRequires: pkgconfig(launchpad) BuildRequires: pkgconfig(ttrace) BuildRequires: pkgconfig(jsoncpp) +BuildRequires: pkgconfig(vc-webview) %define chromium_efl_workaround_ewk_settings 0 diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index ccfe850..94ed40a 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -482,6 +482,14 @@ bool WebApplication::Initialize() { m_tizenCompatibilitySettings.m_minor = 0; m_tizenCompatibilitySettings.m_release = 0; + // Get Web voice touch agent + bool is_supported_web_vt = false; + vc_webview_ = NULL; + if (0 == VCWebView::vc_is_supported_web_vt(&is_supported_web_vt) && is_supported_web_vt) { + LOGGER(DEBUG) << "[DEBUG] Web voice touch is enabled"; + vc_webview_ = VCWebView::getInstance(); + } + return true; } @@ -534,6 +542,11 @@ void WebApplication::Launch(std::unique_ptr appcontrol) { view->LoadUrl(res->uri(), res->mime()); view_stack_.push_front(view); + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(view->evas_object()); + } + // ewk_view_bg_color_set is not working at webview initialization. if (common::getProfile() == common::kPROFILE_WEARABLE && app_data_->app_type() == common::ApplicationData::WATCH) { @@ -747,6 +760,11 @@ void WebApplication::OnCreatedNewWebView(WebView* /*view*/, WebView* new_view) { SetupWebViewCompatibilitySettings(new_view); view_stack_.push_front(new_view); window_->SetContent(new_view->evas_object()); + + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(new_view->evas_object()); + } } void WebApplication::RemoveWebViewFromStack(WebView* view) { @@ -784,6 +802,11 @@ void WebApplication::RemoveWebViewFromStack(WebView* view) { } else if (current != view_stack_.front()) { view_stack_.front()->SetVisibility(true); window_->SetContent(view_stack_.front()->evas_object()); + + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(view_stack_.front()->evas_object()); + } } // Delete after the callback context(for ewk view) was not used @@ -938,6 +961,15 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { ? app_data_->setting_info()->hwkey_enabled() : true; + if (NULL != vc_webview_ && kKeyNameBack == keyname && vc_webview_->vc_get_conflict_status() == 1) { + // When Web voice touch is in result conflict state, function of back key change to + // canceling the conflict state + vc_webview_->vc_remove_tooltip(); + LOGGER(DEBUG) << "[DEBUG] Cancel conflict state of web voice touch"; + + return; + } + if (!common::utils::StartsWith(view->GetUrl(), kFileScheme)) { if (kKeyNameBack == keyname) { LOGGER(DEBUG) << "Back to previous page for remote URL"; @@ -1119,6 +1151,11 @@ void WebApplication::OnRendered(WebView* view) { LOGGER(DEBUG) << "Rendered"; splash_screen_->HideSplashScreen(SplashScreen::HideReason::RENDERED); + // Set web view into Web voice touch agent + if (NULL != vc_webview_) { + vc_webview_->vc_webview_set_view(view->evas_object()); + } + // Do not show(), active() for language change if(lang_changed_mode_ == false){ // Show window after frame rendered. diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index 0e10967..0614f1f 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -22,6 +22,7 @@ #include #include +#include #include "runtime/browser/web_view.h" class Ewk_Context; @@ -148,6 +149,7 @@ class WebApplication : public WebView::EventListener { int security_model_version_; std::string csp_rule_; std::string csp_report_rule_; + VCWebView* vc_webview_; }; } // namespace runtime diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index 168f13a..0beb057 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -65,6 +65,7 @@ 'wgt-manifest-handlers', 'notification', 'launchpad', + 'vc-webview', ], }, 'conditions': [ -- 2.7.4 From 5e05dbc54d0ca08d81136936c8410af41a349bde Mon Sep 17 00:00:00 2001 From: Youngcheol Kang Date: Wed, 10 May 2017 17:10:21 +0900 Subject: [PATCH 06/16] fixup! Implement Fullscreen API In tizen 2.4 environment, WRT calls the ewk_view_fullscreen_exit() API and exits the event handler when pressing hardware back key if it's fullscreen mode in only "Software key" mode or "windowed" view mode. However above two conditions(software key and windowed view modes) were omitted in tizen 3.0, so the ewk_view_fullscreen_exit() API was always called when pressing hardware back key in fullscreen mode. This CL fixes these problem. Bug: http://suprem.sec.samsung.net/jira/browse/TWF-3201 Change-Id: I4dda2d78be7af8cf75df72875aa2d7e94bbe2da9 Signed-off-by: Youngcheol Kang --- runtime/browser/web_application.cc | 5 +++++ runtime/browser/web_view_impl.cc | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 94ed40a..1d0a6c4 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -1003,6 +1003,11 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { RemoveWebViewFromStack(view_stack_.front()); } } + + if (app_data_->widget_info()->view_modes() == "fullscreen") { + ewk_view_fullscreen_exit(view->evas_object()); + return; + } } } else if (enabled && kKeyNameMenu == keyname) { view->EvalJavascript(kMenuKeyEventScript); diff --git a/runtime/browser/web_view_impl.cc b/runtime/browser/web_view_impl.cc index 34d8e57..ea77e15 100644 --- a/runtime/browser/web_view_impl.cc +++ b/runtime/browser/web_view_impl.cc @@ -985,10 +985,6 @@ void WebViewImpl::OnRotation(int degree) { void WebViewImpl::OnKeyEvent(Eext_Callback_Type key_type) { std::string keyname; if (key_type == EEXT_CALLBACK_BACK) { - if (fullscreen_) { - ewk_view_fullscreen_exit(ewk_view_); - return; - } if (EINA_TRUE == ewk_view_text_selection_clear(ewk_view_)) { return; } -- 2.7.4 From b00afca150143afe1e1b5e163d76296959040434 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Tue, 23 May 2017 21:16:36 +0900 Subject: [PATCH 07/16] [release 0.3.2]tizen porting Change-Id: I75ab917767be3406d23e01e6c162a5a281ed3145 Signed-off-by: jaekuk, lee --- runtime/browser/web_application.cc | 4 ---- runtime/browser/web_view_impl.cc | 4 ---- 2 files changed, 8 deletions(-) mode change 100644 => 100755 runtime/browser/web_view_impl.cc diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 1d0a6c4..5cd985f 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -711,14 +711,12 @@ void WebApplication::ClosePage() { for (; it != view_stack_.end(); ++it) { (*it)->ReplyToJavascriptDialog(); view_stack_.front()->SetVisibility(false); -#ifdef DENABLE_EWK_ADDITIONAL_FEATURE if (ewk_view_page_close((*it)->evas_object())) { LOGGER(DEBUG) << "ewk_view_page_close returns true"; valid_evas_object_count++; } else { LOGGER(DEBUG) << "ewk_view_page_close returns false"; } -#endif } } @@ -1215,12 +1213,10 @@ void WebApplication::SetupWebView(WebView* view) { void WebApplication::SetupWebViewCompatibilitySettings(WebView* view) { if (tizenWebKitCompatibilityEnabled()) { Ewk_Settings* settings = ewk_view_settings_get(view->evas_object()); -#ifdef DENABLE_COMPATIBILITY_MODE_SET ewk_settings_tizen_compatibility_mode_set(settings, m_tizenCompatibilitySettings.m_major, m_tizenCompatibilitySettings.m_minor, m_tizenCompatibilitySettings.m_release); -#endif ewk_settings_text_autosizing_enabled_set(settings, EINA_FALSE); } } diff --git a/runtime/browser/web_view_impl.cc b/runtime/browser/web_view_impl.cc old mode 100644 new mode 100755 index ea77e15..01050c5 --- a/runtime/browser/web_view_impl.cc +++ b/runtime/browser/web_view_impl.cc @@ -1028,15 +1028,11 @@ void WebViewImpl::SetDefaultEncoding(const std::string& encoding) { } void WebViewImpl::SetLongPolling(unsigned long longpolling) { -#ifdef DENABLE_CHROMIUM_EWK_FEATURE ewk_view_session_timeout_set(ewk_view_, longpolling); -#endif } void WebViewImpl::SetBGColor(int r, int g, int b, int a) { -#ifdef DENABLE_CHROMIUM_EWK_FEATURE ewk_view_bg_color_set(ewk_view_, r, g, b, a); -#endif } } // namespace runtime -- 2.7.4 From f6fcd9acc6681a448f5bdcfda6be2f20b04d23f2 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Wed, 24 May 2017 10:47:59 +0900 Subject: [PATCH 08/16] Changed the header file of appcore-watch from appcore-watch.h to watch_app.h Change-Id: Ib676f08863f8ec72eedd448c9fa6df20f12b4298 Signed-off-by: jaekuk, lee --- runtime/browser/watch_runtime.cc | 1 - runtime/browser/web_application.cc | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) mode change 100644 => 100755 runtime/browser/watch_runtime.cc diff --git a/runtime/browser/watch_runtime.cc b/runtime/browser/watch_runtime.cc old mode 100644 new mode 100755 index 4ec298b..39302ca --- a/runtime/browser/watch_runtime.cc +++ b/runtime/browser/watch_runtime.cc @@ -15,7 +15,6 @@ */ #include -#include #include #include diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 5cd985f..b6d8865 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -29,7 +29,7 @@ #include #ifdef WATCH_FACE_FEATURE_SUPPORT -#include +#include #endif #include "common/application_data.h" @@ -736,9 +736,7 @@ void WebApplication::Exit() { case common::ApplicationData::AppType::WATCH: if (TIZEN_FEATURE_watch_face_support) { LOGGER(ERROR) << "watch_ui_exit"; -#ifdef DENABLE_WATCH_APP watch_app_exit(); -#endif break; } else { goto __default; -- 2.7.4 From 2921f491ed136a6681a96cb394c5c261b81e53dd Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Thu, 15 Jun 2017 15:12:39 +0900 Subject: [PATCH 09/16] Changed a string to a variable "fullscreen" => kViewmodeTypeFullscreen "windowed" => kViewmodeTypeWindowed Change-Id: I354ce4c9fa84745c9c18d208faf570a9b16e970b Signed-off-by: jaekuk, lee --- runtime/browser/web_application.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index b6d8865..4e3d730 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -144,6 +144,9 @@ const char* kDefaultCSPRule = const char* kResWgtPath = "res/wgt/"; const char* kAppControlMain = "http://tizen.org/appcontrol/operation/main"; +const std::string kViewmodeTypeFullscreen = "fullscreen"; +const std::string kViewmodeTypeWindowed = "windowed"; + // Looking for added privilege by Application developer in config.xml. bool FindPrivilegeFromConfig(common::ApplicationData* app_data, const std::string& privilege) { @@ -446,7 +449,7 @@ bool WebApplication::Initialize() { } if (app_data_->widget_info() != NULL && - app_data_->widget_info()->view_modes() == "fullscreen") { + app_data_->widget_info()->view_modes() == kViewmodeTypeFullscreen) { window_->SetCurrentViewModeFullScreen(true); window_->FullScreen(true); } @@ -990,7 +993,7 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { if ((app_data_->setting_info() != NULL && app_data_->setting_info()->backbutton_presence()) || (app_data_->widget_info() != NULL && - app_data_->widget_info()->view_modes() == "windowed")) { + app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) { if (!view->Backward()) { if (view_stack_.size() == 1) { LOGGER(DEBUG) << "Terminate"; @@ -1000,7 +1003,7 @@ void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) { } } - if (app_data_->widget_info()->view_modes() == "fullscreen") { + if (app_data_->widget_info()->view_modes() == kViewmodeTypeFullscreen) { ewk_view_fullscreen_exit(view->evas_object()); return; } -- 2.7.4 From 93796edd1a1f569edfee7a088b60ce2755508507 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Tue, 20 Jun 2017 14:21:01 +0900 Subject: [PATCH 10/16] Implemented progressbar for web application issue : http://suprem.sec.samsung.net/jira/browse/MPR-1117 Hosted web app such as YouTube displays a white screen until the page finishes loading. Modified WRT to display progressbar until the page finishes loading if progressbar-presence is enabled in config.xml. Change-Id: I114d69543caea76161d0ace22cf57ae052c8f099 Signed-off-by: jaekuk, lee --- runtime/browser/native_window.cc | 24 ++++++++++++++++++++++++ runtime/browser/native_window.h | 4 ++++ runtime/browser/web_application.cc | 29 +++++++++++++++++++++++++++++ runtime/browser/web_application.h | 1 + 4 files changed, 58 insertions(+) diff --git a/runtime/browser/native_window.cc b/runtime/browser/native_window.cc index 6e723e5..43f6bef 100755 --- a/runtime/browser/native_window.cc +++ b/runtime/browser/native_window.cc @@ -23,6 +23,7 @@ #include "common/arraysize.h" #include "common/logger.h" +#include "common/platform_info.h" namespace runtime { @@ -75,6 +76,8 @@ NativeWindow::NativeWindow() currentViewModeFullScreen_(false), focus_(NULL), content_(NULL), + progressbar_(NULL), + top_layout_(NULL), rotation_(0), handler_id_(0) { } @@ -126,6 +129,7 @@ void NativeWindow::Initialize() { EVAS_SIZE_EXPAND_FILL(top_layout); elm_object_content_set(conformant, top_layout); evas_object_show(top_layout); + top_layout_ = top_layout; // focus Evas_Object* focus = elm_bg_add(top_layout); @@ -139,6 +143,17 @@ void NativeWindow::Initialize() { evas_object_show(focus); focus_ = focus; + if (common::getProfile() == common::kPROFILE_MOBILE) { + // progressbar + Evas_Object *progressbar = elm_progressbar_add(top_layout); + EVAS_SIZE_EXPAND_FILL(progressbar); + elm_progressbar_unit_format_set(progressbar, "%1.1f%%"); + elm_progressbar_horizontal_set(progressbar, EINA_TRUE); + elm_object_part_content_set(top_layout, "elm.swallow.progress", progressbar); + evas_object_show(progressbar); + progressbar_ = progressbar; + } + // focus callback auto focus_callback = [](void* user_data, Evas_Object*, @@ -304,4 +319,13 @@ void NativeWindow::ManualRotationDone() { } } +void NativeWindow::SignalEmit(const char* emission, + const char* source) { + elm_object_signal_emit(top_layout_, emission, source); +} + +void NativeWindow::UpdateProgress(double value) { + elm_progressbar_value_set(progressbar_, ELM_SCALE_SIZE(value)); +} + } // namespace runtime diff --git a/runtime/browser/native_window.h b/runtime/browser/native_window.h index 0a5f23c..a305389 100755 --- a/runtime/browser/native_window.h +++ b/runtime/browser/native_window.h @@ -63,6 +63,8 @@ class NativeWindow { Type type() const { return window_type_;} void EnableManualRotation(bool enable); void ManualRotationDone(); + void SignalEmit(const char* emission, const char* source); + void UpdateProgress(double value); protected: virtual Evas_Object* CreateWindowInternal() = 0; @@ -80,6 +82,8 @@ class NativeWindow { bool currentViewModeFullScreen_; Evas_Object* focus_; Evas_Object* content_; + Evas_Object* progressbar_; + Evas_Object* top_layout_; int rotation_; int handler_id_; ScreenOrientation natural_orientation_; diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 4e3d730..b8a95bc 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -144,6 +144,10 @@ const char* kDefaultCSPRule = const char* kResWgtPath = "res/wgt/"; const char* kAppControlMain = "http://tizen.org/appcontrol/operation/main"; +// window signal callback +const char *kEdjeShowProgressSignal = "show,progress,signal"; +const char *kEdjeHideProgressSignal = "hide,progress,signal"; + const std::string kViewmodeTypeFullscreen = "fullscreen"; const std::string kViewmodeTypeWindowed = "windowed"; @@ -1144,8 +1148,33 @@ void WebApplication::OnLoadStart(WebView* /*view*/) { LOGGER(DEBUG) << "LoadStart"; } +void WebApplication::OnLoadProgress(WebView* view, double persent) { + LOGGER(DEBUG) << "LoadProgress, progress ;"<setting_info() != NULL && + app_data_->setting_info()->progressbar_presence()) || + (app_data_->widget_info() != NULL && + app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) { + if (persent == 1.0) { + window_->SignalEmit(kEdjeHideProgressSignal, ""); + } else { + window_->SignalEmit(kEdjeShowProgressSignal, ""); + window_->UpdateProgress(persent); + } + } + } +} + void WebApplication::OnLoadFinished(WebView* /*view*/) { LOGGER(DEBUG) << "LoadFinished"; + if (common::getProfile() == common::kPROFILE_MOBILE) { + if ((app_data_->setting_info() != NULL && + app_data_->setting_info()->progressbar_presence()) || + (app_data_->widget_info() != NULL && + app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) { + window_->SignalEmit(kEdjeHideProgressSignal, ""); + } + } splash_screen_->HideSplashScreen(SplashScreen::HideReason::LOADFINISHED); } diff --git a/runtime/browser/web_application.h b/runtime/browser/web_application.h index 0614f1f..99e56d0 100755 --- a/runtime/browser/web_application.h +++ b/runtime/browser/web_application.h @@ -71,6 +71,7 @@ class WebApplication : public WebView::EventListener { virtual void OnHardwareKey(WebView* view, const std::string& keyname); virtual void OnConsoleMessage(const std::string& msg, int level); virtual void OnLoadStart(WebView* view); + virtual void OnLoadProgress(WebView* view, double persent); virtual void OnLoadFinished(WebView* view); virtual void OnRendered(WebView* view); virtual void OnLanguageChanged(); -- 2.7.4 From 10cdfc656c2adc296461a5ab703286b8bb2b0a14 Mon Sep 17 00:00:00 2001 From: Pawel Niemirski Date: Wed, 28 Jun 2017 12:11:50 +0200 Subject: [PATCH 11/16] Register service worker on PWA launch Start the registration if config.xml has following metadata: Bug: http://suprem.sec.samsung.net/jira/browse/RWASP-1583 Change-Id: I9ada897e7b654b4a72596935b3d6dc4a53ce13c8 Signed-off-by: Pawel Niemirski --- runtime/browser/web_application.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index b8a95bc..4caa495 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -151,6 +151,8 @@ const char *kEdjeHideProgressSignal = "hide,progress,signal"; const std::string kViewmodeTypeFullscreen = "fullscreen"; const std::string kViewmodeTypeWindowed = "windowed"; +const char* const kServiceWorkerConfigKey = "service-worker-url"; + // Looking for added privilege by Application developer in config.xml. bool FindPrivilegeFromConfig(common::ApplicationData* app_data, const std::string& privilege) { @@ -282,6 +284,16 @@ static bool ProcessWellKnownScheme(const std::string& url) { return true; } +void OnDidRegisterServiceWorkerCb(Ewk_Context*, const char*, const char*, + Eina_Bool result, void*) { + if (result) { + LOGGER(DEBUG) << "Service-worker has been registered successfully"; + } else { + LOGGER(DEBUG) << + "An unexpected error has occurred during service-worker registeration"; + } +} + } // namespace std::vector ParseTizenVersion(const std::string& tizen_string) { @@ -530,6 +542,15 @@ void WebApplication::Launch(std::unique_ptr appcontrol) { resource_manager_->GetStartResource(appcontrol.get()); view->SetDefaultEncoding(res->encoding()); + if (app_data_->meta_data_info().get() && + app_data_->meta_data_info()->HasKey(kServiceWorkerConfigKey)) { + std::string service_worker_url = + app_data_->meta_data_info()->GetValue(kServiceWorkerConfigKey); + ewk_context_service_worker_register(ewk_context_, res->uri().c_str(), + service_worker_url.c_str(), + OnDidRegisterServiceWorkerCb, this); + } + STEP_PROFILE_END("OnCreate -> URL Set"); STEP_PROFILE_START("URL Set -> Rendered"); -- 2.7.4 From f243269ce5ed3b7873822be118149af731f7bb06 Mon Sep 17 00:00:00 2001 From: "min7.choi" Date: Mon, 10 Jul 2017 10:39:10 +0900 Subject: [PATCH 12/16] Remove caps due to security issue & apply caps directly in security-config Change-Id: I70b6f0e2b4c1fb65c2bbecb5bd741c737ac020ed Signed-off-by: min7.choi --- packaging/crosswalk-tizen.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/crosswalk-tizen.spec b/packaging/crosswalk-tizen.spec index baed898..6f41520 100755 --- a/packaging/crosswalk-tizen.spec +++ b/packaging/crosswalk-tizen.spec @@ -253,7 +253,6 @@ rm -fr %{buildroot} %attr(644,root,root) %{_datadir}/aul/wrt.loader %attr(755,root,root) %{_bindir}/wrt-upgrade %attr(755,root,root) %{_datadir}/upgrade/scripts/720.wrt.upgrade.sh -%caps(cap_sys_admin,cap_setgid=ei) %{_bindir}/wrt-loader %license LICENSE LICENSE.BSD # If it is unified or wearable, create circular-display extension -- 2.7.4 From 0813953a6f113909b0adad3f41088d0e083de8bc Mon Sep 17 00:00:00 2001 From: Pawel Niemirski Date: Wed, 12 Jul 2017 14:13:09 +0200 Subject: [PATCH 13/16] Support swipe to refresh feature Enable the feature if config.xml has following metadata: Bug: http://suprem.sec.samsung.net/jira/browse/RWASP-1534 Change-Id: Id430ea44a3bb344a2836e841f5103a1bb1f55141 Signed-off-by: Pawel Niemirski --- runtime/browser/web_application.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 4caa495..014e882 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -153,6 +153,8 @@ const std::string kViewmodeTypeWindowed = "windowed"; const char* const kServiceWorkerConfigKey = "service-worker-url"; +const char* const kEnableSwipeToRefreshConfigKey = "enable-swipe-to-refresh"; + // Looking for added privilege by Application developer in config.xml. bool FindPrivilegeFromConfig(common::ApplicationData* app_data, const std::string& privilege) { @@ -551,6 +553,12 @@ void WebApplication::Launch(std::unique_ptr appcontrol) { OnDidRegisterServiceWorkerCb, this); } + if (app_data_->meta_data_info().get() && + app_data_->meta_data_info()->HasKey(kEnableSwipeToRefreshConfigKey)) { + Ewk_Settings* settings = ewk_view_settings_get(view->evas_object()); + ewk_settings_swipe_to_refresh_enabled_set(settings, EINA_TRUE); + } + STEP_PROFILE_END("OnCreate -> URL Set"); STEP_PROFILE_START("URL Set -> Rendered"); -- 2.7.4 From 604ec856a53f38ec68f996361d5c87d556684a9e Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Fri, 11 Aug 2017 18:46:58 +0900 Subject: [PATCH 14/16] Add ASLR to wrt-loader and wrt-upgrade Change-Id: Ib16832362f941d15cb68c894ea815512cfb086b1 Signed-off-by: jaekuk, lee --- loader/loader.gyp | 3 +++ wrt-upgrade/wrt-upgrade.gyp | 3 +++ 2 files changed, 6 insertions(+) mode change 100644 => 100755 loader/loader.gyp diff --git a/loader/loader.gyp b/loader/loader.gyp old mode 100644 new mode 100755 index 152ec46..3e99808 --- a/loader/loader.gyp +++ b/loader/loader.gyp @@ -9,6 +9,9 @@ 'sources': [ 'wrt_loader.cc', ], + 'ldflags': [ + '-pie', + ], 'variables': { 'packages': [ 'dlog', diff --git a/wrt-upgrade/wrt-upgrade.gyp b/wrt-upgrade/wrt-upgrade.gyp index cc8a116..55b48a6 100755 --- a/wrt-upgrade/wrt-upgrade.gyp +++ b/wrt-upgrade/wrt-upgrade.gyp @@ -13,6 +13,9 @@ 'wrt-upgrade.cc', 'wrt-upgrade-info.cc', ], + 'ldflags': [ + '-pie', + ], 'variables': { 'packages': [ 'sqlite3', -- 2.7.4 From 3e911dbe7e3f4c2496a4fd98ca8c4286fbc069a5 Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Wed, 23 Aug 2017 17:32:45 +0900 Subject: [PATCH 15/16] Added code to check whether wayland get ready before running Web Runtime Change-Id: Ib06f4fc51fa554893ece5c26af8e592838e31d76 Signed-off-by: jaekuk, lee --- runtime/browser/runtime_process.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/runtime/browser/runtime_process.cc b/runtime/browser/runtime_process.cc index 4a1576b..9f294ae 100755 --- a/runtime/browser/runtime_process.cc +++ b/runtime/browser/runtime_process.cc @@ -103,7 +103,10 @@ int real_main(int argc, char* argv[]) { // Default behavior, run as runtime. LOGGER(INFO) << "Runtime process has been created."; if (!g_prelaunch) { - ewk_init(); + if (!ewk_init()) { + LOGGER(ERROR) << "could not init ewk"; + return false; + } char* chromium_arg_options[] = { argv[0], const_cast("--no-sandbox"), @@ -150,8 +153,11 @@ int main(int argc, char* argv[]) { if (strcmp(argv[0], "/usr/bin/wrt-loader") == 0) { auto preload = [argv](void) { LOGGER(DEBUG) << "run with wrt-loader"; + if (!ewk_init()) { + LOGGER(ERROR) << "could not init ewk"; + return false; + } g_prelaunch = true; - ewk_init(); char* chromium_arg_options[] = { argv[0], const_cast("--no-sandbox"), -- 2.7.4 From fcca274bd6fa16d4381946878e2c027d8620a33d Mon Sep 17 00:00:00 2001 From: "jaekuk, lee" Date: Thu, 27 Jul 2017 19:03:50 +0900 Subject: [PATCH 16/16] Delete NotificationCallback Notification icon and badge were implemented on Web Engine side. (https://review.tizen.org/gerrit/#/c/137819/) So ewk_context_notification_callbacks_set API was removed from WRT. Change-Id: I4fe497eaa944fc761f671b9d01fe41148b1dcbd1 Signed-off-by: jaekuk, lee --- runtime/browser/web_application.cc | 27 --------------------------- runtime/runtime.gyp | 2 -- 2 files changed, 29 deletions(-) diff --git a/runtime/browser/web_application.cc b/runtime/browser/web_application.cc index 014e882..390f990 100755 --- a/runtime/browser/web_application.cc +++ b/runtime/browser/web_application.cc @@ -44,7 +44,6 @@ #include "extensions/renderer/xwalk_extension_renderer_controller.h" #include "common/platform_info.h" #include "runtime/browser/native_window.h" -#include "runtime/browser/notification_manager.h" #include "runtime/browser/popup.h" #include "runtime/browser/popup_string.h" #include "runtime/browser/vibration_manager.h" @@ -216,31 +215,6 @@ static void SendDownloadRequest(const std::string& url) { request.LaunchRequest(); } -static void InitializeNotificationCallback(Ewk_Context* ewk_context, - WebApplication* app) { - auto show = [](Ewk_Context*, Ewk_Notification* noti, void* user_data) { - WebApplication* self = static_cast(user_data); - if (self == NULL) return; - uint64_t id = ewk_notification_id_get(noti); - std::string title(ewk_notification_title_get(noti) - ? ewk_notification_title_get(noti) - : ""); - std::string body( - ewk_notification_body_get(noti) ? ewk_notification_body_get(noti) : ""); - std::string icon_path = self->data_path() + "/" + kNotiIconFile; - if (!ewk_notification_icon_save_as_png(noti, icon_path.c_str())) { - icon_path = ""; - } - if (NotificationManager::GetInstance()->Show(id, title, body, icon_path)) - ewk_notification_showed(id); - }; - auto hide = [](Ewk_Context*, uint64_t noti_id, void*) { - NotificationManager::GetInstance()->Hide(noti_id); - ewk_notification_closed(noti_id, EINA_FALSE); - }; - ewk_context_notification_callbacks_set(ewk_context, show, hide, app); -} - static Eina_Bool ExitAppIdlerCallback(void* data) { WebApplication* app = static_cast(data); @@ -423,7 +397,6 @@ bool WebApplication::Initialize() { }; ewk_context_did_start_download_callback_set(ewk_context_, download_callback, this); - InitializeNotificationCallback(ewk_context_, this); if (FindPrivilegeFromConfig(app_data_, kFullscreenPrivilege)) { ewk_context_tizen_extensible_api_string_set(ewk_context_, diff --git a/runtime/runtime.gyp b/runtime/runtime.gyp index 0beb057..30abbaf 100755 --- a/runtime/runtime.gyp +++ b/runtime/runtime.gyp @@ -39,8 +39,6 @@ 'browser/popup_string.cc', 'browser/vibration_manager.h', 'browser/vibration_manager.cc', - 'browser/notification_manager.h', - 'browser/notification_manager.cc', 'browser/prelauncher.h', 'browser/prelauncher.cc', 'browser/preload_manager.h', -- 2.7.4