From: Seungkeun Lee Date: Fri, 28 Aug 2015 07:37:54 +0000 (+0900) Subject: Fix WebEngine opened Popup related crash issue with workaround code X-Git-Tag: submit/tizen/20150921.093222~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc0c06b247887738fff4ac9e699b388b6a7cf4f8;p=platform%2Fframework%2Fweb%2Fcrosswalk-tizen.git Fix WebEngine opened Popup related crash issue with workaround code - If popup(opened by webengein) was not closed when WebView was deleted, it will cause crash - When WebView was deleted, request closing popup to the webengine - popup close request API should be provided by webengine, currently use workaround API Change-Id: I3ac2647e09c8d434b6398dbc3143a8e5bf77af20 --- diff --git a/src/runtime/web_view_impl.cc b/src/runtime/web_view_impl.cc index 16fea016b..628a88e6e 100755 --- a/src/runtime/web_view_impl.cc +++ b/src/runtime/web_view_impl.cc @@ -78,11 +78,15 @@ WebViewImpl::WebViewImpl(WebView* view, listener_(NULL), view_(view), fullscreen_(false), - evas_smart_class_(NULL) { + evas_smart_class_(NULL), + internal_popup_opened_(false) { Initialize(); } WebViewImpl::~WebViewImpl() { + if (internal_popup_opened_) { + ewk_view_javascript_alert_reply(ewk_view_); + } Deinitialize(); evas_object_del(ewk_view_); if (evas_smart_class_ != NULL) @@ -187,6 +191,7 @@ void WebViewImpl::Initialize() { InitGeolocationPermissionCallback(); InitAuthenticationCallback(); InitCertificateAllowCallback(); + InitPopupWaitCallback(); Ewk_Settings* settings = ewk_view_settings_get(ewk_view_); ewk_settings_scripts_can_open_windows_set(settings, EINA_TRUE); @@ -763,6 +768,22 @@ void WebViewImpl::InitCertificateAllowCallback() { smart_callbacks_["request,certificate,confirm"] = certi_callback; } +void WebViewImpl::InitPopupWaitCallback() { + evas_object_smart_callback_add(ewk_view_, + "popup,reply,wait,start", + [](void* user_data, Evas_Object* /*obj*/, void*) { + WebViewImpl* self = static_cast(user_data); + self->internal_popup_opened_ = true; + }, this); + evas_object_smart_callback_add(ewk_view_, + "popup,reply,wait,finish", + [](void* user_data, Evas_Object* /*obj*/, void*) { + WebViewImpl* self = static_cast(user_data); + self->internal_popup_opened_ = false; + }, this); +} + + std::string WebViewImpl::GetUrl() { return std::string(ewk_view_url_get(ewk_view_)); diff --git a/src/runtime/web_view_impl.h b/src/runtime/web_view_impl.h index dad71267e..3631346b4 100755 --- a/src/runtime/web_view_impl.h +++ b/src/runtime/web_view_impl.h @@ -71,6 +71,7 @@ class WebViewImpl { void InitGeolocationPermissionCallback(); void InitAuthenticationCallback(); void InitCertificateAllowCallback(); + void InitPopupWaitCallback(); NativeWindow* window_; Ewk_Context* context_; @@ -83,6 +84,7 @@ class WebViewImpl { std::string mime_; Evas_Smart* evas_smart_class_; Ewk_View_Smart_Class ewk_smart_class_; + bool internal_popup_opened_; }; } // namespace wrt