Commit Graph

60949 Commits

Author SHA1 Message Date
Shannon Booth
b48ba823b9 LibWeb: Implement AudioNode.context
This is just a simple getter which returns the audio context that
created this audio node.
2024-05-04 14:01:38 +02:00
Shannon Booth
97576d27b9 LibWeb: Add constructor for OscillatorNode
This is still missing a bunch of spec steps to construct the
audio node based on the parameters of the OscillatorNode, but it is at
least enough to construct an object to be able to add a basic test which
can get built upon as more is implemented.
2024-05-04 14:01:38 +02:00
Andreas Kling
c8821cf8e0 js: Don't try to call a null Function on SIGINT
This stops `js` from asserting when pressing ^C in the middle of
executing a long-running script.
2024-05-04 13:56:13 +02:00
Shannon Booth
e070309258 LibWeb: Implement Element.outerHTML setter 2024-05-04 13:54:33 +02:00
Shannon Booth
faf33056da LibWeb: Update spec links for outer HTML element attributes
It was moved from the DOM parsing spec to the HTML spec.
2024-05-04 13:54:33 +02:00
Nico Weber
dd020a108a LibGfx/WebP: Rename two variables to be a bit clearer
No behavior change.
2024-05-04 13:46:53 +02:00
Aliaksandr Kalenik
4d5823a5bc LibWeb+LibJS: Skip function environment allocation if possible
If a function has the following properties:
- uses only local variables and registers
- does not use `this`
- does not use `new.target`
- does not use `super`
- does not use direct eval() calls

then it is possible to entirely skip function environment allocation
because it will never be used

This change adds gathering of information whether a function needs to
access `this` from environment and updates `prepare_for_ordinary_call()`
to skip allocation when possible.

For now, this optimisation is too aggressively blocked; e.g. if `this`
is used in a function scope, then all functions in outer scopes have to
allocate an environment. It could be improved in the future, although
this implementation already allows skipping >80% of environment
allocations on Discord, GitHub and Twitter.
2024-05-04 06:48:07 +02:00
Shannon Booth
aede010096 LibWeb: Use GCPtr for Element::layout_node
This improves debuggability by converting a SIGSEGV into a
verification failed on a null dereference.
2024-05-03 20:48:32 +02:00
Sergey Bugaev
67f659bb85 Ports/ObjFW: Disable pledge() support 2024-05-02 16:38:28 +02:00
Sergey Bugaev
e3e9c67ab9 Ports: Update ObjFW to 1.1.2
Now that ObjFW is doing releases regularly, we no longer have to use
a Git snapshot.
2024-05-02 16:38:28 +02:00
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