Commit Graph

60913 Commits

Author SHA1 Message Date
Liav A.
2bba9411ca Kernel: Use the AK SetOnce container class in various cases
We have many places in the kernel code that we have boolean flags that
are only set once, and never reset again but are checked multiple times
before and after the time they're being set, which matches the purpose
of the SetOnce class.
2024-04-26 23:46:23 -06:00
Liav A.
122c82a2a1 AK: Add the SetOnce class
The SetOnce class is meant to be used as one-time set boolean flag,
which is useful for flags that change only once and then stay immutable
forever.
2024-04-26 23:46:23 -06:00
Shannon Booth
de2cad02aa LibWeb: Factor out a function to generate IDL enumerations
The prototype header generation was getting a bit long.

This is also a step towards generating code for IDL files only
containing an enum definition without any interface. In that case we
can't put the enum definitions alongside the prototype - there is no
prototype to speak of.
2024-04-27 07:11:02 +02:00
Shannon Booth
4a62268d73 LibWeb: Do not handle an invalid enum in idl_enum_to_string
We should never hit this case - so don't generate code for it, and
instead put in a VERIFY_NOT_REACHED.

Also improve the formatting of the generated code to closer match the
serenity code style.
2024-04-27 07:11:02 +02:00
Shannon Booth
10add8aa8a LibWeb: Improve error message for IDL generation with missing interface
Instead of a cryptic error that occurs due to an interface with no name,
fail early on by explicitly checking that an interface was parsed with a
name.
2024-04-27 07:11:02 +02:00
Shannon Booth
91efa1d568 LibWeb: Add skeleton for OfflineAudioContext
Implement enough to construct the object itself, with most parts stubbed
out.
2024-04-27 07:11:02 +02:00
Shannon Booth
d27b70ae24 LibWeb: Add HTML event 'complete' 2024-04-27 07:11:02 +02:00
Aliaksandr Kalenik
613cd6104d LibWeb: Support masking of SVGForeignObjectPaintable 2024-04-27 07:10:20 +02:00
Aliaksandr Kalenik
7d05fe84bc LibWeb: Add layout node and paintable for SVGForeignObjectElement
Introduces separate layout and paintable type for foreign element.
It is necessary to inherit SVGForeignObjectPaintable from SVGMaskable
in upcoming changes.
2024-04-27 07:10:20 +02:00
Aliaksandr Kalenik
acd5369774 LibWeb: Separate svg mask calculation into SVGMaskable
Preparation work before adding support for SVGForeignObjectElement
masking.

Having a mixin makes possible sharing mask calculation between
SVGForeignObjectElement's paintable and SVGGraphicsPaintable.

Both has to support masking:
- PaintableWithLines (from SVGForeignObjectElement) -> PaintableBox
- SVGGraphicsPaintable -> SVGPaintable -> PaintableBox

After this change it will be possible to introduce a new paintable type
for foreignObject that inherits from both PaintableWithLines and
SVGMaskable.
2024-04-27 07:10:20 +02:00
Nico Weber
88d0702763 AK: Make ceil_div() handle one argument being negative correctly
`ceil_div(-1, 2)` used to return -1.
Now it returns 0, which is the correct ceil(-0.5).

(C++'s division semantics have floor semantics for numbers > 0,
but ceil semantics for numbers < 0.)

This will be important for the JPEG2000 decoder eventually.
2024-04-27 07:09:08 +02:00
Nico Weber
f2ebad11a8 Tests/AK: Add some basic ceil_div() tests 2024-04-27 07:09:08 +02:00
Timothy Flynn
c9a461ee75 LibWeb: Remove OOM propagation from Fetch::Infrastructure::HTTP 2024-04-27 07:08:14 +02:00
Timothy Flynn
1ffda6a805 LibWeb: Propagate OOM in Body::fully_read() through its error callback
Fetched bodies can be on the order of gigabytes, so rather than crashing
when we hit OOM here, we can simply invoke the error callback with a DOM
exception. We use "UnknownError" here as the spec directly supports this
for OOM errors:

    UnknownError: The operation failed for an unknown transient reason
                  (e.g. out of memory).

This is still an ad-hoc implementation. We should be using streams, and
we do have the AOs available to do so. But they need to be massaged to
be compatible with callers of Body::fully_read. And once we do use
streams, this function will become infallible - so making it infallible
here is at least a step in the right direction.
2024-04-27 07:08:14 +02:00
Timothy Flynn
ec5988d56b LibWeb: Mark the task in the success steps of reading a body as mutable
Otherwise, the `move(bytes_copy)` in the body of the steps does not
actually act as a `move`.
2024-04-27 07:08:14 +02:00
Timothy Flynn
5f51a11618 LibWeb: Remove OOM propagation from Fetch::Infrastructure::Responses 2024-04-27 07:08:14 +02:00
Timothy Flynn
5a4f13dcd4 LibWeb: Remove OOM propagation from Fetch::Infrastructure::Requests 2024-04-27 07:08:14 +02:00
Timothy Flynn
b3032befe0 LibWeb: Remove OOM propagation from Fetch::Infrastructure::Methods 2024-04-27 07:08:14 +02:00
Timothy Flynn
c79f46fe6f LibWeb: Remove OOM propagation from Fetch::Infrastructure::Headers 2024-04-27 07:08:14 +02:00
Dan Klishch
2925fcd4bc Userland: Compile a special version of LibELF for DynamicLoader
... instead of shamelessly stealing its sources.
2024-04-26 19:08:13 -06:00
Dan Klishch
be9ca65179 Meta: Use stripped-down version of LibELF on Lagom 2024-04-26 19:08:13 -06:00
Dan Klishch
7b88363490 Meta+Userland: Make LibELF a proper library on Serenity
Dynamically loaded LibC doesn't need LibELF definitions, so let's not
put them there.
2024-04-26 19:08:13 -06:00
Dan Klishch
19206f75ee DynamicLoader: Ensure that optimizer won't interfere with early init 2024-04-26 19:08:13 -06:00
Sönke Holz
01f1d2daaa Kernel/riscv64: Don't clobber the boot info argument in enable_paging
"register asm" variables don't preserve the register value, so the call
to calculate_physical_to_link_time_address_offset in the asm input
operands is allowed to clobber a0.
2024-04-26 15:01:31 -06:00
Tim Ledbetter
1127fa1e01 IDLGenerators: Set namespace object prototype to Object.prototype
Previously, namespace objects were constructed with no prototype, so
calling methods like `toString()` on them would unexpectedly throw an
exception.
2024-04-26 20:02:42 +02:00
Tim Ledbetter
dda730c46b LibWeb: Exclude [Global] interfaces from legacy platform object method
Previously, [Global] interfaces were not excluded from the
`internal_own_property_keys()` call. This caused a crash when iterating
over the properties of the Window object.
2024-04-26 20:02:21 +02:00
Andreas Kling
ff9ae5ff40 LibWeb: Bring document & browsing context creation in line with spec
We had drifted away from the spec steps a little bit here. This patch
brings us back in line and knocks off some FIXMEs in the process.
2024-04-26 20:01:58 +02:00
Andreas Kling
a5c62b953f LibWeb: Take care of some FIXMEs in auxiliary browsing context creation 2024-04-26 20:01:58 +02:00
Andreas Kling
0ebfc0a4c4 LibWeb: Move event handling & cursor from BrowsingContext to Navigable
This was a long standing FIXME since the introduction of navigables.
2024-04-26 20:01:58 +02:00
Andreas Kling
9cd4a65071 LibWeb: Move TraversableNavigable::m_page up to Navigable
This will allow anyone who has a Navigable to reach the Page.
2024-04-26 20:01:58 +02:00
Aliaksandr Kalenik
dc4192c149 LibWeb: Remove CSS transform from InlinePaintable's clip rectangle
Fixes bug when CSS transform is applied twice to clip rect:
- While calculating absolute clip rectangles in `refresh_clip_state()`
- While executing `PushStackingContext` painting command.

Duplicated transform is already removed for PaintableBox and this change
adds this for InlinePaintable.
2024-04-26 18:40:45 +02:00
Timothy Flynn
13422b5116 LibWeb: Remove OOM error propagation from HTMLMediaElement (and friends) 2024-04-26 12:21:57 -04:00
Timothy Flynn
dd16ea87c3 LibWeb: Make HTMLMediaElement::set_decoder_error infallible
This used to propagate an OOM error, but that was removed, and this
method can no longer throw.
2024-04-26 12:21:57 -04:00
MINAqwq
7c54a32870 LibWeb: Set decoder error when decoding fails 2024-04-26 11:48:48 -04:00
Ali Mohammad Pur
2f10243fa2 LibTLS: Ignore empty reads from underlying socket while connecting
We should not expect the server to respond immediately after connecting,
this can manifest as random requests failing (e.g. on https://null.com).
2024-04-26 15:53:00 +02:00
Timothy Flynn
6f90495512 ImageDecoder: Add the 'thread' pledge for background actions 2024-04-26 09:29:02 -04:00
Timothy Flynn
ab602cfc2c Kernel: Colorize log message for capabilities that have not been pledged
The log message can be hard to spot in a sea of debug messages. Colorize
it to make the message more immediately pop out.
2024-04-26 09:29:02 -04:00
Tim Ledbetter
4d9b6645d7 LibIDL: Remove unused required_imported_paths field from Interface 2024-04-26 08:00:32 -04:00
Tim Ledbetter
3eb07a9b8b IDLGenerators: Don't duplicate include statements for each import
Previously, all `#import` statements generated two identical includes
in the generated C++ source code.
2024-04-26 08:00:32 -04:00
Tim Ledbetter
fcf1a2a287 LibWeb: Remove data from WebAssembly cache when namespace is finalized
Previously, the cache held on to data for objects that had already been
garbage collected.
2024-04-26 13:56:39 +02:00
Tim Ledbetter
ddd1ac1e36 LibWeb: Add a custom extended attribute for namespace-level finalization
This change adds the `WithFinalizer` extended attribute, which allows
namespaces to call a custom function at the point they are finalized.
2024-04-26 13:56:39 +02:00
Tim Ledbetter
6d4b8bde55 LibWeb: Isolate WebAssembly cache by global object
This change moves WebAssembly related data that was previously globally
accessible into the `WebAssemblyCache` object and creates one of these
per global object. This ensures that WebAssembly data cannot be
accessed across realms.
2024-04-26 13:56:39 +02:00
Tim Ledbetter
5e75afd549 LibWeb: Fix typo in extended WithGCVisitor extended attribute name 2024-04-26 13:56:39 +02:00
Shannon Booth
baaaa0008e LibWeb: Look for first ID _or_ name in HTMLCollection::named_item
Previously we would look for a matching ID, and then for a matching
name. If there was an element in the collection which had a matching ID
as well as an element with a matching name, we would always return the
element with a matching ID irrespective of what order that element was
in.
2024-04-26 07:44:01 -04:00
Andreas Kling
e6c0b4631f WebContent: Send tooltip screen location in device coordinate space
This makes tooltips pop up in the right location when zoomed in and
using the Qt chrome.
2024-04-26 10:42:18 +02:00
Andreas Kling
a4625e3943 LibWeb: Only react to link element attribute changes when BC connected
Link elements that aren't "browsing-context connected" should not
trigger a resource fetch when their attributes change.

This fixes an issue where we'd waste time by loading every style sheet
twice! :^)
2024-04-26 10:40:43 +02:00
Idan Horowitz
7339409575 Kernel: Properly initialize NVMe admin queue depth
We were reading the value instead of setting it (as required by the
specification). This worked only when we booted with a bootloader which
initialized NVMe before us.
2024-04-26 09:52:56 +02:00
Idan Horowitz
8a86218e25 Meta: Support debugging the riscv64 kernel 2024-04-26 09:52:56 +02:00
Idan Horowitz
a2b2209ea5 Kernel: Fix definition of CAP_TO_MASK
The default type for integer literals is signed int, so we were
accidentally smearing those bits to the upper 32 bit of the result.
This resulted in extremely unreasonable timeouts.
2024-04-26 09:52:56 +02:00
Idan Horowitz
904ebb74a9 Kernel: Use NVME polling by default on RISC-V
Since we don't support the RISC-V PLIC yet, we can't actually use
interrupt-based NVME handling.
2024-04-26 09:52:56 +02:00