[M120 Migration]Post PopupBlocked in main thread 19/318419/2 submit/tizen/20240929.160013
authorJie Zhang <jie137.zhang@samsung.com>
Fri, 27 Sep 2024 17:09:32 +0000 (01:09 +0800)
committerBot Blink <blinkbot@samsung.com>
Sun, 29 Sep 2024 04:11:18 +0000 (04:11 +0000)
1. All evas callback should post in main thread,
   or it will cause crash or app can not get the callback,
   original method PostTask to UI fail to work,
   use content::GetUIThreadTaskRunner

2. if render process re-create, ewk_settings_scripts_can_open_windows_set
   the API will fail to set to new one, so remove the check

Reference:
 - https://review.tizen.org/gerrit/#/c/310075/

Change-Id: I696eb7c08f233cf74a5ba2b53aa89402194ec10f
Signed-off-by: Jie Zhang <jie137.zhang@samsung.com>
content/browser/renderer_host/render_frame_host_impl.cc
tizen_src/ewk/efl_integration/browser_context_efl.cc
tizen_src/ewk/efl_integration/content_browser_client_efl.cc

index 952a1c3b4658ad414a24e6cddac889d619c3e436..04640f74e393d1174d86ea2be0d3b6ae73087d05 100644 (file)
@@ -8245,6 +8245,10 @@ void RenderFrameHostImpl::CreateNewWindow(
   // Filter out URLs to which navigation is disallowed from this context.
   GetProcess()->FilterURL(false, &params->target_url);
 
+  LOG(INFO) << "allow popup : " << params->allow_popup
+            << ", activate : " << frame_tree_node_->HasTransientUserActivation()
+            << ", active : " << transient_allow_popup_.IsActive()
+            << ", disposition : " << (int)params->disposition;
   bool effective_transient_activation_state =
       params->allow_popup || HasTransientUserActivation() ||
       (transient_allow_popup_.IsActive() &&
index 4159dbc28295c9698f55abdc2c74f2b6c907131a..03bcc56e73fbb60987b011ee605fbdf1ac7df1d9 100644 (file)
@@ -438,9 +438,6 @@ SpecialStoragePolicyEfl* BrowserContextEfl::GetSpecialStoragePolicyEfl() {
 }
 
 void BrowserContextEfl::SetScriptsCanOpenWindows(bool enable) {
-  if (scripts_can_open_window_ == enable)
-    return;
-
   scripts_can_open_window_ = enable;
   SendToAllRenderers(new EwkViewMsg_SetScriptsCanOpenWindows(enable));
 }
index 6e798598d97789db7a263a7a97c3371146331ecd..a9d9c6e0b5d18c4a1dfe248023ca09760dc6cf8a 100644 (file)
@@ -193,6 +193,7 @@ void DispatchPopupBlockedOnUIThread(int render_process_id,
       RenderWidgetHost::GetRenderWidgetHosts());
   RenderWidgetHost* widget = NULL;
 
+  LOG(INFO) << __FUNCTION__;
   while ((widget = widgets->GetNextHost()))
     if (widget->GetProcess()->GetID() == render_process_id)
       break;
@@ -391,9 +392,10 @@ bool ContentBrowserClientEfl::CanCreateWindow(
     bool user_gesture,
     bool opener_suppressed,
     bool* no_javascript_access) {
+  LOG(INFO) << "user_gesture : " << user_gesture;
   if (!user_gesture) {
     *no_javascript_access = true;
-    base::ThreadPool::PostTask(
+    content::GetUIThreadTaskRunner({})->PostTask(
         FROM_HERE, base::BindOnce(&DispatchPopupBlockedOnUIThread,
                                   opener->GetProcess()->GetID(), target_url));
     return false;