Commit graph

60939 commits

Author SHA1 Message Date
Sergey Bugaev 0bb37f9c0e AK: Include <features.h> before checking for platform macros
AK/Platform.h did not include any other header file, but expected
various macros to be defined. While many of the macros checked here are
predefined by the compiler (i.e. GCC's TARGET_OS_CPP_BUILTINS), some
may be defined by the system headers instead. In particular, so is
__GLIBC__ on glibc-based systems.

We have to include some system header for getting __GLIBC__ (or not).
It could be possible to include something relatively small and
innocuous, like <string.h> for example, but that would still clutter
the name space and make other code that would use <string.h>
functionality, but forget to include it, build on accident; we wouldn't
want that. At the end of the day, the header that actually defines
__GLIBC__ (or not) is <features.h>. It's typically included from other
glibc headers, and not by user code directly, which makes it unlikely
to mask other code accidentlly forgetting to include it, since it
wouldn't include it in the first place.

<features.h> is not defined by POSIX and could be missing on other
systems (but it seems to be present at least when using either glibc or
musl), so guard its inclusion with __has_include().

Specifically, this fixes AK/StackInfo.cpp not picking up the glibc code
path in the cross aarch64-gnu (GNU/Hurd on 64-bit ARM) Lagom build.
2024-05-02 07:46:53 -06:00
Sergey Bugaev 51707a4dbd LibGfx: Explicitly cast literals to size_t in JBIG2Loader
width is size_t, so 8 should be that too, not unsigned long long.
2024-05-02 07:46:53 -06:00
Sergey Bugaev 9d2d78c57c LibCore: Make MachPort build on GNU Mach 2024-05-02 07:46:53 -06:00
Sergey Bugaev e720eadd9e LibCrypto: Skip the check against 2^32 on 32-bit
We can't have a length that large there. This was causing a build error
about shifting a 32-bit value by 32 bits.
2024-05-02 07:46:53 -06:00
Sergey Bugaev d458471e09 LibPDF: Convert byte offsets to u64
This fixes a build failure on 32-bit.

Suggested-by: Nico Weber <thakis@chromium.org>
2024-05-02 07:46:53 -06:00
Hendiadyoin1 b17f080dcc Kernel/riscv: Use new DeviceTree helpers in PCI initializations
This also changes the PCI interface slightly to be a bit nicer to work
with.
2024-05-02 07:44:13 -06:00
Hendiadyoin1 8ea8b7a6e5 Kernel/MM: Parse /memreserve/ blocks in FDT based memory mapping mode
These seem to be actually used in the RPi FDTs
2024-05-02 07:44:13 -06:00
Hendiadyoin1 2b13769dd5 Kernel/MM: Skip non static reserved memory regions instead of crashing
Crashing seems a bit harsh, so let's just skip them instead, as they
actually show up in the device tree of RPis.
2024-05-02 07:44:13 -06:00
Hendiadyoin1 e014296092 LibDeviceTree: Make DeviceTreeProperty::as_stream return a ValueStream
This new Stream class adds an interface to work in cell-sized chunks,
which is useful for parsing the data in a DeviceTreeProperty.
2024-05-02 07:44:13 -06:00
Hendiadyoin1 ffa9875fa6 LibDeviceTree: Fix stale pointers in phandle and parent handling
We need to set them after we've created the full tree, as otherwise the
HashMap containing the nodes may reallocate and invalidate the pointers.
2024-05-02 07:44:13 -06:00
Hendiadyoin1 b2377f1f9c Meta/run.py: Bring back SERENITY_EXTRA_QEMU_ARGS 2024-05-02 07:44:13 -06:00
Andrew Kaster 5aa28c31d5 CI: Use a local GitHub Action to setup installed packages 2024-05-02 06:22:10 -06:00
Shannon Booth 1678f43c38 LibWeb: Implement BaseAudioContext.createOscillator
Which currently will always throw an exception as it is unimplemented
under the hood - but this gives all of the plumbing we need in order to
create a oscillator node as used in the reduced turnstyle testcase.
2024-05-02 07:49:23 +02:00
Shannon Booth a83f4216a5 LibWeb: Add stub IDL interface for OscillatorNode
This source node generates a periodic wave form.
2024-05-02 07:49:23 +02:00
Shannon Booth c9b2c1c747 LibWeb: Add stub IDL interface for AudioScheduledSourceNode
This is a base class of a few different audio nodes, most notably for
our immediate needs - OscillatorNode.
2024-05-02 07:49:23 +02:00
Shannon Booth 6661c68b28 LibWeb: Add stub IDL interface for AudioNode
An AudioNode is the fundamental building block used in 'Audio
Contexts'. In our immediate case, the audio node we are working towards
implementing is an oscillating source node.
2024-05-02 07:49:23 +02:00
Shannon Booth 5ae0ac7b73 LibWeb: Add stub IDL interface for AudioParam
An AudioParam is a fundamental building block in WebAudio as it controls
the value of an individual parameter of an AudioNode, such as volume.
2024-05-02 07:49:23 +02:00
Shannon Booth b1b7e2324a LibWeb: Add stub IDL interface for PeriodicWave
PeriodicWave represents an arbitrary periodic waveform to be used
with an OscillatorNode.
2024-05-02 07:49:23 +02:00
Andreas Kling 5cb127819c LibJS: Fix build after merging CallFrame removal and finally fixes 2024-05-02 07:42:09 +02:00
Hendiadyoin1 ada5027163 LibJS: Cleanup unwind state when transferring control out of a finalizer
This does two things:
* Clear exceptions when transferring control out of a finalizer
  Otherwise they would resurface at the end of the next finalizer
  (see test the new test case), or at the end of a function
* Pop one scheduled jump when transferring control out of a finalizer
  This removes one old FIXME
2024-05-02 07:27:45 +02:00
Hendiadyoin1 27b238d9af LibJS: Stop swallowing exceptions in finalizers
This also fixes one of the try-catch-finally tests, and adds a new one.
2024-05-02 07:27:45 +02:00
Hendiadyoin1 b4b9c4b383 LibJS: Restore scheduled jumps in catch blocks without finalizers 2024-05-02 07:27:45 +02:00
Hendiadyoin1 301a1fc763 LibJS: Propagate finalizers into nested try-catch blocks without them 2024-05-02 07:27:45 +02:00
Aliaksandr Kalenik 865e651a7d LibJS: Merge CallFrame into ExecutionContext
Before this change both ExecutionContext and CallFrame were created
before executing function/module/script with a couple exceptions:
- executable created for default function argument evaluation has to
  run in function's execution context.
- `execute_ast_node()` where executable compiled for ASTNode has to be
  executed in running execution context.

This change moves all members previously owned by CallFrame into
ExecutionContext, and makes two exceptions where an executable that does
not have a corresponding execution context saves and restores registers
before running.

Now, all execution state lives in a single entity, which makes it a bit
easier to reason about and opens opportunities for optimizations, such
as moving registers and local variables into a single array.
2024-05-02 07:26:13 +02:00
Timothy Flynn 46b8a3afb7 LibWeb: Move the read bytes into ReadLoopReadRequest's success callback
The callback is already specified to take the bytes by value. No need to
copy the bytes here.
2024-05-01 21:46:45 +02:00
Timothy Flynn dce05dd273 LibWeb: Revert using a vector to store each chunk in ReadLoopReadRequest
This reverts commit 12cfa08a09.
2024-05-01 21:46:45 +02:00
Timothy Flynn 6a170e7337 LibWeb: Use the ad-hoc read-all-chunks AO in ReadableStreamPipeTo 2024-05-01 21:46:45 +02:00
Timothy Flynn 6c6fb224ec LibWeb: Add an ad-hoc ReadableStreamDefaultReader::read_all_chunks AO
The ReadableStreamPipeTo AO requires reading all chunks from a stream.
There actually isn't an AO defined to do that, so the "read all bytes"
implementation was changed to provide each chunk in a vector in commit
12cfa08a09.

This change makes reading all bytes a bit more uncomfortable in normal
use cases, as we now have to manually join the vector we receive. This
can also cause churn with huge allocations.

So instead, let's just provide an ad-hoc callback to receive each chunk
as they arrive.
2024-05-01 21:46:45 +02:00
Jamie Mansfield f5799f7d2c LibWeb/Fetch: Append the Fetch metadata headers 2024-05-01 12:57:35 +02:00
Jamie Mansfield e52f444329 LibWeb/Fetch: Implement the "set the Sec-Fetch-User header" AO 2024-05-01 12:57:35 +02:00
Jamie Mansfield 1ff90aa3e0 LibWeb/Fetch: Implement the "set the Sec-Fetch-Site header" AO 2024-05-01 12:57:35 +02:00
Jamie Mansfield 5eb46a5f01 LibWeb/Fetch: Implement the "set the Sec-Fetch-Mode header" AO 2024-05-01 12:57:35 +02:00
Jamie Mansfield f4af1833c1 LibWeb/Fetch: Implement the "set the Sec-Fetch-Dest header" AO 2024-05-01 12:57:35 +02:00
Jamie Mansfield 6e3b2ce300 LibWeb/Fetch: Add to_string function for Request::Mode 2024-05-01 12:57:35 +02:00
Jamie Mansfield 3daba8970c LibWeb/Fetch: Add to_string function for Request::Destination 2024-05-01 12:57:35 +02:00
Jamie Mansfield da8d0d82c0 LibWeb/Fetch: Add "json" destination for JSON modules
This is a change in the Fetch spec.

See:
- https://github.com/whatwg/fetch/commit/49bff76
2024-05-01 12:57:35 +02:00
Andreas Kling 527ad9ac01 LibWeb: Implement XMLHttpRequest.responseURL
This was used on https://twinings.co.uk/ so let's support it :^)
2024-05-01 12:52:03 +02:00
Andreas Kling 34f2cbf202 LibWeb: Honor intrinsic constraints on available space in table widths
When a table's containing block provides min-content or max-content
available space, we now size the table's width accordingly.
2024-05-01 11:13:48 +02:00
Tim Ledbetter 02a8966b61 LibWeb: Serialize empty media rules with a single newline
This deviates from the CSSOM specification but all modern browsers do
this.
2024-05-01 07:21:21 +02:00
Tim Ledbetter a2cccf9420 LibWeb: Use correct spacing when serializing media features
Previously, there was no space between the media feature name and value.
2024-05-01 07:21:21 +02:00
Timothy Flynn 398ae75f9a Ladybird+LibWebView: Introduce a cache for cookies backed by SQL storage
Now that the chrome process is a singleton on all platforms, we can
safely add a cache to the CookieJar to greatly speed up access. The way
this works is we read all cookies upfront from the database. As cookies
are updated by the web, we store a list of "dirty" cookies that need to
be flushed to the database. We do that synchronization every 30 seconds
and at shutdown.

There's plenty of room for improvement here, some of which is marked
with FIXMEs in the CookieJar.

Before these changes, in a SQL database populated with 300 cookies,
browsing to https://twinings.co.uk/ WebContent spent:

    19,806ms waiting for a get-cookie response
    505ms waiting for a set-cookie response

With these changes, it spends:

    24ms waiting for a get-cookie response
    15ms waiting for a set-cookie response
2024-05-01 07:06:26 +02:00
Kemal Zebari 8893836b60 Run: Don't wait for child process to end when adding it to history
When we try to start a long-running child process (e.g. a GUI app)
using a combination of the POSIX spawn and waitpid API, the Run
process ends up waiting for it to end before making any changes
to the path history. This leads to some confusion when trying to
fire up another Run process only to see that it did not save the
path to this program.

This PR resolves this by saving the path after it was created using
the POSIX spawn API.
2024-05-01 06:42:59 +02:00
Andrew Kaster 05731f93b6 LibCore: Don't use designated initializers for struct cmsghdr
This can cause issues with older versions of glibc warning when not
initializing the flexible array member for CMSG_DATA. Such as glibc
shipped with Ubuntu 20.04.
2024-05-01 06:33:00 +02:00
Ali Mohammad Pur 7f39142f0f Meta: Show GML formatting issues after lint 2024-04-30 17:46:41 -06:00
Ali Mohammad Pur eaa2d69d73 LibGUI+Everywhere: Rename the 'style' frame property to 'frame_style'
'set_frame_style' is what Frame itself uses to set the value, and a
significant number of GML files use 'frame_style' instead of just
'style', so let's switch to it and use it everywhere consistently.
2024-04-30 17:46:41 -06:00
Ali Mohammad Pur f3a4118aee GMLCompiler+LibGUI: Add support for object properties and undo hack
Previously the GML compiler did not support object properties such as
`content_widget: @GUI::Widget{}` for GUI::ScrollableContainerWidget;
this commit adds support for such properties by simply calling
`set_<key>(<TProperty>&)` on the object.
This commit also removes the previous hack where
ScrollableContainerWidget was special-cased to have its singular child
used as the content widget; the only GML file using this behaviour was
also changed to be in line with 'proper' GML as handled by the GML
Playground.
2024-04-30 17:46:41 -06:00
Ali Mohammad Pur 5c17b61378 GMLCompiler: Use synthetic widget definition when original is missing
This makes it possible to use externally defined toplevel widgets that
have no C++ header defining them.
Note that this only allows widget-native properties on the object, as
the actual original definition is not available.
2024-04-30 17:46:41 -06:00
Timothy Flynn 4b51a36044 Browser: Add support for a singleton chrome process
This partially supports the WebView::ChromeProcess mechanics. New
windows aren't totally supported and will just open a new tab for now.

When launched via the Browser's AppFile (either through quick launch or
the desktop shortcut), a new window will be requested.
2024-04-30 17:43:14 -06:00
Timothy Flynn 3990e630f2 FileManager: Launch applications with their AppFile-specified arguments
We should really use Core::Process here, but it does not yet support all
posix_spawn features we are currently using.
2024-04-30 17:43:14 -06:00
Timothy Flynn 7dd961c39f LibDesktop+LaunchServer: Propagate AppFile arguments over IPC
This will allow clients (namely FileManager) to use the arguments
specified in the AppFile.
2024-04-30 17:43:14 -06:00