Commit Graph

8232 Commits

Author SHA1 Message Date
Nika Layzell
d0b6b794db Bug 1908725 - Part 5: Add additional validation for early-startup command line checks, r=ipc-reviewers,mccr8
This patch adjusts the various places where we initialize content
processes to call SetGeckoProcessType as early as possible, and be more
consistent. After this change we should only ever set GeckoProcessType
and GeckoChildID once per-process (with the exception of the fork server
process).

In addition to this validation, some more checks around the fork server
were added, such as to prevent forking another forkserver, or forking a
non-content process.

As part of this change, there was some refactoring/cleanup done, such as
removing plugin-container.cpp and content_process_main, as compared to
the other duplicated code between the two call-sites, the duplication
was relatively small, and inlining it helped make things more readable.

Differential Revision: https://phabricator.services.mozilla.com/D218471
2024-08-07 20:39:41 +00:00
Nika Layzell
bdb401316d Bug 1908725 - Part 2: Make the ChildID available in the same places as OtherPid, r=ipc-reviewers,media-playback-reviewers,win-reviewers,alwu,rkraesig,gfx-reviewers,mccr8,nical
This requires quite a bit of piping to get the ChildID passed everywhere where
we currently pass the pid in IPC. This is done by adding a new struct type
(EndpointProcInfo), which is passed around instead of OtherPid in these places,
and contains the full pid.

In most cases, it was a fairly painless change to move over, however in some
cases, more complex changes were required, as the pid was being stored
previously in something like an Atomic<...>, and needed to be switched to using
a mutex-protected value.

In the future, it may be possible to remove OtherPid from IPDL actors once
everything is migrated to ChildID, but we're still a long way off from that, so
for now we unfortunately need to pass both around.

Differential Revision: https://phabricator.services.mozilla.com/D217118
2024-08-07 20:39:39 +00:00
Nika Layzell
008c780b6b Bug 1908725 - Part 1: Introduce GeckoChildID, r=glandium,ipc-reviewers,mccr8
The new GeckoChildID type introduced in this patch is inspired by the existing
ContentParentID type used by ContentParent, but is currently distinct. It is
supported by all process types at the GeckoChildProcessHost level and can be
read for the current process from anywhere.

As this type is similar in many ways to the process type, and should be
available as early as possible within child processes, this was added alongside
the GeckoProcessType value within mozglue to make that easier to do.

The type was chosen to be an int32_t to make it feel similar to a PID, which we
currently use for process identity comparisons across the codebase. The
intention is for GeckoChildID to be preferred for these within-gecko checks, as
these IDs will not be re-used and can be known earlier during child process
creation.

Differential Revision: https://phabricator.services.mozilla.com/D217117
2024-08-07 20:39:39 +00:00
Alex Franchuk
ab8fa1ab81 Bug 1454819 - Simplify SharedMemory classes r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D217487
2024-08-06 18:16:08 +00:00
Noemi Erli
333a6c0ada Backed out changeset e5864b976c3b (bug 1454819) for causing build bustages in SharedMemory.cpp CLOSED TREE 2024-08-05 18:08:32 +03:00
Alex Franchuk
0a72f7d63c Bug 1454819 - Simplify SharedMemory classes r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D217487
2024-08-05 13:01:33 +00:00
Alexandre Lissy
a03d3e4c15 Bug 1909125 - Fix FDs situation to ensure prefs map will not collide r=nika
Differential Revision: https://phabricator.services.mozilla.com/D218181
2024-08-05 08:11:45 +00:00
Chun-Min Chang
94dcabe01e Bug 1865896 - Apply DefineEnum to CryptoScheme r=media-playback-reviewers,padenot
Depends on D204451

Differential Revision: https://phabricator.services.mozilla.com/D204452
2024-07-31 00:09:56 +00:00
Mike Conley
25f9fbf8d0 Bug 1908002 - Allow LockManager to be constructed in the parent process with the system principal and loaded in modules. r=saschanaz,smaug
Differential Revision: https://phabricator.services.mozilla.com/D216614
2024-07-30 14:51:26 +00:00
Kelsey Gilbert
45ebc1fdb7 Bug 1885245 - Remove PlainOldDataSerializer. r=mccr8
There's no sufficiently robust way to identify POD types in C++, such
that we could rely on this kind of thing for serialization.

As one example, `bool` must be carefully handled on deserialize, in case
an attacker wants to exploit the UB of bool with value 2.
Additionally, generally it's not viable to tell whether all the members
of a struct are PODs as well, and we need that level of assurance
recursively!

So we instead lean on e.g. ParamTraits_TiedFields/_IsEnumCase for our
extreme robustness requirements.

Differential Revision: https://phabricator.services.mozilla.com/D217518
2024-07-27 22:40:39 +00:00
Kelsey Gilbert
6eef1eadb7 Bug 1909018 - Migrate gfx/vr off PlainOldDataSerializer. r=mccr8,nika
Differential Revision: https://phabricator.services.mozilla.com/D217185
2024-07-24 21:44:28 +00:00
Stanca Serban
bd45da6569 Backed out changeset 2196c38d57e7 (bug 1909018) for causing build bustages in VRShMem.cpp. 2024-07-24 04:11:24 +03:00
Kelsey Gilbert
ed0d1b9289 Bug 1909018 - Migrate gfx/vr off PlainOldDataSerializer. r=mccr8,nika
Differential Revision: https://phabricator.services.mozilla.com/D217185
2024-07-24 00:24:46 +00:00
Sylvestre Ledru
45030f6970 Bug 1519636 - Reformat recent changes to the Google coding style r=emilio,necko-reviewers,geckoview-reviewers,application-update-reviewers,media-playback-reviewers,devtools-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,migration-reviewers,padenot,mconley,nchevobbe,kershaw,gstoll,mstange,bytesized,m_kato
This new version of clang 17 also slightly changed the formatting.

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D215914
2024-07-17 11:15:31 +00:00
Nika Layzell
1ee5073e80 Bug 1907412 - Stop using AlignedStorage in IPDL unions, r=ipc-reviewers,mccr8
In more recent versions of C++, it is possible to declare a C union with
non-POD members, so long as there is an explicit destructor/constructor
responsible for managing the members.

This patch switches to using the variant types directly within the
union, rather than using AlignedStorage to store inline members. This
requires some tweaks to how the union is declared (specifically, it must
be an anonymous inline union so that it shares the main union type's
constructor/destructor, otherwise explicit ctors/dtors would need to be
declared for the bare union type).

Overall, this change should make no functional difference.

Differential Revision: https://phabricator.services.mozilla.com/D216329
2024-07-15 21:33:37 +00:00
Ray Kraesig
5f27dd7061 Bug 1907454 - [1/1] Send ActorDestroyReason up into telemetry r=ipc-reviewers,nika
File-picker telemetry shows that most failures to open the file dialog
remotely arise in `UtilityProcessHost::OnChannelClosed`. This ultimately
derives from `IProtocol::ActorDisconnected()`, which is called from many
points, mostly generated code.

Rather than jumping in and writing error-propagation code all the way
back up the stack, send what little information we can easily access up
to the file-picker failure telemetry; this should narrow down what
portion of the code we need to look at to determine the root cause of
these failures.

Differential Revision: https://phabricator.services.mozilla.com/D216350
2024-07-15 18:43:14 +00:00
Ray Kraesig
491e97395e Bug 1884426 - [4/6] Add test for file-picker crash notification r=Gijs,firefox-desktop-core-reviewers
Test that the file-picker-crashed notification appears when the
file-picker utility process is terminated with a file-picker dialog
active.

Differential Revision: https://phabricator.services.mozilla.com/D215980
2024-07-09 22:16:56 +00:00
Joel Maher
3d4dfe804d Bug 1903845 - Add 'os_integration' tags to test manifests for faster image verification. r=aryx,jgilbert,settings-reviewers,media-playback-reviewers,sessionstore-reviewers,places-reviewers,omc-reviewers,migration-reviewers,padenot,dao,aminomancer,Standard8,mconley
Differential Revision: https://phabricator.services.mozilla.com/D214969
2024-07-09 13:01:55 +00:00
Greg Stoll
6ba11a66b8 Bug 1901197: do synchronous Content Analysis for clipboard operations on a background thread r=dlp-reviewers,ipc-reviewers,handyman
Differential Revision: https://phabricator.services.mozilla.com/D215457
2024-07-04 01:24:53 +00:00
Sandor Molnar
3f11cda5a4 Backed out 5 changesets (bug 1672493) for causing serviceworker related perma failures. CLOSED TREE
Backed out changeset a38e64bdda2c (bug 1672493)
Backed out changeset b4e568bfb9c7 (bug 1672493)
Backed out changeset 4f1ee5c1e441 (bug 1672493)
Backed out changeset e05276c441ef (bug 1672493)
Backed out changeset e80cf5cf2fe5 (bug 1672493)
2024-06-27 13:02:33 +03:00
Eden Chuang
b941609cc4 Bug 1672493 - P1 Let PRemoteWorkerService manage PRemoteWorker. r=asuth
Currently, PRemoteWorker is managed by PBackground, which should be the same as the manager of the corresponding PRemoteWorkerService. Since the PBackground is gotten from PRemoteWorkerService.

This patch makes PRemoteWorkerService directly manage the PRemoteWorker.

PRemoteWorker will handle the life-cycle-related operations of RemoteWorkers, it might be renamed in the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D196946
2024-06-27 09:07:40 +00:00
Jan-Niklas Jaeschke
091c1ba3aa Bug 1888756, part 3 - Text Fragments: Preserve information if a load is a same-document load in nsILoadInfo. r=farre,dom-core,necko-reviewers,kershaw,peterv
This commit is a prerequisite for part 5 of this patch set.

There is no changed behavior in this commit.

Differential Revision: https://phabricator.services.mozilla.com/D212818
2024-06-26 14:24:32 +00:00
Jan-Niklas Jaeschke
0221e167ca Bug 1888756, part 1 - Text Fragments: Introduce textDirectiveUserActivation flag. r=edgar,dom-core
This commit is a prerequisite for part 5 of this patch set
and introduces the `text directive user activation` flag
as well as the necessary boilerplate to transport the value
through process boundaries in `nsDocShellLoadState` and `LoadInfo`.

There is no changed behavior in this commit.

Differential Revision: https://phabricator.services.mozilla.com/D212816
2024-06-26 14:24:31 +00:00
Nika Layzell
933bd0ea88 Bug 1901851 - Part 3: Make PRemoteWorkerService a toplevel actor which manages PRemoteWorker, r=dom-worker-reviewers,asuth
This enables the PRemoteWorkerService to be created by the parent process
instead of by the content process, which is useful as the parent process is the
party initiating remote worker actions.

Differential Revision: https://phabricator.services.mozilla.com/D213333
2024-06-24 23:19:26 +00:00
Nika Layzell
c04b7872be Bug 1901851 - Part 1: Add BackgroundParent::GetBackgroundThread, r=dom-worker-reviewers,ipc-reviewers,asuth,mccr8
Previously the identity of the BackgroundParent thread was hidden to encourage
all communication with that thread, including communication within the parent
process, to go over PBackground. This has not born out as effective in
practice, however.

By exposing the thread's identity through a getter available on the background
or main thread, we can simplify the process of dispatching a runnable to the
background thread. This will be useful later in this bug as some actors are
migrated off of PBackground, but still need to run on that thread.

Differential Revision: https://phabricator.services.mozilla.com/D213311
2024-06-24 23:19:26 +00:00
Christoph Kerschbaumer
811a0a736d Bug 1883954: Update, improve and unify HTTPS Telemetry, r=freddyb,kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D212661
2024-06-24 12:56:31 +00:00
Tom Schuster
6613ec7689 Bug 1904004 - Use OriginAttributes::IsPrivateBrowsing instead of open coding PBM checks. r=timhuang,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,necko-reviewers,kershaw,dom-storage-reviewers,janv,canaltinova,dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D214532
2024-06-24 11:06:18 +00:00
Aron Cseh
a18d79db16 Backed out 9 changesets (bug 1901851, bug 1728331) for causing remote worker crashes. a=backout
Backed out changeset 30bbda0eb197 (bug 1728331)
Backed out changeset dabd7d6836c8 (bug 1728331)
Backed out changeset 9e04f49c926e (bug 1728331)
Backed out changeset 779ac735736c (bug 1728331)
Backed out changeset 1d413fe340a0 (bug 1728331)
Backed out changeset 15608efcbeb6 (bug 1901851)
Backed out changeset f711bbec11b2 (bug 1901851)
Backed out changeset 8bb1d267d08f (bug 1901851)
Backed out changeset b29282956a04 (bug 1901851)
2024-06-22 00:52:24 +03:00
Sebastian Hengst
7f7ea528f7 Backed out 7 changesets (bug 1888756) for potentially causing Session History crashes. a=backout
Backed out changeset 85022f2e4129 (bug 1888756)
Backed out changeset 1458ad53d229 (bug 1888756)
Backed out changeset a84d886d8753 (bug 1888756)
Backed out changeset efff3e5e95c2 (bug 1888756)
Backed out changeset 400a8ff57ae4 (bug 1888756)
Backed out changeset 04180e2fb99d (bug 1888756)
Backed out changeset 0eb8b13b0717 (bug 1888756)
2024-06-21 12:08:58 +02:00
Nika Layzell
b129c759f4 Bug 1901851 - Part 3: Make PRemoteWorkerService a toplevel actor which manages PRemoteWorker, r=dom-worker-reviewers,asuth
This enables the PRemoteWorkerService to be created by the parent process
instead of by the content process, which is useful as the parent process is the
party initiating remote worker actions.

Differential Revision: https://phabricator.services.mozilla.com/D213333
2024-06-20 19:24:49 +00:00
Nika Layzell
90885afac2 Bug 1901851 - Part 1: Add BackgroundParent::GetBackgroundThread, r=dom-worker-reviewers,ipc-reviewers,asuth,mccr8
Previously the identity of the BackgroundParent thread was hidden to encourage
all communication with that thread, including communication within the parent
process, to go over PBackground. This has not born out as effective in
practice, however.

By exposing the thread's identity through a getter available on the background
or main thread, we can simplify the process of dispatching a runnable to the
background thread. This will be useful later in this bug as some actors are
migrated off of PBackground, but still need to run on that thread.

Differential Revision: https://phabricator.services.mozilla.com/D213311
2024-06-20 19:24:48 +00:00
Andreas Farre
02ca49e84a Bug 1890748 - Move responsibility of FeaturePolicy initialization to nsILoadInfo. r=freddyb,necko-reviewers,jesup,dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D207140
2024-06-20 13:22:41 +00:00
Jan-Niklas Jaeschke
bf4be2e041 Bug 1888756, part 1 - Text Fragments: Introduce textDirectiveUserActivation flag. r=edgar,dom-core
This commit is a prerequisite for part 5 of this patch set
and introduces the `text directive user activation` flag
as well as the necessary boilerplate to transport the value
through process boundaries in `nsDocShellLoadState` and `LoadInfo`.

There is no changed behavior in this commit.

Differential Revision: https://phabricator.services.mozilla.com/D212816
2024-06-20 10:24:25 +00:00
Stanca Serban
92d2016aa1 Backed out 2 changesets (bug 1883954) for causing mochitests failures in browser_schemeless.js. CLOSED TREE
Backed out changeset 790cb078bb3b (bug 1883954)
Backed out changeset 6d1d98d0e69c (bug 1883954)
2024-06-20 12:23:53 +03:00
Christoph Kerschbaumer
5d2889b7ba Bug 1883954: Update, improve and unify HTTPS Telemetry, r=freddyb,kershaw,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D212661
2024-06-20 07:12:47 +00:00
Cristian Tuns
535119812a Backed out 8 changesets (bug 1901851, bug 1728331) for causing bc failures in browser_docshell_type_editor.js CLOSED TREE
Backed out changeset 2cf5cad90099 (bug 1728331)
Backed out changeset d920c2d72d00 (bug 1728331)
Backed out changeset 9e5bd0186aa6 (bug 1728331)
Backed out changeset 45735575df21 (bug 1728331)
Backed out changeset fbafea1663e3 (bug 1901851)
Backed out changeset 30bdf88d3bb7 (bug 1901851)
Backed out changeset 1d994915bd71 (bug 1901851)
Backed out changeset 0b3249432b9c (bug 1901851)
2024-06-19 20:51:53 -04:00
Nika Layzell
8bae7896ac Bug 1901851 - Part 3: Make PRemoteWorkerService a toplevel actor which manages PRemoteWorker, r=dom-worker-reviewers,asuth
This enables the PRemoteWorkerService to be created by the parent process
instead of by the content process, which is useful as the parent process is the
party initiating remote worker actions.

Differential Revision: https://phabricator.services.mozilla.com/D213333
2024-06-19 20:14:48 +00:00
Nika Layzell
165ac4fbf2 Bug 1901851 - Part 1: Add BackgroundParent::GetBackgroundThread, r=dom-worker-reviewers,ipc-reviewers,asuth,mccr8
Previously the identity of the BackgroundParent thread was hidden to encourage
all communication with that thread, including communication within the parent
process, to go over PBackground. This has not born out as effective in
practice, however.

By exposing the thread's identity through a getter available on the background
or main thread, we can simplify the process of dispatching a runnable to the
background thread. This will be useful later in this bug as some actors are
migrated off of PBackground, but still need to run on that thread.

Differential Revision: https://phabricator.services.mozilla.com/D213311
2024-06-19 20:14:47 +00:00
Bob Owen
caa2cde4ba Bug 1901554 p1: Call CoTaskMemFree directly from combase.dll for MFTEncoder. r=padenot
This prevents us from having to preload ole32.dll and all of its associated
dependencies.

Differential Revision: https://phabricator.services.mozilla.com/D213256
2024-06-14 10:39:55 +00:00
Alexandre Lissy
36d4a7d5b2 Bug 1884378 - SandboxProfiler integration within processes r=padenot,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D213216
2024-06-14 10:17:38 +00:00
Christian Holler (:decoder)
e0ae53527b Bug 1896638 - Export some IPDL information as JSON. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D210326
2024-06-07 10:22:48 +00:00
Gregory Pappas
cbbb4fb827 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
Jed Davis
68fdfb66c4 Bug 1837550 - Re-enable tests. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D212643
2024-06-06 02:15:18 +00:00
Jed Davis
e2a4fdb72f Bug 1837550 - Clean up control flow in WaitableEvent. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D212642
2024-06-06 02:15:18 +00:00
Dana Keeler
777066906a Bug 1900132 - streamline PVerifySSLServerCert protocol r=jschanck
Previously the PVerifySSLServerCert protocol consisted of two functions: one to
call when certificate verification succeeded, and another to call upon failure.
This was unnecessary, as the code before and after this protocol didn't have
the same split. This patch unifies the protocol to better match the surrounding
code. It also takes the opportunity to make use of some IPC helpers to
serialize enums rather than manually casting to and from basic integer types.

Differential Revision: https://phabricator.services.mozilla.com/D212594
2024-06-05 23:58:02 +00:00
Otto Länd
ee23dcd890 Bug 1884221, 1895375: apply code formatting via Lando
# ignore-this-changeset
2024-05-30 18:30:24 +00:00
Ray Kraesig
fce1a86177 Bug 1895375 - [4/4] Propagate ipc::LaunchErrors to callers r=ipc-reviewers,nika
* Adjust UtilityProcess{Host,Manager} to propagate ipc::LaunchErrors for
  their clients, or to create new ones where none previously existed.

* Adjust the various clients of the above to to handle the additional
  information -- mostly by adding the additional failure-location data
  to log messages.

* Fix an unrelated bug wherein the return type of `LaunchProcess` was
  declared as exclusive, despite being cached and reused.

In particular, filedialog::Error objects should now contain -- and report
to telemetry without further adjustment -- the actual error code from
`ipc::LaunchError`s.

(Reporting the original failure location as well will occur in bug
1884221.)

Differential Revision: https://phabricator.services.mozilla.com/D209715
2024-05-30 17:52:09 +00:00
Ray Kraesig
f6411a2366 Bug 1895375 - [1/4] Adjust types associated with ipc::LaunchError r=ipc-reviewers,win-reviewers,gstoll,nika
As the intended use for LaunchError::mFunction is telemetry, avoid the
possibility of accidental exfiltration of PII by requiring that
LaunchError be constructed from `StaticString`.

Additionally, remove the Windows-specific constructor overloads in favor
of an explicit factory function, and explicitly document that `mError`
is a generic bag of bits rather than any kind of strict error type.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D209712
2024-05-30 17:52:07 +00:00
alwu
6a5f6b7c2a Bug 1898588 - part5 : remove encryption scheme per key system. r=jolin
As we've added encryption scheme per content type in previous patches,
there is no need to keep this old encryption scheme.

Differential Revision: https://phabricator.services.mozilla.com/D211793
2024-05-29 18:27:04 +00:00
alwu
01ff3ac17a Bug 1898588 - part2 : remove duplicated method 'EncryptionSchemeStr'. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D211643
2024-05-29 18:27:03 +00:00