Commit Graph

48 Commits

Author SHA1 Message Date
Andrew Kaster
4cc3d598f9 LibWebView+LibCore: Manage process lifecycle using a SIGCHLD handler
This large commit also refactors LibWebView's process handling to use
a top-level Application class that uses a new WebView::Process class to
encapsulate the IPC-centric nature of each helper process.
2024-07-01 18:10:56 +02:00
Andrew Kaster
ba4e6dc52b Ladybird: Remove unnecessary RegisterWithProcessManager enum
This was only put in place because on SerenityOS, we wanted to use the
pid of the WebContent process, rather than the peer pid for the socket.

When launching with SystemServer, this got annoying. However, now that
we only have the case that the UI process spawns processes, we can
get rid of this hack. This restores the ability to see WebContent
processes' statistics in the task manager widget.
2024-06-26 16:09:33 -06:00
Andrew Kaster
e7ece774a2 ImageDecoder: Register with mach server on macOS
This allows viewing the resource usage in the task manager widget
2024-06-26 16:09:33 -06:00
Andrew Kaster
4b5541e1b7 Everywhere: Transition ImageDecoder to be single-instance, owned by UI
This is the same behavior as RequestServer, with the added benefit that
we know how to gracefully reconnect ImageDecoder to all WebContent
processes on restart.
2024-06-26 16:09:33 -06:00
Andrew Kaster
343a3a0d7e Ladybird+LibIPC: Move clearing FD_CLOEXEC helper logic to IPC::File 2024-06-26 16:09:33 -06:00
Aliaksandr Kalenik
c46bea479c Everywhere: Hand pid of new process to client in launch_server_process()
Allows WebContentClient to get pid of WebContent process right after
creation, so there is no window between forking and
notify_process_information() IPC response, when client doesn't know the
pid.
2024-06-24 13:09:08 +02:00
Andreas Kling
a3c8e60710 LibWeb: Implement very basic in-memory HTTP caching
This patch adds a simple in-memory HTTP cache to each WebContent
process.

It's currently off by default (turn it on with --enable-http-cache)
since the validation logic is lacking and incomplete.
2024-06-23 09:37:23 +02:00
Aliaksandr Kalenik
0b48c1ea3f Everywhere: Remove AffineCommandExecutorCPU
No need to have it after introduction of Skia painter that supports
transforms.
2024-06-19 17:22:30 +03:00
Aliaksandr Kalenik
25c4355406 Ladybird+LibWeb+WebContent: Add an option to enable Skia painter 2024-06-18 21:05:50 +02:00
Timothy Flynn
d61770c457 LibCore: Remove now-unused singleton process utilities 2024-06-06 11:27:03 -04:00
Timothy Flynn
8362c073f3 Everywhere: Remove LibSQL, SQLServer, and the sql REPL :^)
It is now entirely unused and replaced by sqlite3.
2024-06-06 11:27:03 -04:00
MacDue
9c711bc868 LibWeb+Ladybird: Add option to enable the AffineCommandExecutorCPU
This adds a `--experimental-cpu-transforms` option to Ladybird and
WebContent (which defaults to false/off).

When enabled the AffineCommandExecutorCPU will be used to handle
painting transformed stacking contexts (i.e. stacking contexts where
the transform is something other than a simple translation). The regular
command executor will still handle the non-transformed cases.

This is hidden under a flag as the `AffineCommandExecutorCPU` is very
incomplete now. It missing support for clipping, text, and other basic
commands. Once most common commands have been implemented this flag
will be removed.
2024-05-29 08:17:01 +02:00
Timothy Flynn
56e0cd0b1a Ladybird: Restore ability to run WebContent under callgrind
This broke due to the way we now use posix_spawn under the hood. This
moves the handling of the callgrind option to the launcher helper where
we iterate over the candidate process paths, as we need to augment the
way we fork the process for callgrind based on those paths.

This also opens the door for running other processes under callgrind in
the future.
2024-04-27 15:17:31 +02:00
Timothy Flynn
c11019ebc1 Ladybird: Use Core::Process facilities to spawn singleton processes 2024-04-24 15:51:58 -06:00
Timothy Flynn
9fb84e4693 Ladybird: Use Core::Process facilities to spawn helper processes
Note that WebContent now also uses launch_generic_server_process()
instead of its own implementation.
2024-04-24 15:51:58 -06:00
Timothy Flynn
d2bd692bbe Ladybird: Register RequestServer with the chrome's mach server on macOS
This ensures we register RequestServer with the appropriate mach server
name.
2024-04-22 14:46:10 -06:00
Timothy Flynn
b83babdf8b Ladybird: Register SQLServer with the task manager 2024-04-22 14:46:10 -06:00
Timothy Flynn
f16f89eb32 Ladybird+LibWebView: Move SQLServer launcher to Ladybird
It previously resided in LibWebView to hide the details of launching a
singleton process. That functionality now lives in LibCore. By moving
this to Ladybird, we will be able to register the process with the task
manager.
2024-04-22 14:46:10 -06:00
Shannon Booth
5bf34ecc32 Ladybird: Add an option to enable internals object outside of test mode
Sometimes I like to play around with running Ladybird tests using full
blown Ladybird instead of just headless browser to interactively mess
around with the test page. One problem with this is that the internals
object is not exposed in this mode.

This commit supports this usecase by adding an option to specifically
expose the internals object without needing to run headless-browser
in test mode.
2024-04-22 08:10:08 +02:00
Andrew Kaster
5e1d678bae Ladybird+Userland: Remove use of unnecessary fd passing socket concept
Now that LibIPC is using SCM_RIGHTS properly, we can go back to only
having one socket laying around when needing to transfer fds to peers.
2024-04-19 16:38:55 -04:00
Andrew Kaster
c87e32154a Ladybird+headless-browser: Make RequestServer single instance on Lagom
Co-Authored-By: Timothy Flynn <trflynn89@pm.me>
2024-04-17 10:09:49 -04:00
Andreas Kling
f4f4f7781d Ladybird+LibWeb: Add optional IDL call tracing
When launched with the new --enable-idl-tracing option, we now log
every call to web platform APIs declared via IDL, along with the
arguments passed.

This can be very helpful when trying to figure out what a site is
doing, especially if it's not doing what you'd expect.
2024-04-16 16:57:06 +02:00
Andreas Kling
5f9a905793 Ladybird+LibJS: Add optional logging of *all* JS exceptions
When running with --log-all-js-exceptions, we will print the message
and backtrace for every single JS exception that is thrown, not just
the ones nobody caught.

This can sometimes be very helpful in debugging sites that swallow
important exceptions.
2024-04-16 16:57:06 +02:00
Andrew Kaster
3b5ac433ef Ladybird: Use MachPortServer to get WebContent Mach ports on macOS 2024-04-09 16:43:27 -06:00
Andrew Kaster
fa8b64d59a LibWebView+WebContent: Notify UI process about WebContent PID explicitly
On Serenity, it's not trivial to extract the peer pid from a socket that
is created by SystemServer and then passed to a forked service process.
This patch adds an API to let the WebContent process notify the UI
directly, which makes the WebContent process show up in the Serenity
port's TaskManagerWidget. It seems that we will need to do something of
this sort in order to properly gather metrics on macOS as well, due to
the way that self mach ports work.
2024-04-02 09:52:34 -06:00
Andrew Kaster
096feaaeb8 Ladybird+LibWebView: Add ProcessManager to track live processes
This model will be used to add a Processes tab to the inspector.
2024-04-02 09:52:34 -06:00
Ali Mohammad Pur
6dfb2f9dc8 Everywhere: Merge the WebSocket service into RequestServer
This keeps the APIs separate as they are wildly different, a future
improvement could be to somehow unify the APIs (if possible).

Closes #23080.
2024-03-06 10:07:27 +01:00
Sam Atkins
163a40c539 Ladybird: Use Core::Environment instead of Core::System::*env() 2024-02-27 08:33:48 +00:00
Andrew Kaster
0a55749a39 Ladybird+Userland: Use ByteString for candidate server paths
We've adopted a stance that paths should be ByteStrings rather than
UTF-8 strings, so apply that to the Ladybird helpers.
2024-02-26 13:16:27 -07:00
Andrew Kaster
bb9da0ed8d Ladybird: Plumb overriding root certificate paths through the chromes 2024-02-08 08:49:32 -07:00
Bastiaan van der Plaat
dc2233ef7a Ladybird+WebContent: Add chrome command line and exe path passing 2024-01-17 17:32:05 +01:00
Andrew Kaster
02edd240ae LibWeb+WebContent: Spawn Worker processes from the chrome
Instead of spawning these processes from the WebContent process, we now
create them in the Browser chrome.

Part 1/N of "all processes are owned by the chrome".
2024-01-12 15:53:11 -07:00
Andrew Kaster
1e68e484cc Ladybird: Add command line flag to wait for debugger in WebContent 2023-12-21 19:03:40 +01:00
Timothy Flynn
07e9a8f79b Ladybird+LibWebView: Move options used to launch WebContent to a struct
It is currently a bit messy to pass these options along from main() to
where WebContent is actually launched. If a new flag were to be added,
there are a couple dozen files that need to be updated to pass that flag
along. With this change, the flag can just be added to the struct, set
in main(), and handled in launch_web_content_process().
2023-12-01 20:07:27 -05:00
Aliaksandr Kalenik
b6732b0234 Ladybird+WebContent: Add option to use GPU painter
Adds `--enable-gpu-painting` param to enable painting command executor
that uses LibAccelGfx.
2023-10-29 17:13:23 +01:00
Lucas CHOLLET
5c7e5cc738 Ladybird: Decode images out of process
This patch brings a service to handle image decompression. With it comes
security enhancement due to the process boundary. Indeed, consequences
of a potential attack is reduced as only the decoder will crash without
perturbing the WebContent process.
It also allows us to display pages containing images that we claim to
support but still make us crash, like for not-finished-yet decoders.

As an example, we can now load https://jpegxl.info/jxl-art.html without
crashing the WebContent process.
2023-10-27 07:26:32 +02:00
Andreas Kling
99ac34eeae Ladybird+LibWebView+Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andrew Kaster
7d7c419ce6 Ladybird: Add WebSocket server for use by Lagom networking
Hide its use behind the same flag as RequestServer in WebContent.
2023-08-03 09:55:20 +02:00
Andrew Kaster
a1e5a6ac40 Ladybird: Remove Qt dependency from RequestServer
This requires two parts: Core::System::current_executable_path(), and
passing the serenity-resource-root as an argument to the process.
2023-08-03 09:55:20 +02:00
Andrew Kaster
506b03740c Ladybird: Move classes and types into the Ladybird namespace
We were super inconsistent about this, with most "new" classes living in
the Ladybird namespace, while "old" ones were in the global namespace,
or even sitting in the Browser namespace.
2023-08-03 09:55:20 +02:00
Andrew Kaster
b5bfe732d7 Ladybird: Add RequestServer process to optionally replace Qt Networking
LibTLS still can't access many parts of the web, so let's hide this
behind a flag (with all the plumbing that entails).

Hopefully this can encourage folks to improve LibTLS's algorithm support
:^).
2023-08-02 05:44:43 +02:00
Andrew Kaster
5062ba347b Ladybird+LibWebView: Move Lagom code to Ladybird, Qt code to Utilities
Re-organize our helper files here a bit, to make a clearer distinction
between Qt-specific helpers and generic non-serenity helpers.

A future commit will move Lagom specific code from LibSQL to ladybird
as well, so that we can see about future generic apis for spawning
helper procesess.
2023-08-02 05:44:43 +02:00
Sebastian Zaha
fd86509ef8 Ladybird: Remove unused spawn helper
The spawn_helper_process method was introduced together with
get_paths_for_helper_process but was only ever used briefly to spawn
WebContent. Other helper processes (SqlServer, headless_browser etc)
are either execed or spawned with their own helpers & custom arguments.
2023-08-01 07:36:15 +02:00
Sigmund Lahn
3bc0e7a7ca Ladybird: Look for helper processes at {app_dir}/{helper}/{helper}
Currently, we only look at the relative path `./{helper}/{helper}`,
which fails if the working directory is not the same as the directory
where the ladybird binary lives.
2023-05-31 13:24:49 +02:00
MacDue
63b11030f0 Everywhere: Use ReadonlySpan<T> instead of Span<T const> 2023-02-08 19:15:45 +00:00
MacDue
1c92e6ee9d Ladybird: Don't overwrite argv[0] in spawn_helper_process()
This is already set correctly at the caller.
2023-02-08 19:15:45 +00:00
MacDue
f4236e61bf LibCore: Add const qualifier to exec() argument spans 2023-02-05 16:40:51 +01:00
Andrew Kaster
3e6d790cf0 Ladybird: Abstract spawning helper processes into separate methods
This will let us use the same path discovery methods for WebContent,
SQLServer, and any other helper processes we need to launch.
2023-02-02 05:35:44 -07:00