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

743522 Коммитов

Автор SHA1 Сообщение Дата
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
Nika Layzell 6ba8b34b52 Bug 1681529 - Part 5: Serialize `nsIInputStream` over IPC with aDelayedStart by default, r=baku
The current set of cases where a nsIInputStream is directly serialized over IPC
is fairly limited, and includes cases where the IPDL struct may be directly
stored within a content process, having the nsIInputStream left unused.

By switching this serialization to DelayedStart, we can avoid performing
unnecessary streaming copies of IPC data when sending postdata streams related
to session history and document navigation, while also avoiding issues like this
coming up again due to delayed start being the default.

Differential Revision: https://phabricator.services.mozilla.com/D101804
2021-02-02 23:26:31 +00:00
Nika Layzell acbde6866d Bug 1681529 - Part 4: Serialize aDelayedStart streams from parent to child as RemoteLazyInputStreams, r=baku
When aDelayedStart is specified, if the created IPCStream contains an internal
IPC stream actor, an actor is used under the hood to send raw data between
processes when needed. This is usually done to reduce overhead in cases where
the target process may not use the nsIInputStream immediately, if at all.

By switching to using RemoteLazyInputStream when sending DelayedStart actors
from parent to content, the amount of data sent in the initial payload is
reduced even further, and the stream is optimized to allow sending it back to
the parent process without streaming the data through the content process again.

Normal delayed start streams are still used when sending payloads from other
processes, as RemoteLazyInputStream is only supported for nsIInputStreams
originating in the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D101803
2021-02-02 23:26:28 +00:00
Nika Layzell d03d88777e Bug 1681529 - Part 3: Apply InputStreamLengthWrapper after DelayedStartInputStream, r=baku
Previously, we would apply the InputStreamLengthWrapper before
DelayedStartInputStream, which meant that a stream serialized with aDelayedStart
would not correctly implement nsIInputStreamLength. By inverting the order of
these wrappers, the nsIInputStreamLength implementation is visible, without
impacting the functionality of the DelayedStartInputStream wrapper.

Differential Revision: https://phabricator.services.mozilla.com/D101802
2021-02-02 23:26:26 +00:00
Nika Layzell 486adc6dbc Bug 1681529 - Part 2: Use an overload set instead of template for RemoteLazyInputStreamParent::Create, r=baku
In a later part of this patch series, this will be necessary to handle cases
when BackgroundParentImpl* (or other PBackgroundParent subclasses) are passed to
RemoteLazyInputStreamParent::Create, as previously this would've caused an
undefined linker symbol error. By using an explicit overload set, we can move
the subclass conversion to the caller, and avoid this issue.

Differential Revision: https://phabricator.services.mozilla.com/D101801
2021-02-02 23:26:18 +00:00
Nika Layzell b227119f4b Bug 1681529 - Part 1: Add a test for reloading a page with a large postdata payload, r=peterv
Without the other patches in this series, this test fails with both with and
without Fission enabled, for two different reasons.

With Fission disabled, the second reload request appears as empty, due to us
being unable to rewind the postData nsIInputStream. With Fission enabled, the
second reload request causes crashes due to the nsMIMEInputStream's invariant of
requiring a seekable stream is invalidated, causing the nsICloneableInputStream
implementation to misbehave.

Differential Revision: https://phabricator.services.mozilla.com/D101800
2021-02-02 23:26:16 +00:00
Mihai Alexandru Michis ac5549ffd4 Backed out 2 changesets (bug 1690225) for causing multiple bc failures.
CLOSED TREE

Backed out changeset 381ee01f5034 (bug 1690225)
Backed out changeset cde1d10aae1c (bug 1690225)
2021-02-03 01:42:37 +02:00
Erik Nordin 9dfe67db28 Bug 1673099 - Support duplex flip styles in the print platform r=jfkthame
Changes the print platform to use uniform terminology for duplex
printing styles.

- DuplexNone
- DuplexFlipOnSideEdge
- DuplexFlipOnTopEdge

Differential Revision: https://phabricator.services.mozilla.com/D94682
2021-02-02 22:19:30 +00:00
alwu 5850319e0a Bug 1689267 - renew some media telemetry probes. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D103387
2021-02-02 19:47:09 +00:00
Emilio Cobos Álvarez 63fd5123dd Bug 1690225 - Unify focus-visible rules in ua.css. r=edgar
We had different rules with the same declarations for all namespaces, so
simplify that setup by having a single rule.

Remove redundant *|* from selectors while at it (there's no default
namespace in ua.css, so there's no need to do that).

Depends on D103752

Differential Revision: https://phabricator.services.mozilla.com/D103753
2021-02-02 22:32:14 +00:00
Emilio Cobos Álvarez df079e8f9d Bug 1690225 - Remove focus-visible feature flag. r=edgar
This shipped in 85, we can remove the feature flag now. Keep
:-moz-focusring as an alias to :focus-visible at parse time.

Differential Revision: https://phabricator.services.mozilla.com/D103752
2021-02-02 22:28:40 +00:00
Kris Maglione df030bce83 Bug 1674871: Unlock fission.autostart and allow to ride the trains. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D103829
2021-02-02 22:01:32 +00:00
Kris Maglione 8ec2442bf5 Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 22:24:47 +00:00
prathiksha 5aa3cb7f38 Bug 1689996 - Change newtab wordmark color from #363959 to #20123A if logowordmark.alwaysVisible is set to true. r=ewright
Differential Revision: https://phabricator.services.mozilla.com/D103649
2021-02-02 22:20:08 +00:00
Lee Salzman 73e9582ee4 Bug 1674524 - implement KHR_blend_equation_advanced in SWGL. r=bradwerth
This patch has a few moving parts. We have to first tell WR that when it
detects the extension that it is actually allowed to use it. We have to make
the glsl-to-cxx translator eat the blend_supports_all_equations layout
qualifier. We have to enable generation of advanced-blend-equation variants
in the SWGL build setup. Then we report the actual extension inside SWGL.
Finally, we actually add all the necessary blend equation enums, hash them
down to a blend key, and implement all the blend modes therein.

Differential Revision: https://phabricator.services.mozilla.com/D103804
2021-02-02 22:18:21 +00:00
Mike Hommey 9725b09b3c Bug 1690172 - Fix Sprintf buffer size in ReportTooBigCharacter. r=sfink
The format string is "0x%u", which can output up to 10 characters...
plus a nul terminator. So it needs a max of 11 bytes, otherwise,
SprintfLiteral truncates and adds a nul terminator, which leaves
all values > 0x7fffffff displayed without their lowest bits.

Differential Revision: https://phabricator.services.mozilla.com/D103732
2021-02-02 16:01:48 +00:00
Mihai Alexandru Michis f78f11adcd Backed out changeset f36b4c0c09c9 (bug 1686997) for causing xpcshell timeouts in test_backgroundtask_locked_profile.js
CLOSED TREE
2021-02-03 00:22:20 +02:00
tanweerali 8cdf45f9f7 Bug 1688502 - [Core] Remove else if condition after break in layout/base/nsBidiPresUtils.cpp#1338. r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D103701
2021-02-02 21:50:42 +00:00
Brindusan Cristian e87cc6c9b1 Backed out changeset e4cefba9f87e (bug 1647519) for build bustages in BrowsingContext.cpp. CLOSED TREE 2021-02-03 00:08:53 +02:00
Brindusan Cristian d3b8616aad Backed out changeset f71aafc4e845 (bug 1674524) for build bustages in src/gl.cc. CLOSED TREE 2021-02-03 00:07:59 +02:00
Kris Maglione dc41c70e24 Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 21:46:53 +00:00
Alexis Beingessner 744cc705b3 Bug 1674835 - remove supression for fixed issue. r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D103046
2021-02-02 16:03:14 +00:00
Mike Hommey afe55d2f87 Bug 1689279 - Fix clang-tidy warnings in Printf.cpp. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D103264
2021-02-02 21:18:06 +00:00
Lee Salzman 7b87580cdf Bug 1674524 - implement KHR_blend_equation_advanced in SWGL. r=bradwerth
This patch has a few moving parts. We have to first tell WR that when it
detects the extension that it is actually allowed to use it. We have to make
the glsl-to-cxx translator eat the blend_supports_all_equations layout
qualifier. We have to enable generation of advanced-blend-equation variants
in the SWGL build setup. Then we report the actual extension inside SWGL.
Finally, we actually add all the necessary blend equation enums, hash them
down to a blend key, and implement all the blend modes therein.

Differential Revision: https://phabricator.services.mozilla.com/D103804
2021-02-02 21:43:12 +00:00
Jeff Muizelaar a79879c249 Bug 1690392 - Add some missing gen9 ids. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D103827
2021-02-02 21:41:24 +00:00
prathiksha d24bea6507 Bug 1690031 - Fix topsites sitename and sponsored text font-size when newNewtabExperience is enabled. r=ewright
Differential Revision: https://phabricator.services.mozilla.com/D103682
2021-02-02 20:42:10 +00:00
Mihai Alexandru Michis f2070ec731 Backed out changeset c0ecccf36d56 (bug 1647519) for causing bustages in BrowsingContext.cpp
CLOSED TREE
2021-02-02 22:47:01 +02:00
Sebastian Hengst 7849e5ec3b Bug 1690273 - set new test step for css/css-sizing/animation/aspect-ratio-interpolation.html as failing outside Nightly. r=boris DONTBUILD
Test got added in bug 1681980.

'aspect-ratio' is only enabled in Nightly (bug 1672078). It will ship once
bug 1672073 has been resolved.

Differential Revision: https://phabricator.services.mozilla.com/D103807
2021-02-02 20:23:08 +00:00
Emma Malysz 3e25955d29 Bug 1689437, respect bookmarks.toolbars.bookmarks pref values to display bookmarks toolbar in skeleton UI r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D103358
2021-02-02 20:32:51 +00:00
Kris Maglione e2e8e3c012 Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 20:32:04 +00:00
Brindusan Cristian 1f923f4895 Backed out changeset 0395717ea76d (bug 1647519) for build bustages at BrowsingContext.cpp. CLOSED TREE 2021-02-02 22:07:10 +02: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
Jeff Muizelaar 83c6b7fa71 Bug 1690376 - Allow WebRender on Nouveau in early beta. r=aosmond
This also unifies the early-beta and nightly mesa allow lists.

Differential Revision: https://phabricator.services.mozilla.com/D103811
2021-02-02 19:53:08 +00:00
Kris Maglione 403125cd23 Bug 1647519: Reject javascript: requests targeting other content processes. r=nika
Loads targeting cross-process BrowsingContexts are by definition cross-origin,
which should preclude any javascript: loads. While those loads are currently
prevented by principal checks in the final target process, sending IPC
messages for the attempts is unnecessary, and potentially opens a door to
privilege escalation exploits by a compromised content process.

This patch prevents any cross-process load requests from being sent by content
processes, and adds checks in the parent process to kill any (potentially
compromised) content process which attempts to send them.

Differential Revision: https://phabricator.services.mozilla.com/D103529
2021-02-02 19:47:12 +00:00
Julian Descottes 4d919308ba Bug 1686950 - [devtools] Add test for opening RDM on non-selected tab r=nchevobbe
Depends on D103687

Differential Revision: https://phabricator.services.mozilla.com/D103688
2021-02-02 19:48:02 +00:00
Julian Descottes 98d054740b Bug 1686950 - [devtools] Remove string concatenation to toggle RDM from toolbox r=nchevobbe
Depends on D103326

Spotted while writing the patch, makes the code unnecessarily hard to navigate.

Differential Revision: https://phabricator.services.mozilla.com/D103687
2021-02-02 19:08:45 +00:00
Julian Descottes 36fd4f01e4 Bug 1686950 - [devtools] RDM should stop watching resources and targets after performing cleanup r=nchevobbe
Depends on D103325

When we stop watching for resources, if there are no other watchers currently in activity, we will unregister the JSWindowActors, with following stack:
```
unregisterJSWindowActor@resource://devtools/server/actors/watcher/WatcherRegistry.jsm:344:17
maybeUnregisteringJSWindowActor@resource://devtools/server/actors/watcher/WatcherRegistry.jsm:280:7
unwatchTargets@resource://devtools/server/actors/watcher.js:199:21
handler@resource://devtools/shared/protocol/Actor.js:172:37
onPacket@resource://devtools/server/devtools-server-connection.js:379:58
send/<@resource://devtools/shared/transport/local-transport.js:68:25
exports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:103:22
DevToolsUtils.executeSoon*exports.executeSoon@resource://devtools/shared/DevToolsUtils.js:54:21
send@resource://devtools/shared/transport/local-transport.js:56:21
send@resource://devtools/shared/protocol/Front.js:272:30
generateRequestMethods/</frontProto[name]@resource://devtools/shared/protocol/Front/FrontClassWithSpec.js:42:14
stopListening@resource://devtools/shared/resources/target-list.js:363:29
destroy@resource://devtools/shared/resources/target-list.js:612:10
```

This will lead to destroy all the currently created JSWindowActors, which will also destroy the corresponding target actors.
However RDM will still try to perform some cleanups on the current target after destroying the target-list. These calls will fail as soon as RDM uses a JSWindowActor based target.
This will only start happening in Bug 1644397, but then it will make the test browser_tab_remoteness_change_fission_switch_target.js fail on shutdown.

Differential Revision: https://phabricator.services.mozilla.com/D103326
2021-02-02 19:08:22 +00:00
Julian Descottes 20122a5d0a Bug 1686950 - [devtools] Update RDM tab target creation to rely on a local tab target descriptor r=nchevobbe
RDM uses a dedicated client, target-list etc. Which means that we can use a local tab descriptor and remove the target switching logic from RDM.
New test is added in D103688

Differential Revision: https://phabricator.services.mozilla.com/D103325
2021-02-02 19:08:20 +00:00
Jeff Muizelaar 80bb95fdeb Bug 1690371 - Drop the minimum mesa version for WebRender to 17. r=aosmond
The choice of 18 was arbitrary. Let's see if lower
versions work well.

Differential Revision: https://phabricator.services.mozilla.com/D103809
2021-02-02 19:43:22 +00:00
Kris Maglione 2d56612fcb Bug 1685106: Add some missing IsInProcess() checks to nsDocShell. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D103566
2021-02-01 22:09:01 +00:00
Nick Alexander 4543e2b04d Bug 1687009 - Add test ensuring sync update manager works in background tasks. r=mossop,mhowell
Differential Revision: https://phabricator.services.mozilla.com/D101954
2021-02-02 19:42:44 +00:00
Nick Alexander 78212e193c Bug 1686997 - Add test ensuring locked (temporary) profile exits background task with non-zero exit code. r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D101953
2021-02-02 19:36:02 +00:00
Jon Bauman aade425260 Bug 1689222 - MediaSource.prototype.onsourceclosed event handler attribute typo (trailing d). r=alwu,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D103560
2021-02-02 17:50:38 +00:00
Nika Layzell 681cd1b0fe Bug 1681529 - Part 11: Avoid using DelayedStart when serialzing the reply from SendOpenStream, r=asuth
Streams serialized with the default nsIInputStream serializer will be serialized
with delayedStart, meaning that when sent from the parent process to the content
process it will be serialized as a RemoteLazyInputStream.

In the specific case of SendOpenStream this causes issues, as the content
process code depends on the synchronous nature of nsIFileInputStream to allow it
to be wrapped in a SnappyUncompressInputStream, which requires a sync stream.

Relying on this property is not generally correct and only works because we know
only nsFileInputStream will be sent by the parent process. Other types of sync
streams may be received as async if they are sufficiently large, such as
nsStringInputStream.

Differential Revision: https://phabricator.services.mozilla.com/D103227
2021-02-02 19:19:28 +00:00
Nika Layzell f918e191b0 Bug 1681529 - Part 10: Set StartedReading after calling SetData, r=baku,necko-reviewers,valentin
SetData will check that `mStartedReading` has not been set yet to ensure the
stream is in a non-partially-read state. This can lead to assertion failures
when sending a stream not seeked to the beginning over IPC.

Differential Revision: https://phabricator.services.mozilla.com/D103226
2021-01-29 19:04:03 +00:00
Nika Layzell f41577663f Bug 1681529 - Part 9: Add a basic test for the seekable stream wrapper, r=baku
This basic GTest exercises some of the basic functionality of the
SeekableStreamWrapper when applied to a nsPipe.

Differential Revision: https://phabricator.services.mozilla.com/D101808
2021-01-28 00:30:04 +00: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 55c9ceedc7 Bug 1681529 - Part 7: Wrap the inner streams in a nsMIMEInputStream to make them seekable, r=baku,necko-reviewers,dragana
nsMIMEInputStream has a requirement that the inner nsIInputStream object
implement nsISeekableStream, which is usually enforced by the SetData method.
This check was bypassed by the Deserialize method, which unfortunately meant
that non-seekable IPC payloads could end up within a nsMIMEInputStream when sent
from another process (e.g. due to large nsStringStreams being serialized as
nsPipes over IPC).

This patch uses the SeekableStreamWrapper introduced in the previous patch to
wrap the inner stream when deserializing nsMIMEInputStream, avoiding the
previously mentioned issue.

Differential Revision: https://phabricator.services.mozilla.com/D101806
2021-01-27 21:55:19 +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
Nika Layzell 19d158a736 Bug 1681529 - Part 5: Serialize `nsIInputStream` over IPC with aDelayedStart by default, r=baku
The current set of cases where a nsIInputStream is directly serialized over IPC
is fairly limited, and includes cases where the IPDL struct may be directly
stored within a content process, having the nsIInputStream left unused.

By switching this serialization to DelayedStart, we can avoid performing
unnecessary streaming copies of IPC data when sending postdata streams related
to session history and document navigation, while also avoiding issues like this
coming up again due to delayed start being the default.

Differential Revision: https://phabricator.services.mozilla.com/D101804
2021-01-27 21:55:14 +00:00