зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 02f4220a827c (bug 1746894) for causing mochitest failures on antitracking_head.js CLOSED TREE
This commit is contained in:
Родитель
93ee7434b2
Коммит
165dbe266b
|
@ -2697,33 +2697,14 @@ Result<uint64_t, nsresult> GetTemporaryStorageLimit(nsIFile& aStorageDir) {
|
|||
1024;
|
||||
}
|
||||
|
||||
constexpr int64_t teraByte = (1024u * 1024u * 1024u * 1024u);
|
||||
constexpr int64_t maxAllowedCapacity = 8 * teraByte;
|
||||
|
||||
// Check for disk capacity of user's device on which storage directory lives.
|
||||
int64_t diskCapacity = maxAllowedCapacity;
|
||||
|
||||
// Log error when default disk capacity is returned due to the error
|
||||
[&aStorageDir, &diskCapacity]() {
|
||||
QM_FAIL(aStorageDir.GetDiskCapacity(&diskCapacity));
|
||||
}();
|
||||
QM_TRY_INSPECT(const int64_t& diskCapacity,
|
||||
MOZ_TO_RESULT_INVOKE_MEMBER(aStorageDir, GetDiskCapacity));
|
||||
|
||||
MOZ_ASSERT(diskCapacity >= 0);
|
||||
|
||||
// Allow temporary storage to consume up to 50% of disk capacity.
|
||||
const int64_t regularCapacityLimit = diskCapacity / 2u;
|
||||
|
||||
// If the disk capacity reported by the operating system is very
|
||||
// large and potentially incorrect due to hardware issues,
|
||||
// a hardcoded limit is supplied instead.
|
||||
int64_t capacityLimit = maxAllowedCapacity;
|
||||
|
||||
[regularCapacityLimit, &capacityLimit]() {
|
||||
QM_TRY(OkIf(regularCapacityLimit >= maxAllowedCapacity), QM_VOID);
|
||||
capacityLimit = regularCapacityLimit;
|
||||
}();
|
||||
|
||||
return capacityLimit;
|
||||
return diskCapacity / 2u;
|
||||
}
|
||||
|
||||
bool IsOriginUnaccessed(const FullOriginMetadata& aFullOriginMetadata,
|
||||
|
|
|
@ -1492,11 +1492,14 @@ nsresult nsLocalFile::GetDiskInfo(StatInfoFunc&& aStatInfoFunc,
|
|||
|
||||
checkedResult = std::forward<StatInfoFunc>(aStatInfoFunc)(fs_buf);
|
||||
if (!checkedResult.isValid()) {
|
||||
return NS_ERROR_CANNOT_CONVERT_DATA;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// If we return an error, *aValue will not be modified.
|
||||
int64_t tentativeResult = checkedResult.value();
|
||||
*aResult = checkedResult.value();
|
||||
|
||||
# ifdef DEBUG_DISK_SPACE
|
||||
printf("DiskInfo: %lu bytes\n", *aResult);
|
||||
# endif
|
||||
|
||||
# if defined(USE_LINUX_QUOTACTL)
|
||||
|
||||
|
@ -1520,21 +1523,15 @@ nsresult nsLocalFile::GetDiskInfo(StatInfoFunc&& aStatInfoFunc,
|
|||
&& dq.dqb_bhardlimit) {
|
||||
checkedResult = std::forward<QuotaInfoFunc>(aQuotaInfoFunc)(dq);
|
||||
if (!checkedResult.isValid()) {
|
||||
return NS_ERROR_CANNOT_CONVERT_DATA;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (checkedResult.value() < tentativeResult) {
|
||||
tentativeResult = checkedResult.value();
|
||||
if (checkedResult.value() < *aResult) {
|
||||
*aResult = checkedResult.value();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef DEBUG_DISK_SPACE
|
||||
printf("DiskInfo: %lu bytes\n", tentativeResult);
|
||||
# endif
|
||||
|
||||
*aResult = tentativeResult;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
#else
|
||||
|
|
|
@ -2734,6 +2734,8 @@ nsLocalFile::GetDiskCapacity(int64_t* aDiskCapacity) {
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aDiskCapacity = 0;
|
||||
|
||||
nsresult rv = ResolveAndStat();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче