Bug 1236680 Part 2: Resolve GMP path for moved Users folder. r=cpearce
authorBob Owen <bobowencode@gmail.com>
Tue, 09 Feb 2016 15:22:43 +0000 (2016-02-09)
changeset 283599 5bf10cf78fafdb2da7211e128ae142da89dd248d
parent 283598 058a07de7cb6ba15b9e3fae648335e5aefab7f58
child 283600 e3509c59fb6adc0e89a33ccfaa414aa93ce1d4a4
push id71604
push userbobowencode@gmail.com
push dateTue, 09 Feb 2016 15:23:00 +0000 (2016-02-09)
treeherdermozilla-inbound@5bf10cf78faf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1236680
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1236680 Part 2: Resolve GMP path for moved Users folder. r=cpearce
dom/media/gmp/GMPProcessParent.cpp
--- a/dom/media/gmp/GMPProcessParent.cpp
+++ b/dom/media/gmp/GMPProcessParent.cpp
@@ -3,16 +3,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GMPProcessParent.h"
 #include "GMPUtils.h"
 #include "nsIFile.h"
 #include "nsIRunnable.h"
+#include "WinUtils.h"
 
 #include "base/string_util.h"
 #include "base/process_util.h"
 
 #include <string>
 
 using std::vector;
 using std::string;
@@ -50,24 +51,36 @@ GMPProcessParent::Launch(int32_t aTimeou
   if (!GetEMEVoucherPath(getter_AddRefs(path))) {
     NS_WARNING("GMPProcessParent can't get EME voucher path!");
     return false;
   }
   nsAutoCString voucherPath;
   path->GetNativePath(voucherPath);
 
   vector<string> args;
-  args.push_back(mGMPPath);
-  args.push_back(string(voucherPath.BeginReading(), voucherPath.EndReading()));
 
 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
   std::wstring wGMPPath = UTF8ToWide(mGMPPath.c_str());
+
+  // The sandbox doesn't allow file system rules where the paths contain
+  // symbolic links or junction points. Sometimes the Users folder has been
+  // moved to another drive using a junction point, so allow for this specific
+  // case. See bug 1236680 for details.
+  if (!widget::WinUtils::ResolveMovedUsersFolder(wGMPPath)) {
+    NS_WARNING("ResolveMovedUsersFolder failed for GMP path.");
+    return false;
+  }
   mAllowedFilesRead.push_back(wGMPPath + L"\\*");
+  args.push_back(WideToUTF8(wGMPPath));
+#else
+  args.push_back(mGMPPath);
 #endif
 
+  args.push_back(string(voucherPath.BeginReading(), voucherPath.EndReading()));
+
   return SyncLaunch(args, aTimeoutMs, base::GetCurrentProcessArchitecture());
 }
 
 void
 GMPProcessParent::Delete(nsCOMPtr<nsIRunnable> aCallback)
 {
   mDeletedCallback = aCallback;
   XRE_GetIOMessageLoop()->PostTask(FROM_HERE, NewRunnableMethod(this, &GMPProcessParent::DoDelete));