Bug 1288021: When we have a network GMP path fix the format for the sandbox rule.
MozReview-Commit-ID: BYMvKvwdFOK
--- 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());