Bug 1380132 - Part 1 - Normalize() .app paths used in sandbox profiles. r=Alex_Gaynor draft
authorHaik Aftandilian <haftandilian@mozilla.com>
Tue, 11 Jul 2017 17:03:23 -0700
changeset 609172 5995030b43f49f9dca6911adb93b887fc7661b0e
parent 609171 e210d963bd419f3d2eb209bca86a0da057e325c5
child 609173 bd3882e8a1ecbc5cd4eb6fbe5b1cef0ca6cec458
child 609175 7d621a1dc7ced33a2c00e906970401e152a70189
push id68533
push userhaftandilian@mozilla.com
push dateFri, 14 Jul 2017 23:37:28 +0000
reviewersAlex_Gaynor
bugs1380132
milestone56.0a1
Bug 1380132 - Part 1 - Normalize() .app paths used in sandbox profiles. r=Alex_Gaynor MozReview-Commit-ID: GjQk5ahpzrj
dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1408,35 +1408,33 @@ GetAppPaths(nsCString &aAppPath, nsCStri
   // appDir points to .app/Contents/Resources, for our purposes we want
   // .app/Contents.
   nsCOMPtr<nsIFile> appDirParent;
   rv = appDir->GetParent(getter_AddRefs(appDirParent));
   if (NS_FAILED(rv)) {
     return false;
   }
 
-  bool isLink;
-  app->IsSymlink(&isLink);
-  if (isLink) {
-    app->GetNativeTarget(aAppPath);
-  } else {
-    app->GetNativePath(aAppPath);
+  rv = app->Normalize();
+  if (NS_FAILED(rv)) {
+    return false;
   }
-  appBinary->IsSymlink(&isLink);
-  if (isLink) {
-    appBinary->GetNativeTarget(aAppBinaryPath);
-  } else {
-    appBinary->GetNativePath(aAppBinaryPath);
+  app->GetNativePath(aAppPath);
+
+  rv = appBinary->Normalize();
+  if (NS_FAILED(rv)) {
+    return false;
   }
-  appDirParent->IsSymlink(&isLink);
-  if (isLink) {
-    appDirParent->GetNativeTarget(aAppDir);
-  } else {
-    appDirParent->GetNativePath(aAppDir);
+  appBinary->GetNativePath(aAppBinaryPath);
+
+  rv = appDirParent->Normalize();
+  if (NS_FAILED(rv)) {
+    return false;
   }
+  appDirParent->GetNativePath(aAppDir);
 
   return true;
 }
 
 // This function is only used in an |#ifdef DEBUG| path.
 #ifdef DEBUG
 // Given a path to a file, return the directory which contains it.
 static nsAutoCString