Reply to javascript dialog before closing webview 13/107213/2 accepted/tizen/3.0/common/20161228.071743 accepted/tizen/3.0/ivi/20161228.022641 accepted/tizen/3.0/mobile/20161228.022543 accepted/tizen/3.0/tv/20161228.022612 accepted/tizen/3.0/wearable/20161228.022625 submit/tizen_3.0/20161227.152031
authorYoungcheol Kang <ychul.kang@samsung.com>
Tue, 27 Dec 2016 07:09:11 +0000 (16:09 +0900)
committerYoungcheol Kang <ychul.kang@samsung.com>
Tue, 27 Dec 2016 14:02:34 +0000 (23:02 +0900)
In order to prevent crash/fress issue, this patch adds
the codes which call the ewk_view_javascript_alert_reply()
when internal popup was opened.

Bug: http://suprem.sec.samsung.net/jira/browse/TWF-2715

Change-Id: I029f0cbc4ffc5b8bb9cdf2dc35d40e0f69c9338f
Signed-off-by: Youngcheol Kang <ychul.kang@samsung.com>
runtime/browser/web_application.cc
runtime/browser/web_view.cc
runtime/browser/web_view.h
runtime/browser/web_view_impl.cc
runtime/browser/web_view_impl.h

index 30be5300e173eee047aa89f67815cdc50c8fad88..f5f16ba3cae5f9f47d8253dadb25ea239b871494 100755 (executable)
@@ -711,6 +711,8 @@ void WebApplication::RemoveWebViewFromStack(WebView* view) {
 
 void WebApplication::OnClosedWebView(WebView* view) {
   is_terminated_by_callback_ = true;
+  // Reply to javascript dialog for preventing freeze issue.
+  view->ReplyToJavascriptDialog();
   RemoveWebViewFromStack(view);
 
   if (runtime::Runtime::is_on_terminate_called) {
@@ -718,7 +720,7 @@ void WebApplication::OnClosedWebView(WebView* view) {
   }
 }
 
-void WebApplication::OnReceivedWrtMessage(WebView* /*view*/,
+void WebApplication::OnReceivedWrtMessage(WebView* view,
                                           Ewk_IPC_Wrt_Message_Data* msg) {
   Eina_Stringshare* msg_type = ewk_ipc_wrt_message_data_type_get(msg);
 
@@ -739,6 +741,8 @@ void WebApplication::OnReceivedWrtMessage(WebView* /*view*/,
       window_->InActive();
     } else if (TYPE_IS("tizen://exit")) {
       // One Way Message
+      // Reply to javascript dialog for preventing freeze issue.
+      view->ReplyToJavascriptDialog();
       ecore_idler_add(ExitAppIdlerCallback, this);
     } else if (TYPE_IS("tizen://changeUA")) {
       // Async Message
index c96a28f75042ed19e9586c15b05cd741689ee681..7f2b4feb86f7e2b7d45d1b2bcd928305fced431e 100644 (file)
@@ -32,6 +32,10 @@ WebView::~WebView() {
   delete impl_;
 }
 
+void WebView::ReplyToJavascriptDialog() {
+  impl_->ReplyToJavascriptDialog();
+}
+
 void WebView::LoadUrl(const std::string& url, const std::string& mime) {
   impl_->LoadUrl(url, mime);
 }
index 29a6fad764c402b6aa82aabf4f420ddd86baa606..9441db274c145584f9d13e7db691b79ac0cd3fcd 100644 (file)
@@ -116,6 +116,7 @@ class WebView {
   WebView(NativeWindow* window, Ewk_Context* context);
   virtual ~WebView();
 
+  void ReplyToJavascriptDialog();
   void LoadUrl(const std::string& url, const std::string& mime = std::string());
   std::string GetUrl();
 
index 25b2dc3f3cd6ee32b7bd669c04b47fd04ccab18c..ca2a92cfbf9e2c03474339c6a4f47c8c27f568a6 100644 (file)
@@ -87,6 +87,7 @@ WebViewImpl::WebViewImpl(WebView* view,
 
 WebViewImpl::~WebViewImpl() {
   if (internal_popup_opened_) {
+    internal_popup_opened_ = false;
     ewk_view_javascript_alert_reply(ewk_view_);
   }
   Deinitialize();
@@ -95,6 +96,13 @@ WebViewImpl::~WebViewImpl() {
     evas_smart_free(evas_smart_class_);
 }
 
+void WebViewImpl::ReplyToJavascriptDialog() {
+  if (internal_popup_opened_) {
+    internal_popup_opened_ = false;
+    ewk_view_javascript_alert_reply(ewk_view_);
+  }
+}
+
 void WebViewImpl::LoadUrl(const std::string& url, const std::string& mime) {
   SCOPE_PROFILE();
   if (!mime.empty()) {
index eba77489d2c06ca8ddbde0da1da7898972687863..b97fb7982e7d306ca2aa78d4e3b38c0d9769c681 100644 (file)
@@ -36,6 +36,7 @@ class WebViewImpl {
   WebViewImpl(WebView* view, NativeWindow* window, Ewk_Context* context);
   virtual ~WebViewImpl();
 
+  void ReplyToJavascriptDialog();
   void LoadUrl(const std::string& url, const std::string& mime = std::string());
   std::string GetUrl();