Bug 1489796: On Windows resolve junction points and symlinks in the sys user extensions directories. r=jimm

This is needed because they are currently used in sandbox rules.
This commit is contained in:
Bob Owen 2018-12-13 09:08:40 +00:00
Родитель ce3978a4df
Коммит 6c8f34c9ac
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -1444,6 +1444,14 @@ nsresult nsXREDirProvider::GetSysUserExtensionsDirectory(nsIFile** aFile) {
rv = EnsureDirectoryExists(localDir);
NS_ENSURE_SUCCESS(rv, rv);
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
// This is used in sandbox rules, so we need to make sure it doesn't contain
// any junction points or symlinks or the sandbox will reject those rules.
if (!mozilla::widget::WinUtils::ResolveJunctionPointsAndSymLinks(localDir)) {
NS_WARNING("Failed to resolve sys user extensions directory.");
}
#endif
localDir.forget(aFile);
return NS_OK;
}
@ -1459,6 +1467,14 @@ nsresult nsXREDirProvider::GetSysUserExtensionsDevDirectory(nsIFile** aFile) {
rv = EnsureDirectoryExists(localDir);
NS_ENSURE_SUCCESS(rv, rv);
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
// This is used in sandbox rules, so we need to make sure it doesn't contain
// any junction points or symlinks or the sandbox will reject those rules.
if (!mozilla::widget::WinUtils::ResolveJunctionPointsAndSymLinks(localDir)) {
NS_WARNING("Failed to resolve sys user extensions dev directory.");
}
#endif
localDir.forget(aFile);
return NS_OK;
}