Граф коммитов

2945 Коммитов

Автор SHA1 Сообщение Дата
Florian Quèze 7e2521c727 Bug 1729285 - Observers used with NS_NewTimerWithObserver should implement nsINamed, r=smaug.
Differential Revision: https://phabricator.services.mozilla.com/D124619
2021-09-07 08:01:19 +00:00
Jari Jalkanen 53e46875cf Bug 1690326 - Map Windows local file error 0x7B ERROR_INVALID_NAME to NS_ERROR_FILE_INVALID_PATH, r=xpcom-reviewers,dom-storage-reviewers,nika,jstutte
Differential Revision: https://phabricator.services.mozilla.com/D123181
2021-08-25 18:59:54 +00:00
Ava Katushka ava8katushka 6cc1c2c5b3 Bug 1726732 Returning the code solving filename disclosure in tmp dir. r=emk,mtigley
Differential Revision: https://phabricator.services.mozilla.com/D123219
2021-08-25 14:50:22 +00:00
Andi-Bogdan Postelnicu 2fc4f70e9b Bug 1725145 - Preparation for the hybrid build env. r=necko-reviewers,firefox-build-system-reviewers,valentin,glandium
Automatically generated path that adds flag `REQUIRES_UNIFIED_BUILD = True` to `moz.build`
when the module governed by the build config file is not buildable outside on the unified environment.

This needs to be done in order to have a hybrid build system that adds the possibility of combing
unified build components with ones that are built outside of the unified eco system.

Differential Revision: https://phabricator.services.mozilla.com/D122345
2021-08-25 10:46:17 +00:00
Haik Aftandilian a86c654e4d Bug 1722758 - Patch 3 - Change netCharType to be an unsigned char array instead of int to save space r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D122652
2021-08-20 18:54:03 +00:00
Haik Aftandilian 6e49780b6e Bug 1722758 - Patch 2 - Add a new encoding mode to be used for Apple NSURL compatibility r=necko-reviewers,valentin
Add a new encoding mode to be used to encode an already-encoded URL to be compatible with Apple's NSURL.

Add a function for creating an nsIURI with NSURL compatible encoding from a URL string.

Differential Revision: https://phabricator.services.mozilla.com/D122651
2021-08-20 18:54:03 +00:00
Haik Aftandilian 1ce57f2a3e Bug 1722758 - Patch 1 - Reformat the encoding table r=necko-reviewers,valentin
Rearrange and reformat the encoding table to make space for two digit entries needed for an additional encoding enum.

Convert entries to hex.

Differential Revision: https://phabricator.services.mozilla.com/D122650
2021-08-20 18:54:02 +00:00
Mike Hommey 4a315c973f Bug 1723445 - Use MOZ_ANDROID_LIBDIR in BinaryPath::Get instead of GRE_HOME. r=nika
The use of GRE_HOME was cargo-culted well back when, and doesn't reflect
the reality of where the executables and libraries are on Android.
Libxul and its dependent libraries are actually loaded from
MOZ_ANDROID_LIBDIR, set from the Java side, and used in APKOpen.cpp,
matching reality more closely.

Unfortunately, this opens a whole can of worms, because some things
that indirectly rely on the fallback code path in
nsDirectoryService::GetCurrentProcessDirectory make assumptions that
don't hold with the directory containing the libraries on Android. So
they currently work with GRE_HOME, but fail with MOZ_ANDROID_LIBDIR.

We thus keep the nsDirectoryService::GetCurrentProcessDirectory callback
on GRE_HOME.

Differential Revision: https://phabricator.services.mozilla.com/D122323
2021-08-13 00:27:02 +00:00
Nicklas Boman cd8acaa740 Bug 1308105 - Replace PL_strpbrk with strpbrk r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D116933
2021-08-10 11:30:39 +00:00
Gijs Kruitbosch bcbf4ea5cd Bug 1714583 - allow nsIFile::Create to skip creating ancestor directories, to fix IOUtils::makeDirectory, to fix UNC default download folders, r=barret,xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D120338
2021-07-21 18:38:12 +00:00
Jens Stutte 50a5a1110d Bug 1709887: Add missing #define in mingw builds. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D114569
2021-05-07 14:02:26 +00:00
Jens Stutte f2f68509d3 Bug 1690326: Add mappings for ERROR_DEVICE_HARDWARE_ERROR, ERROR_DEVICE_NOT_CONNECTED, ERROR_DISK_FULL and remove error NS_ERROR_FILE_DISK_FULL in favor of existing NS_ERROR_FILE_NO_DEVICE_SPACE r=xpcom-reviewers,necko-reviewers,nika,valentin
Win32 errors ERROR_DEVICE_HARDWARE_ERROR, ERROR_DEVICE_NOT_CONNECTED, ERROR_DISK_FULL need a mapping.
NS_ERROR_FILE_DISK_FULL is duplicate to NS_ERROR_FILE_NO_DEVICE_SPACE
Drive by: RejectJSPromise lacked some NS_ERROR_* mappings

Differential Revision: https://phabricator.services.mozilla.com/D113974
2021-05-06 14:00:06 +00:00
Jens Stutte daaba5a9c6 Bug 1690326: Map Windows error 0x45D ERROR_IO_DEVICE to NS_ERROR_FILE_DEVICE_FAILURE r=janv,xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D112050
2021-04-14 17:29:39 +00:00
David Parks d06598d3f3 Bug 1682030 - Remove Windows NPAPI plugin proccess sandbox r=bobowen
Removes Windows NPAPI process sandboxing code, including the code to establish a viable temp directory that was accessible by the sandboxed process.

Differential Revision: https://phabricator.services.mozilla.com/D108688
2021-04-06 19:28:19 +00:00
RJ Johnson 351f2b0332 Bug 1697721 - Have nsLocalFile::CreateAllAncestors make each path component. r=xpcom-reviewers,kmag
Some systems hide path components. Determine access by creating the whole path.

Differential Revision: https://phabricator.services.mozilla.com/D107970
2021-04-06 11:49:24 +00:00
Csoregi Natalia d68661e2cc Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMonitor.cpp and nsCOMPtr.h. CLOSED TREE
Backed out changeset 5b1644096477 (bug 1682030)
Backed out changeset 35ae60eea3c7 (bug 1682030)
Backed out changeset 3eca76a6d639 (bug 1682030)
Backed out changeset 259c45447ad9 (bug 1682030)
Backed out changeset de9222dc8c31 (bug 1682030)
Backed out changeset 2986c7e14349 (bug 1682030)
Backed out changeset 6af3410bdb93 (bug 1682030)
Backed out changeset 42b0621c2927 (bug 1682030)
Backed out changeset 366e3e371858 (bug 1682030)
Backed out changeset 9adb2865adea (bug 1682030)
Backed out changeset 6af6af3bc03a (bug 1682030)
Backed out changeset da94a91b35ae (bug 1682030)
Backed out changeset 9143da258d0e (bug 1682030)
Backed out changeset 5e20d06952ba (bug 1682030)
Backed out changeset 6253d7e1ce7d (bug 1682030)
Backed out changeset 0e06ddeea3e2 (bug 1682030)
Backed out changeset 9c58d57c9e44 (bug 1682030)
Backed out changeset e90edd89430e (bug 1682030)
Backed out changeset 5861b8166b10 (bug 1682030)
Backed out changeset b4b88cdc7993 (bug 1682030)
Backed out changeset b80054e9805c (bug 1682030)
Backed out changeset 580d857674c0 (bug 1682030)
Backed out changeset a9cdf93c2662 (bug 1682030)
Backed out changeset 9c9c8b4998e2 (bug 1682030)
2021-04-06 03:54:12 +03:00
David Parks 4e9ed60079 Bug 1682030 - Remove Windows NPAPI plugin proccess sandbox r=bobowen
Removes Windows NPAPI process sandboxing code, including the code to establish a viable temp directory that was accessible by the sandboxed process.

Differential Revision: https://phabricator.services.mozilla.com/D108688
2021-04-05 23:48:43 +00:00
Simon Giesecke a598a0c7c5 Bug 1679522 - Use <> style for including windows system headers. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D98895
2021-03-25 10:19:44 +00:00
Jens Stutte 8560eb86e8 Bug 1690326: Map Windows error 0x570 ERROR_FILE_CORRUPT to NS_ERROR_FILE_FS_CORRUPTED r=xpcom-reviewers,janv,nika
While NS_ERROR_FILE_CORRUPTED already exists, it indicates most of the times more a parsing problem of a given file format.
But Windows ERROR_FILE_CORRUPTED signals a malfunctioning or corrupted file system at OS level, thus we translate it to the new
NS_ERROR_FILE_FS_CORRUPTED.

There seems to be no suitable errno under POSIX to map here.

Differential Revision: https://phabricator.services.mozilla.com/D108793
2021-03-23 10:29:02 +00:00
Markus Stange a25fa13fd4 Bug 1697964 - Remove GetQuarantinePropKey(). r=mac-reviewers,tnikkel
GetQuarantinePropKey() used to contain a version check for pre-10.10, which
was removed in bug 1673051.

Depends on D108134

Differential Revision: https://phabricator.services.mozilla.com/D108135
2021-03-12 01:46:24 +00:00
Mike Hommey a17a4d839f Bug 1693462 - Avoid quarantine attribute being set when using nsILocalFile.copyTo* on macOS. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D107949
2021-03-11 21:42:04 +00:00
Markus Stange 87d7d79487 Bug 1697343 - Remove code that was needed to support building with pre-10.12 SDKs. r=mac-reviewers,bradwerth
I skipped anything in third-party libraries. There's also one instance in plugin code but it'll be removed as part of the plugin removal effort.

Differential Revision: https://phabricator.services.mozilla.com/D107760
2021-03-11 02:46:23 +00:00
Agi Sferro eac41f1807 Bug 1694481 - Remove unused methods in GeckoAppShell. r=aklotz
Differential Revision: https://phabricator.services.mozilla.com/D106183
2021-03-10 22:43:08 +00:00
Alexis Beingessner 92afde7986 Bug 1686616 - register all Services.py services with components.conf. r=kmag,necko-reviewers,valentin
These services had their name added to components.conf:

* GfxInfo
* ThirdPartyUtil
* History
* HttpActivityDistributor
* UUIDGenerator
* ServiceWorkerManager
* PermissionManager

These services were added to componenets.conf under a different name:

* DirectoryService => Directory
* IOService => IO
* StringBundleService => StringBundle
* CacheStorageService => CacheStorage
* StreamTransportService => StreamTransport
* SocketTransportService => SocketTransport

These services weren't migrated to components.conf because only Rust
code uses them:

* RemoteAgent
* XULRuntime
* PrefService

These services weren't migrated to components.conf because they're unused:

* ToolkitChromeRegistry (used as ChromeRegistry)
* XULChromeRegistry (used as ChromeRegistry)
* Bits (completely unused)

These services were already available in components.conf but are still
used by rust code:

* URIFixup

These services weren't migrated because they will be handled in
subsequent patchsets:

* ObserverService

For the record, the following Services are being used by Rust code
and must remain until a Rust version of Components.h is written:

* RemoteAgent
* XULRuntime
* PrefService
* URIFixup
* ObserverService
* DirectoryService
* ThirdPartyUtil

Also the cocoa GfxInfo service was changed to use components.conf instead
of registering it at runtime, as all the other widgets were already doing
it this way.

Differential Revision: https://phabricator.services.mozilla.com/D105521
2021-02-18 13:26:28 +00:00
Markus Stange 56051da2d0 Bug 1692391 - Replace the NS_OBJC_BEGIN/END_TRY_ABORT_BLOCK_NSRESULT macros with the functionally identical NS_OBJC_BEGIN/END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE). r=haik
This patch was generated with the commands:

```
rg -l 'NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT' . | xargs sed -i '' -e 's/NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT/NS_OBJC_BEGIN_TRY_BLOCK_RETURN/g'
rg -l 'NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT' . | xargs sed -i '' -e 's/NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT/NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE)/g'
```

Differential Revision: https://phabricator.services.mozilla.com/D104957
2021-02-16 22:55:20 +00:00
Gerald Squelart 2416d881e2 Bug 1691589 - Reduce reliance on GeckoProfiler.h when only labels (and maybe markers) are needed - r=necko-reviewers,geckoview-reviewers,sg,agi,florian
There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".

Differential Revision: https://phabricator.services.mozilla.com/D104588
2021-02-16 04:44:19 +00:00
Jan de Mooij c4b59c1ae8 Bug 1674777 part 7 - Change nsIBinaryInputStream.readArrayBuffer to use uint64_t instead of uint32_t. r=kmag
We're adding support for ArrayBuffers larger than 4 GB to the JS engine (on 64-bit
platforms).

ReadArrayBuffer uses uint32_t values in a number of places. This patch changes them
to uint64_t where necessary. Values related to the temporary buffer stay uint32_t because
that buffer is <= 4096 bytes.

Differential Revision: https://phabricator.services.mozilla.com/D103759
2021-02-10 08:30:05 +00:00
Simon Giesecke 8730386ad9 Bug 1688833 - Migrate LookupForAdd to WithEntryHandle in xpcom. r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D104195
2021-02-09 18:19:37 +00:00
Nika Layzell 6adb3968d9 Bug 1681529 - Part 8: Handle clones of closed nsPipeInputStreams, r=baku
Previously if `Clone()` was called on a closed nsPipeInputStream, it could cause
crashes due to the already-closed nsPipeInputStream being added to mInputList,
violating internal nsPipe invariants. Skipping adding the stream to that list
should avoid this edge-case, as the pipe is already closed.

Differential Revision: https://phabricator.services.mozilla.com/D101807
2021-02-04 18:13:14 +00:00
Nika Layzell 82b549eebb Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-02-04 18:13:09 +00:00
Simon Giesecke 989362a57a Bug 1690234 - Treat ERROR_FILE_CORRUPT errors like non-existent files in GetDirEntryKind. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D103762
2021-02-04 12:14:45 +00:00
Bogdan Tara abc7c8eeee Backed out 11 changesets (bug 1681529) for talos crashes CLOSED TREE
Backed out changeset c87d0f32d7a6 (bug 1681529)
Backed out changeset b1269f35d525 (bug 1681529)
Backed out changeset 29df8d4c984a (bug 1681529)
Backed out changeset 4def7578ced0 (bug 1681529)
Backed out changeset ce57c5a26c25 (bug 1681529)
Backed out changeset 78b186ec645a (bug 1681529)
Backed out changeset b1d1550a66ca (bug 1681529)
Backed out changeset e8620622208a (bug 1681529)
Backed out changeset 636b1a7c13e4 (bug 1681529)
Backed out changeset a5a8eac68b87 (bug 1681529)
Backed out changeset 968e17db71df (bug 1681529)
2021-02-03 09:29:38 +02:00
Nika Layzell e2dd8925e7 Bug 1681529 - Part 8: Handle clones of closed nsPipeInputStreams, r=baku
Previously if `Clone()` was called on a closed nsPipeInputStream, it could cause
crashes due to the already-closed nsPipeInputStream being added to mInputList,
violating internal nsPipe invariants. Skipping adding the stream to that list
should avoid this edge-case, as the pipe is already closed.

Differential Revision: https://phabricator.services.mozilla.com/D101807
2021-02-02 23:26:38 +00:00
Nika Layzell 21451717af Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-02-02 23:26:33 +00:00
Brindusan Cristian cbdb020883 Backed out 11 changesets (bug 1681529) for mochitest failures at test_reload_large_postdata.html. CLOSED TREE
Backed out changeset f1f988155c82 (bug 1681529)
Backed out changeset f0ba367de05e (bug 1681529)
Backed out changeset dbea9952ec79 (bug 1681529)
Backed out changeset 6e185ec2c4a4 (bug 1681529)
Backed out changeset d0b11c08666a (bug 1681529)
Backed out changeset f2515096b378 (bug 1681529)
Backed out changeset ecd8c3b8fdb4 (bug 1681529)
Backed out changeset 7ea2e9cc8bad (bug 1681529)
Backed out changeset dbc85d0bffaf (bug 1681529)
Backed out changeset f0893f544219 (bug 1681529)
Backed out changeset 91979e21aa8e (bug 1681529)
2021-02-02 22:02:59 +02:00
Nika Layzell 4d7290a26c Bug 1681529 - Part 8: Handle clones of closed nsPipeInputStreams, r=baku
Previously if `Clone()` was called on a closed nsPipeInputStream, it could cause
crashes due to the already-closed nsPipeInputStream being added to mInputList,
violating internal nsPipe invariants. Skipping adding the stream to that list
should avoid this edge-case, as the pipe is already closed.

Differential Revision: https://phabricator.services.mozilla.com/D101807
2021-01-27 21:55:21 +00:00
Nika Layzell 96b1095085 Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-01-27 21:55:17 +00:00
Gijs Kruitbosch 7f3e59e909 Bug 1689598 r=tkikuchi,mhowell,dmajor,valentin
Differential Revision: https://phabricator.services.mozilla.com/D103523
2021-02-02 12:36:56 +00:00
Csoregi Natalia d97e4efd8e Backed out 9 changesets (bug 1681529) for causing bustage on TestSeekableStreamWrapper.cpp. CLOSED TREE
Backed out changeset 99d1c9682dc2 (bug 1681529)
Backed out changeset b562b6038855 (bug 1681529)
Backed out changeset 5a5f514a6cfe (bug 1681529)
Backed out changeset ceb55436928a (bug 1681529)
Backed out changeset 9852de883959 (bug 1681529)
Backed out changeset 1a33ea8b533d (bug 1681529)
Backed out changeset 3385635e9521 (bug 1681529)
Backed out changeset 49c28bfc4da4 (bug 1681529)
Backed out changeset 43cc14af229d (bug 1681529)
2021-01-25 23:40:44 +02:00
Nika Layzell 85511dac91 Bug 1681529 - Part 8: Handle clones of closed nsPipeInputStreams, r=baku
Previously if `Clone()` was called on a closed nsPipeInputStream, it could cause
crashes due to the already-closed nsPipeInputStream being added to mInputList,
violating internal nsPipe invariants. Skipping adding the stream to that list
should avoid this edge-case, as the pipe is already closed.

Differential Revision: https://phabricator.services.mozilla.com/D101807
2021-01-20 16:18:17 +00:00
Nika Layzell aced9c0ee0 Bug 1681529 - Part 6: Introduce a SeekableStreamWrapper to make pipes seekable, r=baku
This patch introduces a new SeekableStreamWrapper class which handles adapting
nsIInputStreams which support being cheaply cloned using nsICloneableInputStream
into seekable input streams by operating on a clone of the original stream, and
re-cloning that stream when seeking backwards.

This wrapper is generally intended to be used with nsPipeInputStream as that
type supports both a fairly cheap clone operation, and keeping a large internal
buffer which is fairly cheap to seek using this method, but should also work
with other types such as RemoteLazyInputStream or nsStringStream.

An alternate strategy was considered where nsPipe was given internal support for
a mSeekable flag to be set on creation. This flag would then have a similar
effect, except with additional optimizations due to being visible within the
implementation of the nsPipe, rather than relying on an unadvanced
nsPipeInputStream to keep the buffer alive.

I ended up choosing this approach instead for a few reasons:

 * The seekable adapter can be applied to an already-created nsPipeInputStream,
   such as one received from IPC. With the nsPipe approach, making an IPC stream
   seekable either requires telling IPCStreamDestination to use a seekable pipe
   ahead of time, or performing a NS_AsyncCopy from the IPC-provided pipe into a
   different seekable pipe, which is likely wasted effort and would prevent
   optimizations such as RemoteLazyInputStream and DelayedStart streams.
 * The adapter can support other features of the underlying stream, such as
   nsIInputStreamLength, without resorting to adding additional adapter layers
   on top of the returned nsPipe.
 * The performance is unlikely to be substantially different in the most common
   case, which is using Seek(NS_SEEK_SET, 0) to return to the beginning of the
   stream.
 * Less additional complexity is added to the already-complicated internals of
   nsPipe, and instead it is kept in a separate wrapper stream, which is easier
   to review.

Using nsStorageStream, as is used by EnsureUploadStreamIsCloneable, was also
considered, but was rejected as it has similar problems to the seekable nsPipe
approach and also doesn't implement nsIAsyncStream, meaning that one must wait
for the NS_AsyncCopy to be completed before reading the stream.

It may actually be possible to replace the existing uses of nsStorageStream with
a wrapped nsPipe in the future, but that is left as follow-up material, and may
have memory overhead implications due to nsPipe not resizing the final segment,
unlike nsStorageStream.

Differential Revision: https://phabricator.services.mozilla.com/D101805
2021-01-20 16:19:50 +00:00
Simon Giesecke c3f51da721 Bug 1686041 - Map unknown Win32 API error codes to a module of its own in nsLocalFileWin. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D102141
2021-01-19 14:35:03 +00:00
Simon Giesecke 9758d919eb Bug 1583109 - Use StringJoin(Append) where easily possible. r=nika
Bug 1583109 introduced new function templates StringJoin and StringJoinAppend.
These are now used to replace several custom loops across the codebase that
implement string-joining algorithms to simplify the code.

Differential Revision: https://phabricator.services.mozilla.com/D98750
2020-12-17 14:58:18 +00:00
Csoregi Natalia d8c9489b13 Backed out changeset 16d174e7c342 (bug 1583109) for bustage on nsReadableUtils.h. CLOSED TREE 2020-12-16 22:51:26 +02:00
Simon Giesecke 72babae175 Bug 1583109 - Use StringJoin(Append) where easily possible. r=nika
Bug 1583109 introduced new function templates StringJoin and StringJoinAppend.
These are now used to replace several custom loops across the codebase that
implement string-joining algorithms to simplify the code.

Differential Revision: https://phabricator.services.mozilla.com/D98750
2020-12-16 19:38:23 +00:00
Andrew McCreight 4ae7e718f0 Bug 1539948, part 3 - Only allow nostdcall methods and attributes on builtinclass interfaces. r=nika
We don't properly implement them in JS, so only allow them for C++.

This patch also makes the only remaining non-builtinclass interface
with a nostdcall method, nsIBinaryOutputStream, builtinclass.

This also changes the isScriptable() method to be consistent,
though I think the change doesn't matter because the only
place that calls it also checks if the interface is builtinclass.

Differential Revision: https://phabricator.services.mozilla.com/D98863
2020-12-09 02:41:19 +00:00
Razvan Maries 35ccea0325 Backed out 3 changesets (bug 1539948) for build bustages on nsISocketTransport.h. CLOSED TREE
Backed out changeset 81bed88d0adf (bug 1539948)
Backed out changeset 8bf24bdf431f (bug 1539948)
Backed out changeset ef4e49b3701d (bug 1539948)
2020-12-09 02:47:52 +02:00
Andrew McCreight d7be14b9d2 Bug 1539948, part 3 - Only allow nostdcall methods and attributes on builtinclass interfaces. r=nika
We don't properly implement them in JS, so only allow them for C++.

This patch also makes the only remaining non-builtinclass interface
with a nostdcall method, nsIBinaryOutputStream, builtinclass.

This also changes the isScriptable() method to be consistent,
though I think the change doesn't matter because the only
place that calls it also checks if the interface is builtinclass.

Differential Revision: https://phabricator.services.mozilla.com/D98863
2020-12-08 21:19:08 +00:00
Simon Giesecke 1c53236b70 Bug 1679272 - Include ScopeExit.h exactly where used. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D98888
2020-12-07 14:25:59 +00:00
Karl Tomlinson 88c7f3ad66 Bug 1119956 derive from DiscardableRunnable instead of CancelableRunnable when Cancel() is not supported r=asuth,sg
Differential Revision: https://phabricator.services.mozilla.com/D98118
2020-12-03 09:04:44 +00:00