Bug 1777931 - Add a few diagnostic asserts to the sub-resource cache. r=dholbert,layout-reviewers

The only thing that could trigger this is a bogus key, or overriding an
already-loading stylesheet which we didn't correctly coalesce.

Either of those is a bug.

Differential Revision: https://phabricator.services.mozilla.com/D154915
This commit is contained in:
Emilio Cobos Álvarez 2022-08-17 18:13:25 +00:00
Родитель 4eb9d04769
Коммит d3d0814758
1 изменённых файлов: 3 добавлений и 2 удалений

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

@ -458,8 +458,9 @@ size_t SharedSubResourceCache<Traits, Derived>::SizeOfIncludingThis(
template <typename Traits, typename Derived>
void SharedSubResourceCache<Traits, Derived>::LoadStarted(
const Key& aKey, LoadingValue& aValue) {
MOZ_ASSERT(!aValue.mIsLoading, "Already loading? How?");
MOZ_ASSERT(KeyFromLoadingValue(aValue).KeyEquals(aKey));
MOZ_DIAGNOSTIC_ASSERT(!aValue.mIsLoading, "Already loading? How?");
MOZ_DIAGNOSTIC_ASSERT(KeyFromLoadingValue(aValue).KeyEquals(aKey));
MOZ_DIAGNOSTIC_ASSERT(!mLoading.Contains(aKey), "Load not coalesced?");
aValue.mIsLoading = true;
mLoading.InsertOrUpdate(aKey, &aValue);
}