Bug 1642951 - Don't fill the nsBufferedStream buffer when seeking to 0, to avoid opening lazy inner streams. r=baku,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D91362
This commit is contained in:
Matt Woodrow 2020-10-09 04:38:10 +00:00
Родитель 6a589167f0
Коммит d54cb42cc5
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -224,6 +224,13 @@ nsBufferedStream::Seek(int32_t whence, int64_t offset) {
.mNewOffset = mBufferStartOffset);
mFillPoint = mCursor = 0;
// If we seeked back to the start, then don't fill the buffer
// right now in case this is a lazily-opened file stream.
// We'll fill on the first read, like we did initially.
if (whence == nsISeekableStream::NS_SEEK_SET && offset == 0) {
return NS_OK;
}
return Fill();
}