gecko-dev/xpcom/io
Andrea Marchesini 4ebf5b4364 Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj
In the current code there are 3 main issues:

1. nsFileStream is not really thread-safe. There is nothing to protect the
internal members and we see crashes.

2. nsPipeInputStream doesn't implement ::Seek() method and that caused issues
in devtools when a nsHttpChannel sends POST data using a pipe. In order to fix
this, bug 1494176 added a check in nsHttpChannel: if the stream doesn't
implement ::Seek(), let's clone it. This was an hack around nsPipeInputStream,
and it's bad.

3. When nsHttpChannel sends POST data using a file stream, nsFileStream does
I/O on main-thread because of the issue 2. Plus, ::Seek() is called on the
main-thread causing issue 1.

Note that nsPipeInputStream implements only ::Tell(), of the nsISeekableStream
methods. It doesn't implement ::Seek() and it doesn't implement ::SetEOF().

With this patch I want to fix point 2 and point 3 (and consequentially issue 1
- but we need a separate fix for it - follow up). The patch does:

1. it splits nsISeekableStream in 2 interfaces: nsITellableStream and
nsISeekableStream.
2. nsPipeInputStream implements only nsITellableStream.  Doing this, we don't
need the ::Seek() check for point 2 in nsHttpChannel: a simple QI check is
enough.
3. Because we don't call ::Seek() in nsHttpChannel, nsFileStream doesn't do I/O
on the main-thread, and we don't crash doing so.
2018-10-18 13:35:35 +02:00
..
Base64.cpp Bug 1488186 - Avoid writing past the logical length of a string in Base64URLEncode. r=froydnj 2018-09-04 18:24:52 +00:00
Base64.h
CocoaFileUtils.h Bug 1355346 - Call nsCocoaFileUtils::AddOriginMetadataToFile off of the main-thread when completing downloads. r=mstange 2018-08-17 19:07:51 -04:00
CocoaFileUtils.mm Bug 1355346 - Call nsCocoaFileUtils::AddOriginMetadataToFile off of the main-thread when completing downloads. r=mstange 2018-08-17 19:07:51 -04:00
FileDescriptorFile.cpp Bug 1462483: Part 1 - Explicitly return a nsIDirectoryEnumerator from nsIFile::GetDirectoryEntries. r=froydnj 2018-05-17 15:06:48 -07:00
FileDescriptorFile.h
FilePreferences.cpp Bug 1412081 - Add ability to blacklist file paths on Unix platforms r=mayhemer 2018-06-20 02:52:12 +02:00
FilePreferences.h Bug 1412081 - Add ability to blacklist file paths on Unix platforms r=mayhemer 2018-06-20 02:52:12 +02:00
FileUtilsWin.cpp Bug 1462784 - Relabel various other stuff as being OTHER. r=njn 2018-05-18 17:58:43 -04:00
FileUtilsWin.h Bug 1488452 - Remove incorrect use of PromiseFlatString in FileUtilsWin. r=froydnj 2018-09-07 14:48:36 +00:00
InputStreamLengthHelper.cpp Bug 1466101 - Fix a debug-only variable use in InputStreamLengthHelper, r=mayhemer 2018-06-05 23:19:00 +02:00
InputStreamLengthHelper.h Bug 1464090 - InputStreamLengthHelper must swap the callback in order to release them on the owning thread, r=mayhemer 2018-05-31 18:12:25 +02:00
InputStreamLengthWrapper.cpp Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
InputStreamLengthWrapper.h Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
NonBlockingAsyncInputStream.cpp Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
NonBlockingAsyncInputStream.h Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
SlicedInputStream.cpp Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
SlicedInputStream.h Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
SnappyCompressOutputStream.cpp
SnappyCompressOutputStream.h
SnappyFrameUtils.cpp
SnappyFrameUtils.h
SnappyUncompressInputStream.cpp
SnappyUncompressInputStream.h
SpecialSystemDirectory.cpp Bug 1471278 - Restore GetSpecialSystemDirectory() for Win_Documents when compiling Thunderbird. r=froydnj 2018-06-26 13:41:00 +03:00
SpecialSystemDirectory.h Bug 1471278 - Restore GetSpecialSystemDirectory() for Win_Documents when compiling Thunderbird. r=froydnj 2018-06-26 13:41:00 +03:00
crc32c.c
crc32c.h
moz.build Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsAnonymousTemporaryFile.cpp Bug 1434911 - when creating temporary files, don't set the executable bit; r=froydnj 2018-02-01 09:52:01 -05:00
nsAnonymousTemporaryFile.h
nsAppDirectoryServiceDefs.h Bug 1488439: Part 1 - Replace Windows temp folder in sandboxed plugin process (r=bobowen,erahm) 2018-10-12 22:36:22 +00:00
nsAppFileLocationProvider.cpp Bug 1484496: Part 4b - Add intrinsic type information to most nsSimpleEnumerators. r=froydnj 2018-08-18 21:06:32 -07:00
nsAppFileLocationProvider.h
nsBinaryStream.cpp Bug 1492204 - Part 1: Stop using deprecated string writing iterators. r=froydnj 2018-09-18 09:44:57 -07:00
nsBinaryStream.h
nsDirectoryService.cpp Bug 1486182: Follow-up: Fix straggler nsIUTF8StringEnumerator references. r=bustage CLOSED TREE 2018-08-28 14:29:16 -07:00
nsDirectoryService.h Bug 1482782 - Part 2: Move directory service atoms into nsGkAtoms. r=njn 2018-08-15 15:46:00 +10:00
nsDirectoryServiceDefs.h Bug 1482782 - Part 2: Move directory service atoms into nsGkAtoms. r=njn 2018-08-15 15:46:00 +10:00
nsDirectoryServiceUtils.h
nsEscape.cpp Bug 1460233 - Percent-encode ampersand and colon when replacing unmappable code points in URL query state. r=valentin 2018-10-16 12:04:12 +00:00
nsEscape.h Bug 1460233 - Percent-encode ampersand and colon when replacing unmappable code points in URL query state. r=valentin 2018-10-16 12:04:12 +00:00
nsIAsyncInputStream.idl
nsIAsyncOutputStream.idl
nsIBinaryInputStream.idl
nsIBinaryOutputStream.idl Bug 1363925: Part 3 - Move more install logic from XPIProvider to XPIInstall. r=aswan 2018-04-21 18:29:33 -07:00
nsICloneableInputStream.idl
nsIConverterInputStream.idl Bug 1445692 - Remove UTF8InputStream. r=froydnj 2018-03-14 20:53:18 +02:00
nsIConverterOutputStream.idl
nsIDirectoryEnumerator.idl Bug 1462483: Part 1 - Explicitly return a nsIDirectoryEnumerator from nsIFile::GetDirectoryEntries. r=froydnj 2018-05-17 15:06:48 -07:00
nsIDirectoryService.idl
nsIFile.idl Bug 1486311 - convert remaining nsIFile::GetDirectoryEntries() callers to pass in a nsIDirectoryEnumerator. r=kmag 2018-08-26 14:15:00 +03:00
nsIIOUtil.idl
nsIInputStream.idl
nsIInputStreamLength.idl Bug 1434553 - Implement nsIInputStreamLength and nsIAsyncInputStreamLength - part 1 - IDL, r=mayhemer, r=froydnj, r=smaug 2018-05-23 07:12:34 +02:00
nsIInputStreamTee.idl
nsILineInputStream.idl
nsILocalFileMac.idl
nsILocalFileWin.idl Bug 1433265 - Remove ShortcutResolver from nsLocalFileWin.cpp. r=froydnj 2018-01-31 20:56:17 +09:00
nsIMultiplexInputStream.idl Bug 1426888 - Get rid of nsIMultiplexInputStream::RemoveStream, r=smaug 2017-12-30 12:47:12 +01:00
nsIOUtil.cpp
nsIOUtil.h
nsIObjectInputStream.idl
nsIObjectOutputStream.idl
nsIOutputStream.idl
nsIPipe.idl
nsISafeOutputStream.idl
nsIScriptableBase64Encoder.idl
nsIScriptableInputStream.idl
nsISeekableStream.idl Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsIStorageStream.idl
nsIStreamBufferAccess.idl
nsIStringStream.idl
nsITellableStream.idl Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsIUnicharInputStream.idl
nsIUnicharLineInputStream.idl
nsIUnicharOutputStream.idl
nsInputStreamTee.cpp Bug 1453795 - XPCOM - Initialize member fields in classes/ structures. r=froydnj 2018-06-15 14:41:20 +03:00
nsLinebreakConverter.cpp Bug 1492204 - Part 3: Remove references to char_iterator. r=froydnj 2018-09-18 12:05:23 -07:00
nsLinebreakConverter.h
nsLocalFile.h Bug 1433265 - Remove ShortcutResolver from nsLocalFileWin.cpp. r=froydnj 2018-01-31 20:56:17 +09:00
nsLocalFileCommon.cpp Bug 1492272 - Get rid of Begin/EndWriting(iterator&) string functions. r=froydnj 2018-09-18 13:35:09 -07:00
nsLocalFileUnix.cpp Bug 1484496: Part 4b - Add intrinsic type information to most nsSimpleEnumerators. r=froydnj 2018-08-18 21:06:32 -07:00
nsLocalFileUnix.h Bug 1433265 - Remove ShortcutResolver from nsLocalFileWin.cpp. r=froydnj 2018-01-31 20:56:17 +09:00
nsLocalFileWin.cpp Bug 1498586 - Add clang-format off to avoid the reformatting of the data structures r=Ehsan 2018-10-12 20:48:24 +00:00
nsLocalFileWin.h Bug 1433265 - Remove ShortcutResolver from nsLocalFileWin.cpp. r=froydnj 2018-01-31 20:56:17 +09:00
nsMultiplexInputStream.cpp Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsMultiplexInputStream.h
nsNativeCharsetUtils.cpp Bug 1492204 - Part 1: Stop using deprecated string writing iterators. r=froydnj 2018-09-18 09:44:57 -07:00
nsNativeCharsetUtils.h
nsPipe.h
nsPipe3.cpp Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsScriptableBase64Encoder.cpp
nsScriptableBase64Encoder.h
nsScriptableInputStream.cpp
nsScriptableInputStream.h
nsSegmentedBuffer.cpp Bug 1486690 - Remove unnecessary checks after moz_xrealloc() calls. r=glandium 2018-08-28 15:56:23 +10:00
nsSegmentedBuffer.h Bug 1486528 - Remove some unnecessary nsIMemory imports. r=njn 2018-08-27 16:38:18 +02:00
nsStorageStream.cpp Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsStorageStream.h
nsStreamUtils.cpp Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj 2018-06-17 22:43:11 -07:00
nsStreamUtils.h Bug 1405974 - NonBlockingAsyncInputStream must take the ownership of the underlying stream, r=qdot 2018-01-31 16:45:20 +01:00
nsStringStream.cpp Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsStringStream.h Bug 1496581 - Split nsISeekableStream in 2 classes: nsISeekableStream and nsITellableStream, f=mayhemer, r=froydnj 2018-10-18 13:35:35 +02:00
nsUnicharInputStream.cpp Bug 1445692 - Remove UTF8InputStream. r=froydnj 2018-03-14 20:53:18 +02:00
nsUnicharInputStream.h
nsWildCard.cpp Bug 1486690 - Remove unnecessary checks after moz_xmalloc() calls. r=glandium 2018-08-28 15:56:01 +10:00
nsWildCard.h