Bug 625060: Only plugin-container needs to walk out of plugin-container.app/Content/MacOS to find the real GRE dir. r=bent
authorChris Jones <jones.chris.g@gmail.com>
Tue, 01 Feb 2011 13:53:53 -0600
changeset 61746 6ad50f1f840f29101912bbcc26ae61377726c415
parent 61745 c41670743f353b8018d201b0c2daa9a7e710954b
child 61747 4ef52d80176f648c6951cd32f4ed31463cad0c79
push idunknown
push userunknown
push dateunknown
reviewersbent
bugs625060
milestone2.0b11pre
Bug 625060: Only plugin-container needs to walk out of plugin-container.app/Content/MacOS to find the real GRE dir. r=bent
ipc/glue/ScopedXREEmbed.cpp
--- a/ipc/glue/ScopedXREEmbed.cpp
+++ b/ipc/glue/ScopedXREEmbed.cpp
@@ -82,36 +82,40 @@ ScopedXREEmbed::Start()
   rv = localFile->GetParent(getter_AddRefs(parent));
   if (NS_FAILED(rv))
     return;
 
   localFile = do_QueryInterface(parent);
   NS_ENSURE_TRUE(localFile,);
 
 #ifdef OS_MACOSX
-  rv = localFile->GetParent(getter_AddRefs(parent));
-  if (NS_FAILED(rv))
-    return;
+  if (XRE_GetProcessType() == GeckoProcessType_Content) {
+    // We're an XPCOM-using subprocess.  Walk out of
+    // [subprocess].app/Contents/MacOS to the real GRE dir.
+    rv = localFile->GetParent(getter_AddRefs(parent));
+    if (NS_FAILED(rv))
+      return;
 
-  localFile = do_QueryInterface(parent);
-  NS_ENSURE_TRUE(localFile,);
+    localFile = do_QueryInterface(parent);
+    NS_ENSURE_TRUE(localFile,);
 
-  rv = localFile->GetParent(getter_AddRefs(parent));
-  if (NS_FAILED(rv))
-    return;
+    rv = localFile->GetParent(getter_AddRefs(parent));
+    if (NS_FAILED(rv))
+      return;
 
-  localFile = do_QueryInterface(parent);
-  NS_ENSURE_TRUE(localFile,);
+    localFile = do_QueryInterface(parent);
+    NS_ENSURE_TRUE(localFile,);
 
-  rv = localFile->GetParent(getter_AddRefs(parent));
-  if (NS_FAILED(rv))
-    return;
+    rv = localFile->GetParent(getter_AddRefs(parent));
+    if (NS_FAILED(rv))
+      return;
 
-  localFile = do_QueryInterface(parent);
-  NS_ENSURE_TRUE(localFile,);
+    localFile = do_QueryInterface(parent);
+    NS_ENSURE_TRUE(localFile,);
+  }
 #endif
 
   rv = XRE_InitEmbedding2(localFile, localFile, nsnull);
   if (NS_FAILED(rv))
     return;
 
   mShouldKillEmbedding = true;
 }