Fix for zygote crash during browser launch 71/302571/4
authoruzair <uzair.jaleel@samsung.com>
Fri, 8 Dec 2023 11:51:38 +0000 (17:21 +0530)
committeruzair <uzair.jaleel@samsung.com>
Mon, 11 Dec 2023 11:53:40 +0000 (17:23 +0530)
Zygote process was crashing  as its launch path overiding api
from efl port failed. Hence below change adds needed CHECK
macro and partially reverts [1] as CreateDirectory api call
failed in earlier version of tizen as well due to platform specific
"ISDIR" call failure.

[1]https://chromium-review.googlesource.com/c/chromium/src/+/4685555

Change-Id: I0a69511728fdf2d75dd0b44188e5fa8817e1d0b6
Signed-off-by: uzair <uzair.jaleel@samsung.com>
base/path_service.cc
tizen_src/ewk/efl_integration/content_main_delegate_efl.cc

index 6350fc8..2645060 100644 (file)
@@ -278,7 +278,11 @@ bool PathService::OverrideAndCreateIfNeeded(int key,
   // Create the directory if requested by the caller. Do this before resolving
   // `file_path` to an absolute path because on POSIX, MakeAbsoluteFilePath
   // requires that the path exists.
-  if (create && !CreateDirectory(file_path)) {
+  if (create &&
+#if BUILDFLAG(IS_EFL)
+      !PathExists(file_path) &&
+#endif
+      !CreateDirectory(file_path)) {
     return false;
   }
 
index 5841bf5..44751f5 100644 (file)
@@ -83,11 +83,15 @@ ContentMainDelegateEfl::ContentMainDelegateEfl() {
 
 
 void ContentMainDelegateEfl::PreSandboxStartupBrowser() {
-  LocaleEfl::Initialize();
-  base::PathService::Override(base::FILE_EXE, base::FilePath(SubProcessPath()));
-  base::PathService::Override(base::FILE_MODULE,
-                              base::FilePath(SubProcessPath()));
+  if (!base::PathService::Override(base::FILE_EXE,
+                                   base::FilePath(SubProcessPath())) ||
+      !base::PathService::Override(base::FILE_MODULE,
+                                   base::FilePath(SubProcessPath()))) {
+    LOG(ERROR) << " failed to override path for efl port ";
+    return;
+  }
 
+  LocaleEfl::Initialize();
   InitializeUserDataDir();
   InitializeDiskCacheDir();