Bug 1729545, Try to ensure session history loads can't get stuck because of bogus requested index, r=peterv

Requested index handling is very fragile. We should try to figure out a way to remove it altogether.
(But unfortunately some behavior similar to it is needed in certain cases).
The patch is a stop-gap solution.

Differential Revision: https://phabricator.services.mozilla.com/D137479
This commit is contained in:
Olli Pettay 2022-02-01 20:30:32 +00:00
Родитель 2d296e8968
Коммит a959481f5a
1 изменённых файлов: 5 добавлений и 1 удалений

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

@ -2047,7 +2047,11 @@ nsresult nsSHistory::LoadEntry(int32_t aIndex, long aLoadType,
if (aIndex < 0 || aIndex >= Length()) {
MOZ_LOG(gSHistoryLog, LogLevel::Debug, ("Index out of range"));
// The index is out of range
// The index is out of range.
// Clear the requested index in case it had bogus value. This way the next
// load succeeds if the offset is reasonable.
mRequestedIndex = -1;
return NS_ERROR_FAILURE;
}