Bug 1288021: When we have a network GMP path fix the format for the sandbox rule. r=cpearce, a=gchang
authorBob Owen <bobowencode@gmail.com>
Wed, 20 Jul 2016 09:20:30 +0100
changeset 340205 d9a53fa8d1a0ddc0570437c20f2e405df478551a
parent 340204 781e498746664fbff97f752ba37065f98eded8c2
child 340206 cbfe955606066c5c018db47027ddb995323b3eed
push id6262
push usercbook@mozilla.com
push dateWed, 03 Aug 2016 14:46:51 +0000
treeherdermozilla-beta@c40e04bf9297 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, gchang
bugs1288021
milestone49.0
Bug 1288021: When we have a network GMP path fix the format for the sandbox rule. r=cpearce, a=gchang MozReview-Commit-ID: BYMvKvwdFOK
dom/media/gmp/GMPProcessParent.cpp
--- a/dom/media/gmp/GMPProcessParent.cpp
+++ b/dom/media/gmp/GMPProcessParent.cpp
@@ -58,17 +58,30 @@ GMPProcessParent::Launch(int32_t aTimeou
   // 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"\\*");
+
+  // If the GMP path is a network path that is not mapped to a drive letter,
+  // then we need to fix the path format for the sandbox rule.
+  wchar_t volPath[MAX_PATH];
+  if (::GetVolumePathNameW(wGMPPath.c_str(), volPath, MAX_PATH) &&
+      ::GetDriveTypeW(volPath) == DRIVE_REMOTE &&
+      wGMPPath.compare(0, 2, L"\\\\") == 0) {
+    std::wstring sandboxGMPPath(wGMPPath);
+    sandboxGMPPath.insert(1, L"??\\UNC");
+    mAllowedFilesRead.push_back(sandboxGMPPath + L"\\*");
+  } else {
+    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());