forked from mirrors/gecko-dev
Bug 1516333 - Part 1: Move group and origin re-escaping from QuotaManager::GetQuotaObject to GetQuotaObjectFromNameAndParameters in TelemetryVFS.cpp; r=janv,asuth
Differential Revision: https://phabricator.services.mozilla.com/D33769
This commit is contained in:
parent
6c53f1d280
commit
e8c9e6170c
2 changed files with 20 additions and 14 deletions
|
|
@ -3729,21 +3729,12 @@ already_AddRefed<QuotaObject> QuotaManager::GetQuotaObject(
|
||||||
fileSize = aFileSize;
|
fileSize = aFileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-escape our parameters above to make sure we get the right quota group.
|
|
||||||
nsAutoCString group;
|
|
||||||
rv = NS_EscapeURL(aGroup, esc_Query, group, fallible);
|
|
||||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
|
||||||
|
|
||||||
nsAutoCString origin;
|
|
||||||
rv = NS_EscapeURL(aOrigin, esc_Query, origin, fallible);
|
|
||||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
|
||||||
|
|
||||||
RefPtr<QuotaObject> result;
|
RefPtr<QuotaObject> result;
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mQuotaMutex);
|
MutexAutoLock lock(mQuotaMutex);
|
||||||
|
|
||||||
GroupInfoPair* pair;
|
GroupInfoPair* pair;
|
||||||
if (!mGroupInfoPairs.Get(group, &pair)) {
|
if (!mGroupInfoPairs.Get(aGroup, &pair)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3753,7 +3744,7 @@ already_AddRefed<QuotaObject> QuotaManager::GetQuotaObject(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<OriginInfo> originInfo = groupInfo->LockedGetOriginInfo(origin);
|
RefPtr<OriginInfo> originInfo = groupInfo->LockedGetOriginInfo(aOrigin);
|
||||||
|
|
||||||
if (!originInfo) {
|
if (!originInfo) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
#include "mozilla/dom/quota/QuotaObject.h"
|
#include "mozilla/dom/quota/QuotaObject.h"
|
||||||
#include "mozilla/net/IOActivityMonitor.h"
|
#include "mozilla/net/IOActivityMonitor.h"
|
||||||
#include "mozilla/IOInterposer.h"
|
#include "mozilla/IOInterposer.h"
|
||||||
|
#include "nsEscape.h"
|
||||||
|
|
||||||
// The last VFS version for which this file has been updated.
|
// The last VFS version for which this file has been updated.
|
||||||
#define LAST_KNOWN_VFS_VERSION 3
|
#define LAST_KNOWN_VFS_VERSION 3
|
||||||
|
|
@ -318,13 +319,27 @@ already_AddRefed<QuotaObject> GetQuotaObjectFromNameAndParameters(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-escape group and origin to make sure we get the right quota group and
|
||||||
|
// origin.
|
||||||
|
nsAutoCString escGroup;
|
||||||
|
nsresult rv =
|
||||||
|
NS_EscapeURL(nsDependentCString(group), esc_Query, escGroup, fallible);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsAutoCString escOrigin;
|
||||||
|
rv = NS_EscapeURL(nsDependentCString(origin), esc_Query, escOrigin, fallible);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
QuotaManager* quotaManager = QuotaManager::Get();
|
QuotaManager* quotaManager = QuotaManager::Get();
|
||||||
MOZ_ASSERT(quotaManager);
|
MOZ_ASSERT(quotaManager);
|
||||||
|
|
||||||
return quotaManager->GetQuotaObject(
|
return quotaManager->GetQuotaObject(
|
||||||
PersistenceTypeFromText(nsDependentCString(persistenceType)),
|
PersistenceTypeFromText(nsDependentCString(persistenceType)), escGroup,
|
||||||
nsDependentCString(group), nsDependentCString(origin),
|
escOrigin, NS_ConvertUTF8toUTF16(zName));
|
||||||
NS_ConvertUTF8toUTF16(zName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaybeEstablishQuotaControl(const char* zName, telemetry_file* pFile,
|
void MaybeEstablishQuotaControl(const char* zName, telemetry_file* pFile,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue