Commit Graph

289 Commits

Author SHA1 Message Date
Nika Layzell
fc80726fb2 Bug 1927476 - Part 1: Switch ResolveCallback/RejectCallback to be MoveOnlyFunction, r=ipc-reviewers,mccr8
This requires a small change to the filesystem code, as the
FileSystemManager::BeginRequest signature explicitly uses the type
outside of IPC code.

We never need to copy the request object, so using std::function applies
unnecessary restrictions.

Differential Revision: https://phabricator.services.mozilla.com/D228098
2024-11-06 18:36:32 +00:00
Nika Layzell
d9d9690fdc Bug 1925397 - Move async replies response ownership out of MessageChannel, r=ipc-reviewers,mccr8
This reduces the amount of casting required during async replies checks,
and ensures that the lifetimes of async replies callbacks are directly
tied to IPDL actor lifetimes.

This change does lose the unresolved-ipc-responses nsIMemoryReporter
implementation, as they are no longer stored as centrally.

Differential Revision: https://phabricator.services.mozilla.com/D226061
2024-10-21 19:16:24 +00:00
Gregory Pappas
511678bd22 Bug 1900879 - part 1: Remove unused MessageChannel::SpinInternalEventLoop r=ipc-reviewers,nika
It's not used since bug 1751047

Differential Revision: https://phabricator.services.mozilla.com/D212742
2024-06-06 20:19:19 +00:00
Alex Franchuk
d0a037d7bf Bug 1751995 - Add TestOnlyIsTransactionComplete to MessageChannel r=ipc-reviewers,nika
This method (intended to be used only in tests) returns whether the current transaction stack is
complete, and is used by TestHangs to determine when to continue in the HangButReceive subtest.

Differential Revision: https://phabricator.services.mozilla.com/D203964
2024-03-13 13:10:14 +00:00
Stanca Serban
5b1a9a8c0b Backed out 42 changesets (bug 1751995) for causing bp-nu failures in PTestDataStructuresSubChild.cpp. CLOSED TREE
Backed out changeset 5c26a10bf169 (bug 1751995)
Backed out changeset 02a074f96ccd (bug 1751995)
Backed out changeset f92cf21f54f5 (bug 1751995)
Backed out changeset e705865cf95f (bug 1751995)
Backed out changeset a3e4d1d2d709 (bug 1751995)
Backed out changeset 7384f5e7c454 (bug 1751995)
Backed out changeset d4ca13c89783 (bug 1751995)
Backed out changeset 96b164a065d4 (bug 1751995)
Backed out changeset c5a817f91355 (bug 1751995)
Backed out changeset 07dd40554527 (bug 1751995)
Backed out changeset ad9de08d7d4a (bug 1751995)
Backed out changeset 2d6b7a804db6 (bug 1751995)
Backed out changeset 52df9813a7a2 (bug 1751995)
Backed out changeset ca02c22179f1 (bug 1751995)
Backed out changeset 9543f729a08a (bug 1751995)
Backed out changeset b21677448d49 (bug 1751995)
Backed out changeset 66ca72b00da6 (bug 1751995)
Backed out changeset ece2f3b3e8b8 (bug 1751995)
Backed out changeset 913a95850424 (bug 1751995)
Backed out changeset 37aec76598c8 (bug 1751995)
Backed out changeset 64612f9a6dfe (bug 1751995)
Backed out changeset b3010b0f7b54 (bug 1751995)
Backed out changeset 534d39c27249 (bug 1751995)
Backed out changeset 4eade6ed42ae (bug 1751995)
Backed out changeset 88fee9cbf094 (bug 1751995)
Backed out changeset 943649ddc765 (bug 1751995)
Backed out changeset 6f5df39ac299 (bug 1751995)
Backed out changeset ee06381e3e1b (bug 1751995)
Backed out changeset 72caae243596 (bug 1751995)
Backed out changeset 9fce3d8543f4 (bug 1751995)
Backed out changeset a979771464dc (bug 1751995)
Backed out changeset 280122d631c0 (bug 1751995)
Backed out changeset 164df42eab65 (bug 1751995)
Backed out changeset 13f5be69033e (bug 1751995)
Backed out changeset 5e7f7bdd2743 (bug 1751995)
Backed out changeset 04d16fbe2bab (bug 1751995)
Backed out changeset 7184b5bfe2d2 (bug 1751995)
Backed out changeset bb0dda055124 (bug 1751995)
Backed out changeset fc3107b98ec6 (bug 1751995)
Backed out changeset 56233032dd1a (bug 1751995)
Backed out changeset c104ceccb708 (bug 1751995)
Backed out changeset 2412e5735361 (bug 1751995)
2024-03-12 18:17:27 +02:00
Alex Franchuk
91e9972a6e Bug 1751995 - Add TestOnlyWaitForTransactionCompletion to MessageChannel r=ipc-reviewers,nika
This method (intended to be used only in tests) blocks until the current transaction stack is
complete, and is used by TestHangs to determine when to continue in the HangButReceive subtest.

Differential Revision: https://phabricator.services.mozilla.com/D203964
2024-03-12 14:07:27 +00:00
Ray Kraesig
41148ee7ff Bug 1836349 - [3/3] Restrict IPCResult not to accept nonconstant strings r=nika,ipc-reviewers
Text passed to `IPCResult::Fail` (and, therefore, text passed to
`IPC_FAIL`) may end up in telemetry.

To avoid accidentally capturing unwanted information, restrict all such
text to compile-time constant strings, unless approved by data-review.

Differential Revision: https://phabricator.services.mozilla.com/D180152
2023-06-21 20:54:48 +00:00
Nika Layzell
2726756d3a Bug 1835647 - Switch FatalError to asynchronously report channel errors under fuzzing, r=ipc-reviewers,mccr8
This should avoid potential fuzzing-only issues which would be caused by
the actor being torn down synchronously after a FatalError or KillHard.
Instead, the state is set to error synchronously, blocking all further
message sending/receiving, and the notification is made async, similar
to how it is handled for normal channel errors.

Differential Revision: https://phabricator.services.mozilla.com/D180254
2023-06-08 23:09:19 +00:00
Mike Hommey
1db92727b5 Bug 1835185 - Replace OS_WIN with XP_WIN in ipc code. r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D180044
2023-06-06 21:05:31 +00:00
Nika Layzell
f603c94176 Bug 1807049 - Refactor MessageChannel shutdown states, r=ipc-reviewers,mccr8
This refactoring cleans up some dead code, and makes some semantic
changes to how the MessageChannel lifecycle is handled.

These changes ensure that messages which were sent by a peer before the
GOODBYE message will be delivered, without allowing messages sent after
the GOODBYE message (e.g. by a misbehaving process) to be delivered.

The lifecycle and shutdown states were simplified, and moved to be
entirely in MessageChannel, rather than split between MessageChannel and
MessageLink.

The dead-code ChannelTimeout error state was removed, along with the
corresponding CloseWithTimeout method.

The CloseWithError method was updated to behave more consistently with
the normal Close method, synchronously triggering a connection error,
and closing the MessageLink. This method is currently unused, but will
useful in the future for handling processing errors.

Differential Revision: https://phabricator.services.mozilla.com/D178382
2023-05-26 17:44:57 +00:00
Otto Länd
0979cc950b Bug 1821963, 1821972: apply code formatting via Lando
# ignore-this-changeset
2023-05-22 21:00:16 +00:00
James Teh
dcbc842252 Bug 1821963 part 5: Remove code to prevent handling of window messages while handling PDocAccessible sync IPDL calls. r=handyman
This actually hasn't ever been used in a shipping build of Firefox.
Although sync IPDL was tried with Windos a11y for a while when e10s was still disabled, it was never feasible and was replaced with COM proxying.

Differential Revision: https://phabricator.services.mozilla.com/D177965
2023-05-22 20:19:45 +00:00
James Teh
ae614c31de Bug 1821963 part 4: Remove alertable wait from IPC message loops. r=handyman
This was only ever used by the old accessibility architecture based on content process COM proxies, which is now being removed.

Differential Revision: https://phabricator.services.mozilla.com/D177964
2023-05-22 20:19:45 +00:00
Narcis Beleuzu
f95e590275 Backed out 6 changesets (bug 1821963) for build bustages. CLOSED TREE
Backed out changeset a92c62e304f0 (bug 1821963)
Backed out changeset da6cba0b0dd4 (bug 1821963)
Backed out changeset 4ed7ca0eb04a (bug 1821963)
Backed out changeset f2fba0ef15d9 (bug 1821963)
Backed out changeset 706e46fc2688 (bug 1821963)
Backed out changeset 6de2b9548dc6 (bug 1821963)
2023-05-22 14:05:20 +03:00
Otto Länd
fe77d9c732 Bug 1821963: apply code formatting via Lando
# ignore-this-changeset
2023-05-22 10:23:35 +00:00
James Teh
37c6d0b47e Bug 1821963 part 5: Remove code to prevent handling of window messages while handling PDocAccessible sync IPDL calls. r=handyman
This actually hasn't ever been used in a shipping build of Firefox.
Although sync IPDL was tried with Windos a11y for a while when e10s was still disabled, it was never feasible and was replaced with COM proxying.

Differential Revision: https://phabricator.services.mozilla.com/D177965
2023-05-22 10:00:21 +00:00
James Teh
7b2828fd42 Bug 1821963 part 4: Remove alertable wait from IPC message loops. r=handyman
This was only ever used by the old accessibility architecture based on content process COM proxies, which is now being removed.

Differential Revision: https://phabricator.services.mozilla.com/D177964
2023-05-22 10:00:21 +00:00
Stanca Serban
78750fc551 Backed out 2 changesets (bug 1807049, bug 1828389) for mozilla::ThreadEventTarget::Dispatch xpcshell related crashes. CLOSED TREE
Backed out changeset bbd8b8bbf677 (bug 1828389)
Backed out changeset 03bd5f26f9af (bug 1807049)
2023-05-20 07:38:09 +03:00
Nika Layzell
856a8ba470 Bug 1807049 - Refactor MessageChannel shutdown states, r=ipc-reviewers,mccr8
This refactoring cleans up some dead code, and makes some semantic
changes to how the MessageChannel lifecycle is handled.

These changes ensure that messages which were sent by a peer before the
GOODBYE message will be delivered, without allowing messages sent after
the GOODBYE message (e.g. by a misbehaving process) to be delivered.

The lifecycle and shutdown states were simplified, and moved to be
entirely in MessageChannel, rather than split between MessageChannel and
MessageLink.

The dead-code ChannelTimeout error state was removed, along with the
corresponding CloseWithTimeout method.

The CloseWithError method was updated to behave more consistently with
the normal Close method, synchronously triggering a connection error,
and closing the MessageLink. This method is currently unused, but will
useful in the future for handling processing errors.

Differential Revision: https://phabricator.services.mozilla.com/D178382
2023-05-19 19:21:08 +00:00
Christian Holler (:decoder)
46e64be8b3 Bug 1821010 - Remove legacy IPC fuzzing code. r=truber,nika
Differential Revision: https://phabricator.services.mozilla.com/D171981
2023-03-23 14:53:22 +00:00
Nika Layzell
a6be94c9d4 Bug 1804485 - Part 1: Add support for [LazySend] ipc messages, r=ipc-reviewers,mccr8
This is intended to be used to mark messages which do nothing on the
receiving side other than setting up state for future IPC messages,
meaning that the send can be delayed until other more important work is
complete, or until a non-LazySend IPC message is sent.

This does not break any message ordering guarantees, as the lazy
messages will be sent in order before any non-lazy messages are sent.

Differential Revision: https://phabricator.services.mozilla.com/D164274
2022-12-20 20:23:37 +00:00
Nika Layzell
cdd61f472e Bug 1789440 - Track reply message IDs for MessageChannel async replies, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D156569
2022-09-07 23:38:45 +00:00
Noemi Erli
d9ad447154 Backed out changeset 0f2c5cc743c8 (bug 1789440) for causing mass failures 2022-09-08 01:54:54 +03:00
Nika Layzell
b3d3f55211 Bug 1789440 - Track reply message IDs for MessageChannel async replies, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D156569
2022-09-07 20:30:39 +00:00
Nika Layzell
afe4f1d855 Bug 1779792 - Part 5: Add a unique nsID field to each MessageChannel pair, r=ipc-reviewers,mccr8
This won't be used for any security or routing purposes, but can be useful for
debugging. It will be used in the future by the profiler to correlate sent and
received message events across processes.

Differential Revision: https://phabricator.services.mozilla.com/D153621
2022-08-10 14:55:23 +00:00
Fabrice Desré
e29be44cb7 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Andreea Pavel
fc724b92fc Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel
eda47f3911 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Christian Holler
5df3d2b545 Bug 1782505 - Observe destroyed actors in IPC fuzzing. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D153344
2022-08-02 22:06:28 +00:00
Andreea Pavel
c2e97d2e06 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré
d2d02e8493 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Jens Stutte
e5b5f8d155 Bug 1775112 - Remove obsolete MessageChannel::Begin/StopPostponingSends feature. r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D149775
2022-06-21 06:18:31 +00:00
Nika Layzell
03bbeeb7b2 Bug 1768775 - Stash mIsFuzzMsg on the MessageTask so it's available after the message is run, r=decoder
Differential Revision: https://phabricator.services.mozilla.com/D146082
2022-05-11 14:15:35 +00:00
Nika Layzell
b14a633bee Bug 1768476 - Part 2: Mark MessageTask::mMessage as guarded by the monitor, r=ipc-reviewers,mccr8
All accesses except those through the xpcom interfaces were already
guarded, and given it can be mutated, this seemed easier than adding
thread assertions or similar.

Differential Revision: https://phabricator.services.mozilla.com/D145886
2022-05-10 21:37:26 +00:00
Nika Layzell
42dba697a5 Bug 1768476 - Part 1: Consistently pass IPC::Message around by UniquePtr, r=ipc-reviewers,mccr8
This makes passing around the type more consistent, and hopefully will make
changes to IPC::Message easier to work with in the future.

In addition, this should save us a few copies as we move the message type into
and out of UniquePtr, however I expect this won't make much of a difference.

Differential Revision: https://phabricator.services.mozilla.com/D145885
2022-05-10 21:37:25 +00:00
Noemi Erli
13882c1928 Backed out 2 changesets (bug 1768476) for causing build bustages in ProtocolFuzzer.h
Backed out changeset c9cb03579c09 (bug 1768476)
Backed out changeset 6732ef394d0e (bug 1768476)
2022-05-10 23:39:29 +03:00
Nika Layzell
a833e671fd Bug 1768476 - Part 2: Mark MessageTask::mMessage as guarded by the monitor, r=ipc-reviewers,mccr8
All accesses except those through the xpcom interfaces were already
guarded, and given it can be mutated, this seemed easier than adding
thread assertions or similar.

Differential Revision: https://phabricator.services.mozilla.com/D145886
2022-05-10 17:45:43 +00:00
Nika Layzell
61ad4be21c Bug 1768476 - Part 1: Consistently pass IPC::Message around by UniquePtr, r=ipc-reviewers,mccr8
This makes passing around the type more consistent, and hopefully will make
changes to IPC::Message easier to work with in the future.

In addition, this should save us a few copies as we move the message type into
and out of UniquePtr, however I expect this won't make much of a difference.

Differential Revision: https://phabricator.services.mozilla.com/D145885
2022-05-10 17:45:42 +00:00
Christian Holler
040bde52d6 Bug 1756778 - Integrate top-level IPC fuzzing. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D139471
2022-05-05 15:39:24 +00:00
Nika Layzell
6bc9f1bacb Bug 1738104 - Shutdown IPC actors during EventTarget shutdown, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D129841
2022-03-23 22:22:05 +00:00
Nika Layzell
1021a748fc Bug 1760357 - Part 3: Add thread-safety annotations to MessageChannel, r=jesup
Like DataPipe, the Monitor in this case is shared between multiple objects and
needs some helper methods.

Theoretically REQUIRES annotations should be added to methods on the
transaction type, however the requirement would be difficult to express,
leading to a lot of assertion methods cluttering up the code, so it was left
out for now.

Differential Revision: https://phabricator.services.mozilla.com/D141534
2022-03-22 14:59:41 +00:00
Cristian Tuns
728770cb3f Backed out 5 changesets (bug 1760357) for causing build bustages on Monitor.h CLOSED TREE
Backed out changeset 799de364a32e (bug 1760357)
Backed out changeset 29957146468a (bug 1760357)
Backed out changeset e79cb8caca88 (bug 1760357)
Backed out changeset afba32f4da1d (bug 1760357)
Backed out changeset ddfc71cdf34e (bug 1760357)
2022-03-21 19:01:11 -04:00
Nika Layzell
f6ec5e1f50 Bug 1760357 - Part 3: Add thread-safety annotations to MessageChannel, r=jesup
Like DataPipe, the Monitor in this case is shared between multiple objects and
needs some helper methods.

Theoretically REQUIRES annotations should be added to methods on the
transaction type, however the requirement would be difficult to express,
leading to a lot of assertion methods cluttering up the code, so it was left
out for now.

Differential Revision: https://phabricator.services.mozilla.com/D141534
2022-03-21 21:05:59 +00:00
Nazım Can Altınova
ed16f8a553 Bug 1758099 - Add the origin tid of the IPC markers if the thread is not being profiled r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D141100
2022-03-16 14:27:36 +00:00
Nika Layzell
d282e33143 Bug 1751948 - Part 5: Ensure we don't release ActorLifecycleProxy while holding MessageChannel's Monitor, r=jld
Releasing ActorLifecycleProxy can lead to the IToplevelProtocol being
destroyed, due to the reference being the last reference. If this happens, we
can deadlock due to the MessageChannel embedded in IToplevelProtocol locking
mMonitor during its' destructor. This patch moves acquiring the proxy earlier
in the method, so that we do not deadlock in this case any longer.

Differential Revision: https://phabricator.services.mozilla.com/D137169
2022-02-28 21:01:48 +00:00
Randell Jesup
d7d42b9b2f Bug 1748759: ipc cleanup r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D135184
2022-02-10 22:01:17 +00:00
Nika Layzell
e0f0e36a5b Bug 1738734 - Directly pass around handles rather than using TransportDescriptor, r=jld,media-playback-reviewers,alwu
This simplifies the logic around descriptors significantly, which is
especially useful considering how few places use the type. There is a
small change required on Windows to create the NamedPipe directly and
transfer around each end's handle, rather than connecting between
processes after the fact.

A named pipe has to be used, rather than an anonymous pipe, as
bidirectional communication is required.

Differential Revision: https://phabricator.services.mozilla.com/D130381
2022-02-08 23:53:45 +00:00
Sandor Molnar
f9cfb76f8d Backed out changeset ba6624225635 (bug 1738734) for causing build bustages in ipc/PUtilityProcessParent. 2022-02-01 00:57:12 +02:00
Nika Layzell
1a5c5d6462 Bug 1738734 - Directly pass around handles rather than using TransportDescriptor, r=jld,media-playback-reviewers,alwu
This simplifies the logic around descriptors significantly, which is
especially useful considering how few places use the type. There is a
small change required on Windows to create the NamedPipe directly and
transfer around each end's handle, rather than connecting between
processes after the fact.

A named pipe has to be used, rather than an anonymous pipe, as
bidirectional communication is required.

Differential Revision: https://phabricator.services.mozilla.com/D130381
2022-01-31 22:26:05 +00:00
Nika Layzell
269e9ca7a9 Bug 1751047 - Remove support for intr messages from IPC, r=ipc-reviewers,mccr8
All uses of the intr message type have been removed from the tree, and the only
remaining uses are in IPDL tests, which currently do not test the IPDL runtime.
This test fully removes support for intr messages from the MessageChannel
interface.

Differential Revision: https://phabricator.services.mozilla.com/D136500
2022-01-27 16:42:13 +00:00