7207 Commits

Author SHA1 Message Date
Joel Maher
f668f1c655 Bug 1790868 - clean up 32 bit annotations for tests that don't run on 32 bit, and general cleanup. r=aryx
Differential Revision: https://phabricator.services.mozilla.com/D157352
2022-09-16 12:40:13 +00:00
Nika Layzell
0316dc51b9 Bug 1790614 - Part 2: Use {ASSERT,ENSURE}_NS_{SUCCEEEDED,FAILED} in gtests, r=ahal,necko-reviewers
These macros will produce better outputs when they fail than these existing
patterns using `ENSURE_TRUE(NS_SUCCEEDED(...))` or similar, so this is a bulk
rewrite of existing tests to use them.

It should also help with discoverability when people base their tests off of
other existing tests.

Differential Revision: https://phabricator.services.mozilla.com/D157214
2022-09-15 14:51:50 +00:00
Gabriele Svelto
a7d2695d2a Bug 1784039 - Remove the isLikelyOOM property from ipc:content-shutdown messages r=jld
Differential Revision: https://phabricator.services.mozilla.com/D154226
2022-09-13 07:01:57 +00:00
Gabriele Svelto
b25541c86f Bug 1789421 - Generate crash reports for content process shutdown hangs only when we can confirm that the process did not shut down in time r=jstutte
Differential Revision: https://phabricator.services.mozilla.com/D156838
2022-09-12 19:05:24 +00:00
Butkovits Atila
cfd3972560 Backed out changeset bff57b2e4b16 (bug 1789421) for causing build bustage. CLOSED TREE 2022-09-12 12:37:57 +03:00
Gabriele Svelto
8e3d3f6b58 Bug 1789421 - Generate crash reports for content process shutdown hangs only when we can confirm that the process did not shut down in time r=jstutte
Differential Revision: https://phabricator.services.mozilla.com/D156838
2022-09-12 08:57:16 +00:00
Nika Layzell
c4a5d70ac5 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
fc97f1f051 Backed out changeset 0f2c5cc743c8 (bug 1789440) for causing mass failures 2022-09-08 01:54:54 +03:00
Nika Layzell
17486aef5c 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
53fab351f8 Bug 1789708 - Include union type in 'unknown union type' error, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D156724
2022-09-07 20:20:04 +00:00
Jan Varga
1b1f2c642a Bug 1786484 - Provide a way to override generated Send methods in tests; r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155351
2022-09-07 13:30:43 +00:00
alwu
3d1bc29d56 Bug 1785738 - part4 : run media engine in the new utility process. r=gerard-majax,azebrowski
This patch moves the media engine from the RDD process to the new
utility process, and create video bridge between the new utility process
and the GPU process in order to share the texture.

Differential Revision: https://phabricator.services.mozilla.com/D155901
2022-09-03 00:53:59 +00:00
alwu
4029b6998d Bug 1785738 - part3 : rename 'UtilityProcessManager::StartAudioDecoding()' because we would do video decoding in the utility process as well. r=gerard-majax
Differential Revision: https://phabricator.services.mozilla.com/D155900
2022-09-03 00:53:59 +00:00
alwu
24c4bb6bd5 Bug 1785738 - part1 : add new type of utility process. r=bobowen,gerard-majax,fluent-reviewers,flod
Create a new type of utility process which would be used for media
foundation media engine CDM usage. The media engine is a media pipeline
provided by the Windows Media Foundation, and our final goal is to use
that pipeline to play encrypted content in order to achieve Widevine L1
protection to allow users to watch high resolution videos.

Differential Revision: https://phabricator.services.mozilla.com/D154033
2022-09-03 00:53:58 +00:00
Alexandre Lissy
b135ca0732 Bug 1780796 - Use one process per platform decoder module sandbox requirements r=alwu,nika,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D152545
2022-09-01 12:59:32 +00:00
Jens Stutte
26b6f353fb Bug 1777198 - Improve IPCShutdownState annotation. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D155814
2022-09-01 09:43:37 +00:00
Sandor Molnar
99c83b6427 Backed out changeset 6cebcfdd9245 (bug 1777198) for causing build bustages. CLOSED TREE 2022-09-01 11:49:48 +03:00
Jens Stutte
6d8eda177a Bug 1777198 - Improve IPCShutdownState annotation. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D155814
2022-09-01 08:08:32 +00:00
Jan Varga
9dfb082c69 Bug 1786465 - Rename POriginPrivateFileSystem to PFileSystemManager; r=dom-storage-reviewers,jesup
The child actor will be held by FileSystemManager on the child side and the
parent actor already holds FileSystemDataManager, so it makes sense to rename
the protocol to PFileSystemManager.

Differential Revision: https://phabricator.services.mozilla.com/D155368
2022-08-31 09:34:48 +00:00
Jan Varga
df54d955f8 Bug 1786465 - Replace PBackgroundFileSystem protocol with a single async message; r=dom-storage-reviewers,jesup
PBackgroundFileSystem currently contains only one async message and we don't
plan to add more messages, so the one and only message can be defined directly
on PBackground.

Differential Revision: https://phabricator.services.mozilla.com/D155367
2022-08-31 09:34:48 +00:00
Nika Layzell
dd21530757 Bug 1781129 - Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld
Due to Shmem implementing ParamTraits, it is possible for a Shmem argument to
not be visible to the IPDL compiler as it is only serialized within an opaque
type included with `using`. If that happens, it would cause the construction of
the Shmem to fail on the other side, in a hard to diagnose manner. This changes
the logic to always allow any actor to manage shmems, to make it more in line
with the `AllocShmem` method being directly declared on IProtocol.

This specifically caused issues after this patch stack with PContent, which no
longer has any shmem arguments visible to IPDL after these changes, but still
is used as a manager for Shmems included in some messages.

Differential Revision: https://phabricator.services.mozilla.com/D151855
2022-08-26 16:08:06 +00:00
Marian-Vasile Laza
9274b092fe Backed out 4 changesets (bug 1781129) for causing mochitest failures on test_bug490879.html. CLOSED TREE
Backed out changeset 37da1d18cde9 (bug 1781129)
Backed out changeset 1ae213bfa43e (bug 1781129)
Backed out changeset dcebc98ea1f1 (bug 1781129)
Backed out changeset 0df2f2832755 (bug 1781129)
2022-08-22 23:07:56 +03:00
Jed Davis
eb6fa5f6d7 Bug 1784567 - Mitigate the unsafety of the GCOV_CHILD_PREFIX support. r=nika
In code-coverage builds we have code which, after `fork` in the child
process, does a number of async-signal-unsafe operations which aren't
permitted in that context.  In particular, locking is a problem: if
another thread in the parent process had held the lock, it will deadlock.

Most of this is conditional on the `GCOV_CHILD_PREFIX` env var being
set, and currently we don't (see bug 1724239), but checking that env var
itself is a problem, because `PR_GetEnv` takes a mutex.  (This was found
by inspection, so I don't know if it's happening in practice, but it's
possible that mysterious timeouts on ccov builds might be caused by this
bug.)

Therefore, this patch moves reading the env var into the parent process,
where it's safe; the rest of the code still contains unsafe operations
(although our `pthread_atfork` hooks in mozjemalloc might help) but it
won't be run.

This will need further cleanup at some point; see bug 1783305.

Differential Revision: https://phabricator.services.mozilla.com/D154572
2022-08-22 18:01:27 +00:00
Nika Layzell
58fa28bce4 Bug 1781129 - Part 4: Fix issues caused by Shmem arguments no longer being visible to ipdl, r=ipc-reviewers,jld
Due to Shmem implementing ParamTraits, it is possible for a Shmem argument to
not be visible to the IPDL compiler as it is only serialized within an opaque
type included with `using`. If that happens, it would cause the construction of
the Shmem to fail on the other side, in a hard to diagnose manner. This changes
the logic to always allow any actor to manage shmems, to make it more in line
with the `AllocShmem` method being directly declared on IProtocol.

This specifically caused issues after this patch stack with PContent, which no
longer has any shmem arguments visible to IPDL after these changes, but still
is used as a manager for Shmems included in some messages.

Differential Revision: https://phabricator.services.mozilla.com/D151855
2022-08-22 15:38:16 +00:00
Gerald Squelart
4326b92ea7 Bug 1784812 - Use common JSONWriteFuncs when writing to a string - r=canaltinova,media-playback-reviewers,alwu
Most users of JSONWriter want to fill a string, so instead of having all these
similar implementations, we now have central reusable implementations:
- JSONStringWriteFunc contains a string and writes to it.
- JSONStringRefWriteFunc references a string and writes to it. This is most
  useful when the string already exists somewhere, or needs to be returned from
  a function (so we avoid another conversion when returning).

Differential Revision: https://phabricator.services.mozilla.com/D154618
2022-08-17 07:07:54 +00:00
Gerald Squelart
24798f281f Bug 1784812 - JSONWriter::WriteFunc() returns a reference - r=canaltinova
mWriter is never null (and lots of calls just dereference it without checking),
so we may as well enforce it:
- The constructor MOZ_RELEASE_ASSERTs that it's not null.
- The accessor WriteFunc() returns a reference instead of a scary raw pointer.

(Note that we can't make mWriter a NotNull<...>, because the next patch will
give the option to keep that owning pointer null.)

Differential Revision: https://phabricator.services.mozilla.com/D154616
2022-08-17 07:07:53 +00:00
Iulian Moraru
859487ba6b Backed out 4 changesets (bug 1784812) for causing build bustages on DDMediaLogs. CLOSED TREE
Backed out changeset c9998c927079 (bug 1784812)
Backed out changeset d2568bc2f8a6 (bug 1784812)
Backed out changeset 9f01bf89c583 (bug 1784812)
Backed out changeset d8506496d8f2 (bug 1784812)
2022-08-17 05:48:36 +03:00
Gerald Squelart
253bb5dc48 Bug 1784812 - Use common JSONWriteFuncs when writing to a string - r=canaltinova,media-playback-reviewers,alwu
Most users of JSONWriter want to fill a string, so instead of having all these
similar implementations, we now have central reusable implementations:
- JSONStringWriteFunc contains a string and writes to it.
- JSONStringRefWriteFunc references a string and writes to it. This is most
  useful when the string already exists somewhere, or needs to be returned from
  a function (so we avoid another conversion when returning).

Depends on D154617

Differential Revision: https://phabricator.services.mozilla.com/D154618
2022-08-16 22:57:49 +00:00
Gerald Squelart
68a8dee9cc Bug 1784812 - JSONWriter::WriteFunc() returns a reference - r=canaltinova
mWriter is never null (and lots of calls just dereference it without checking),
so we may as well enforce it:
- The constructor MOZ_RELEASE_ASSERTs that it's not null.
- The accessor WriteFunc() returns a reference instead of a scary raw pointer.

(Note that we can't make mWriter a NotNull<...>, because the next patch will
give the option to keep that owning pointer null.)

Differential Revision: https://phabricator.services.mozilla.com/D154616
2022-08-16 22:57:48 +00:00
Norisz Fay
fd1720100c Backed out 3 changesets (bug 1658072) as they are related to previously backed out changeset CLOSED TREE
Backed out changeset 199d3ecfe13c (bug 1658072)
Backed out changeset a942be3d053d (bug 1658072)
Backed out changeset e0e98ee85f98 (bug 1658072)
2022-08-11 02:01:04 +03:00
Norisz Fay
936d025f11 Backed out changeset aaff4b4fd82e (bug 1658072) for causing xpcshell failures on process_watcher_posix_sigchld.cc CLOSED TREE 2022-08-11 01:56:09 +03:00
Jed Davis
30a7fec563 Bug 1658072 - Cleanup: assert that libevent's signal handling code is never used. r=nika
Given that libevent's signal handling code is known to have race
conditions, and there are fundamental issues that make it hard to fix
upstream, and previous patches have removed our last usage of it, we
should assert that it's no longer used.

Differential Revision: https://phabricator.services.mozilla.com/D141312
2022-08-10 21:25:49 +00:00
Jed Davis
1dc9df1d11 Bug 1658072 - Cleanup: remove the signal handling glue in the IPC event loop. r=nika
Now that we're no longer using libevent's signal handling, we don't need
an OO wrapper for it.

Differential Revision: https://phabricator.services.mozilla.com/D141311
2022-08-10 21:25:49 +00:00
Jed Davis
fd0bcff6e5 Bug 1658072 - Cleanup: remove the now-dead DidProcessCrash function. r=nika
The function DidProcessCrash is now dead code.  Before the ProcessWatcher
rewrite, its return value (i.e., whether the process crashed) was never
used, so effectively its only purpose was to make it harder to understand
where the waitpid calls were happening.

Differential Revision: https://phabricator.services.mozilla.com/D141310
2022-08-10 21:25:48 +00:00
Jed Davis
6aee29c7dd Bug 1658072 - Rewrite the Unix implementation of IPC process termination handling. r=nika
This patch rewrites the Unix backend of ProcessWatcher for two reasons:

1. To remove the use of libevent's signal handling, which has concurrency
   bugs that can't be easily fixed upstream (see Bugzilla for details)

2. To simplify the code in general; in particular, the new version has one
   place where the process and its exit status are consumed from the OS

The new implementation uses the same pipe-to-self technique as libevent
(and which we use elsewhere) to deal with async signal safety.  Unlike
the previous version, there is a single object which manages all
monitored child processes rather than one each.  (Previously, this
multiplexing was done inside libevent.)

Differential Revision: https://phabricator.services.mozilla.com/D141309
2022-08-10 21:01:32 +00:00
Nika Layzell
96d76af151 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
Nika Layzell
45397cbfdd Bug 1779792 - Part 4: Deduplicate ProcessChild subclass constructors, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,alwu,mccr8
These constructors are unnecessary and can be defined with a `using` statement,
making it easier to change all constructors simultaneously.

Differential Revision: https://phabricator.services.mozilla.com/D153620
2022-08-10 14:55:23 +00:00
Nika Layzell
2ac29a461a Bug 1779792 - Part 3: Use an endpoint to bind the initial actor in parent processes, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,alwu,mccr8
This improves consistency with the child process case, and will make it easier
to attach additional state without needing to thread it through every child
process callsite manually.

Differential Revision: https://phabricator.services.mozilla.com/D153619
2022-08-10 14:55:22 +00:00
Nika Layzell
d45df271ec Bug 1779792 - Part 2: Use an Endpoint to bind the initial actor in child processes, r=ipc-reviewers,necko-reviewers,media-playback-reviewers,mccr8,alwu
This type is also used in other places to start non-initial actors, and will
allow us to attach additional state more easily without needing to thread it
through every child process callsite manually.

Differential Revision: https://phabricator.services.mozilla.com/D153618
2022-08-10 14:55:22 +00:00
Nika Layzell
263b5e445b Bug 1779792 - Part 1: Use cached value for log ID generation, r=mccr8
Previously this code read the atomic rather than the cached value (which
was unused). This is inherently racy as the atomic is updated on a
different thread than the read happened on.

Differential Revision: https://phabricator.services.mozilla.com/D153617
2022-08-10 14:55:21 +00:00
Mike Hommey
d029bcdd7e Bug 1782988 - Avoid build bustage when building against glibc 2.36 or newer. r=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D153716
2022-08-09 20:42:44 +00:00
Jed Davis
996eb87d1d Bug 1276388 - Use IPC process launching for Subprocess.jsm on Unix. r=kmag,nika,barret
Currently, Subprocess.jsm on Unix uses js-ctypes to call `posix_spawn`.
This has some issues, primarily that file descriptors are inherited by
the child process unless explicitly opted-out, which unfortunately a lot
of code doesn't do.  This patch changes it to use IPC process launching,
where fd inheritance is opt-in, by:

1. Extending `base::LaunchApp` to handle a few features that Subprocess
   needs (setting the process's working directory, specifying the full
   environment, and the macOS `disclaim` flag)

2. Adding a WebIDL method to `IOUtils` to expose that function to JS
   (currently Unix-only; Windows could also be supported but it would
   probably want to use a different IDL type for strings, given that the
   OS APIs use 16-bit code units).

3. Replacing the part of Subprocess that invokes `posix_spawn` (and
   related functions) by calling that method; the rest of Subprocess's
   machinery to manage pipes and I/O is unchanged.  (The Windows backend
   is also unchanged; I'm not aware of any functional issues there.)
   This results in some dead code, which is removed.

Differential Revision: https://phabricator.services.mozilla.com/D152336
2022-08-09 17:32:22 +00:00
Bob Owen
3dd8f8e969 Bug 1782199: Unregister the WER runtime module before returning from main. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D153728
2022-08-08 12:05:00 +00:00
Jim Blandy
7cc4f55f2a Bug 1782871: Correct IPDL documentation in 'Actor Lifetimes in C++' r=nika
Differential Revision: https://phabricator.services.mozilla.com/D153553
2022-08-03 21:32:36 +00:00
Fabrice Desré
c50cb528fc 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
3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel
fdb7cb2ecd 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
Mark Banner
7428be4a86 Bug 1782008 - Remove now unnecessary .eslintrc.js files. r=webcompat-reviewers,extension-reviewers,media-playback-reviewers,pip-reviewers,denschub,rpl,alwu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D152736
2022-08-03 11:16:20 +00:00
Christian Holler
53b78333a2 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
Marian-Vasile Laza
0bebd4fea4 Backed out 4 changesets (bug 1781129) for causing bustages on nsContentUtils.cpp. CLOSED TREE
Backed out changeset 8557305bcd46 (bug 1781129)
Backed out changeset df6f98df9559 (bug 1781129)
Backed out changeset 905393f66985 (bug 1781129)
Backed out changeset 0d0f19a4db70 (bug 1781129)
2022-08-02 23:29:56 +03:00