зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1642951
- Don't open the underlying file unnecessarily when seeking nsFileInputStream to the start. r=baku,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D91088
This commit is contained in:
Родитель
413b79889f
Коммит
e0be63cf32
|
@ -522,6 +522,12 @@ nsresult nsFileInputStream::SeekInternal(int32_t aWhence, int64_t aOffset,
|
|||
aWhence = NS_SEEK_SET;
|
||||
aOffset += mCachedPosition;
|
||||
}
|
||||
// If we're trying to seek to the start then we're done, so
|
||||
// return early to avoid Seek from calling DoPendingOpen and
|
||||
// opening the underlying file earlier than necessary.
|
||||
if (aWhence == NS_SEEK_SET && aOffset == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче