Commit 647c3327 authored by Haik Aftandilian's avatar Haik Aftandilian
Browse files

Bug 17554093 - aarch64 Darwin fails to build with --disable-sandbox r=spohl

Make GetAppPath() defined on Mac aarch64 builds even without MOZ_SANDBOX because aarch64 builds may use it for Rosetta pre-translation.

Differential Revision: https://phabricator.services.mozilla.com/D138751
parent e1863039
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ NS_IMPL_ISUPPORTS(nsMacUtilsImpl, nsIMacUtils)
using mozilla::StaticMutexAutoLock;
using mozilla::Unused;

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
StaticAutoPtr<nsCString> nsMacUtilsImpl::sCachedAppPath;
StaticMutex nsMacUtilsImpl::sCachedAppPathMutex;
#endif
@@ -139,7 +139,7 @@ nsMacUtilsImpl::GetIsTranslated(bool* aIsTranslated) {
  return NS_OK;
}

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
// Get the path to the .app directory (aka bundle) for the parent process.
// When executing in the child process, this is the outer .app (such as
// Firefox.app) and not the inner .app containing the child process
@@ -217,8 +217,9 @@ nsresult nsMacUtilsImpl::ClearCachedAppPathOnShutdown() {
  ClearOnShutdown(&sCachedAppPath);
  return NS_OK;
}
#endif /* MOZ_SANDBOX || __aarch64__ */

#  if defined(DEBUG)
#if defined(MOZ_SANDBOX) && defined(DEBUG)
// If XPCOM_MEM_BLOAT_LOG or XPCOM_MEM_LEAK_LOG is set to a log file
// path, return the path to the parent directory (where sibling log
// files will be saved.)
@@ -255,8 +256,7 @@ nsresult nsMacUtilsImpl::GetDirectoryPath(const char* aPath,
  }
  return NS_OK;
}
#  endif /* DEBUG */
#endif   /* MOZ_SANDBOX */
#endif /* MOZ_SANDBOX  && DEBUG */

/* static */
bool nsMacUtilsImpl::IsTCSMAvailable() {
+6 −5
Original line number Diff line number Diff line
@@ -31,14 +31,15 @@ class nsMacUtilsImpl final : public nsIMacUtils {
  static nsresult GetRepoDir(nsIFile** aRepoDir);
  static nsresult GetObjDir(nsIFile** aObjDir);

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
  static bool GetAppPath(nsCString& aAppPath);
#  ifdef DEBUG
#endif /* MOZ_SANDBOX || __aarch64__ */

#if defined(MOZ_SANDBOX) && defined(DEBUG)
  static nsresult GetBloatLogDir(nsCString& aDirectoryPath);
  static nsresult GetDirectoryPath(const char* aPath,
                                   nsCString& aDirectoryPath);
#  endif /* DEBUG */
#endif   /* MOZ_SANDBOX */
#endif /* MOZ_SANDBOX && DEBUG */

  static void EnableTCSMIfAvailable();
  static bool IsTCSMAvailable();
@@ -65,7 +66,7 @@ class nsMacUtilsImpl final : public nsIMacUtils {
  // in our binary.
  nsString mBinaryArchs;

#if defined(MOZ_SANDBOX)
#if defined(MOZ_SANDBOX) || defined(__aarch64__)
  // Cache the appDir returned from GetAppPath to avoid doing I/O
  static StaticAutoPtr<nsCString> sCachedAppPath;
  // For thread safe setting/checking of sCachedAppPath