Commit Graph

57416 Commits

Author SHA1 Message Date
Idan Horowitz
dca5c71e53 Kernel: Stub out getsockopt for the SO_REUSEADDR option
We currently discard setsockopt for SO_REUSEADDR, so to ensure
consistency, support getsockopt as well.
2023-12-24 22:22:58 +01:00
Idan Horowitz
545f4b6cc1 Kernel: Properly support the SO_BROADCAST socket option
POSIX requires that broadcast sends will only be allowed if the
SO_BROADCAST socket option was set on the socket.
Also, broadcast sends to protocols that do not support broadcast (like
TCP), should always fail.
2023-12-24 22:22:58 +01:00
Ali Mohammad Pur
8b2beb2ebe LibLine: Use the correct loop conditions for erase_character_forwards()
Prior to this commit, the loop would continue forever and try to remove
the same index every time, eventually hitting a VERIFY and crashing.
2023-12-24 16:12:27 +01:00
Idan Horowitz
a49b7e92eb Kernel: Shrink instead of expand sigaltstack range to page boundaries
Since the POSIX sigaltstack manpage suggests allocating the stack
region using malloc(), and many heap implementations (including ours)
store heap chunk metadata in memory just before the vended pointer,
we would end up zeroing the metadata, leading to various crashes.
2023-12-24 16:11:35 +01:00
Idan Horowitz
4c6fd454d0 Kernel: Add MM helper for shrinking a virtual range to page boundaries 2023-12-24 16:11:35 +01:00
Timothy Flynn
6f4d745452 CI: Lower the timeout for Lagom tests to 1 hour
We set the job-level timeout to 0, which means "max value" (6 hours). In
the Serenity build, we do the same, but then limit the Test step to just
1 hour to prevent hung tests from hogging CI resources. When a job-level
timeout was added to Lagom, the Test step timeout was forgotten.
2023-12-24 14:09:59 +01:00
Timothy Flynn
bacf3cede4 Ladybird+BrowserSettings: Load the NTP/home resource files with LibWeb 2023-12-24 14:09:23 +01:00
Timothy Flynn
947136ca8d LibWebView: Load the Inspector CSS and JS resource files with LibWeb 2023-12-24 14:09:23 +01:00
Timothy Flynn
e511a264fe LibWeb: Implement ad-hoc steps to allow LibWeb to load resource:// URLs
The resource:// scheme is used for Core::Resource files. Currently, any
users of resource:// URLs in Ladybird must manually create the Resource
and extract its data. This will allow for passing the resource:// URL
along for LibWeb to handle.
2023-12-24 14:09:23 +01:00
Shannon Booth
48f39f0555 LibWeb: Port Window from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
3a7fb6cf9e LibWeb: Port CrossOriginPropertyDescriptorMap from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
10e5458e27 LibWeb: Port HTMLFormElement from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
0b7c8e0de5 LibWeb: Port BrowsingContext from ByteString
Also removing an unused m_name member.
2023-12-24 13:26:50 +01:00
Shannon Booth
1536cd05a7 LibWeb: Port PlatformObject from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
adb327d5d3 LibWeb: Port HTMLTitleElement from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
020839ad7a LibWeb: Remove ByteString usage in NamedNodeMap
We now have a FlyString version of get_attribute_ns, so this conversion
is no longer needed any more.
2023-12-24 13:26:50 +01:00
Shannon Booth
c63d30ce67 LibWeb: Port HTML Environments from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
562e0d710c LibWeb: Port ProcessingInstruction from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
7ce3e113fa LibWeb: Port HTMLOutputElement from ByteString 2023-12-24 13:26:50 +01:00
Shannon Booth
7909475b14 LibWeb: Port SVGUseElement from ByteString 2023-12-24 13:26:50 +01:00
MacDue
64411127cb LibGfx: Clip edges above or below the visible area in the rasterizer
This avoids doing pointless plotting for scanlines that will never be
seen.

Note: This currently can only clip edges vertically. Horizontal clipping
is more tricky, since edges that are not visible can still change how
things accumulate across the scanline.

Fixes #22382

Sadly, this causes a bunch of LibWeb test churn as this change
imperceptibly changes the final rasterized output.
2023-12-24 13:25:40 +01:00
Andreas Kling
fe04d83ef5 LibWeb: Process all pending lazy loading intersection observations
This fixes an issue where images outside the viewport could prevent
loading of images inside the viewport, depending on DOM order.
2023-12-24 13:23:40 +01:00
Andreas Kling
b344d39014 headless-browser: Use run_dump_test() for single-test runs as well
This avoids having two separate ways to set up the finish callbacks.
It also makes it possible to run a single async test on its own.
2023-12-24 13:23:40 +01:00
Aliaksandr Kalenik
32a6bf908a LibWeb/CSS: Fix stack use after scope in matches_attribute()
If a short string is used for the attribute value, then the result of:
```cpp
auto const view = element.attribute(attribute_name).value_or({})
    .bytes_as_string_view().split_view(' ');
```
is an array of string views pointing into a temporarily allocated
string.

With this change we keep string on stack until the end of scope.

Page that allows to reproduce the problem.
```html
<!DOCTYPE html><style>
    div[data-info~="a"] {
        background-color: yellow;
    }
</style><div data-info="a">a</div>
```
2023-12-24 08:03:58 +00:00
Shannon Booth
95e9c89a15 LibJS: Update spec comments in Array.fromAsync
This was a normative change in the Array.fromAsync spec which we already
implemented :^). See:

https://github.com/tc39/proposal-array-from-async/commit/689d0d

I've left an existing FIXME in there for some other bug which we have
which is causing some test262 test cases to fail.
2023-12-23 20:22:42 -05:00
Andreas Kling
41941aeb10 LibWeb: Don't access SharedImageRequest::m_document in destructor
It's not safe to access m_document here since GC may have deleted it
by the time we're being deleted. Instead, move this to a finalize()
override, since those are guaranteed to be called while both objects
are still alive.
2023-12-23 23:02:10 +01:00
Andreas Kling
6c1fcc5f7e LibJS: Actually invoke the type-isolating cell allocators
Due to a `requires` mistake, we were always using the fallback
size-based cell allocators.

Also, now that we start using them, make them NeverDestroyed so
we don't try to deallocate them on program exit.
2023-12-23 23:02:10 +01:00
Andreas Kling
f953a70965 LibWeb: Make ListOfAvailableImages actually visit images during GC
Instead of making the "Entry" inner struct GC-allocated and marking
*that*, we now mark the image instead.

This fixes an issue found by ASAN on https://mozilla.com/
2023-12-23 23:02:10 +01:00
Andreas Kling
f4fa37afd2 LibJS+LibWeb: Add missing JS_DEFINE_ALLOCATOR() for a bunch of classes 2023-12-23 23:02:10 +01:00
Andreas Kling
11c968fa1f LibJS: Make Heap aware of all CellAllocators
Also add a link from HeapBlock to their owning CellAllocator.
This fixes an issue where the Heap would skip over non-size-based
cell allocators.
2023-12-23 23:02:10 +01:00
Lucas CHOLLET
a31b988473 LibGfx/TIFF: Ensure baseline tags presence before decoding
This allows us to reject invalid images before trying to decode them.
The spec requires more tag to be present[1] but as we don't use them for
decoding I don't see the point.

[1] - XResolution, YResolution and ResolutionUnit
2023-12-23 20:54:07 +01:00
Shannon Booth
ec2b4c271f LibWeb: Support RadioNodeList named items in HTMLFormControlsCollection
We would previously not return a RadioNodeList in the curious case where
a named item resolves to two different elements within the form.

This was not a problem when calling namedItem directly in the IDL as
named_item_or_radio_node_list shadows named_item but is exposed when
calling the property through array bracket notation (as an example).

Fix this, and add a bunch more tests to cover
HTMLFormControlsCollection.
2023-12-23 20:53:11 +01:00
Shannon Booth
1defc4595b LibWeb: Make LiveNodeList store a NonnullGCPtr<Node const> root
This allows us to improve the const-correctness in RadioNodeList, which
has been made possible as of: 5f0ccfb499 now that a GC-visit accepts a
const GC pointer.
2023-12-23 20:53:11 +01:00
Aliaksandr Kalenik
0a7e4a0d22 LibWeb: Ignore "display: contents" boxes while inserting inline nodes
With this change "display: contents" ancestors are not considered as
insertion point for inline nodes similar to how we already ignore them
for non-inline nodes.

Fixes https://github.com/SerenityOS/serenity/issues/22396
2023-12-23 20:52:42 +01:00
Lucas CHOLLET
67522fab2e LibGfx/TIFF: Add support for RGBPalette images
TIFF images with the PhotometricInterpretation tag set to RGBPalette are
based on indexed colors instead of explicitly describing the color for
each pixel. Let's add support for them.

The test case was generated with GIMP using the Indexed image mode after
adding an alpha layer. Not all decoders are able to open this image, but
GIMP can.
2023-12-23 20:41:48 +01:00
Shannon Booth
d8759d9656 LibWeb: Use UTF-16 code unit offsets and lengths in CharacterData
We were previously assuming that the input offsets and lengths were all
in raw byte offsets into a UTF-8 string. While internally our String
representation may be in UTF-8 from the external world it is seen as
UTF-16, with code unit offsets passed through, and used as the returned
length.

Beforehand, the included test included in this commit would crash
ladybird (and otherwise return wrong values).

The implementation here is very inefficient, I am sure there is a
much smarter way to write it so that we would not need a conversion
from UTF-8 to a UTF-16 string (and then back again).

Fixes: #20971
2023-12-23 20:41:41 +01:00
Shannon Booth
d51f84501a AK: Remove now unused to_{int,uint,float,double} String functions 2023-12-23 20:41:07 +01:00
Shannon Booth
e2e7c4d574 Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as
to_number will handle something such as:

```
Optional<I> opt;
if constexpr (IsSigned<I>)
    opt = view.to_int<I>();
else
    opt = view.to_uint<I>();
```

For us.

The main goal here however is to have a single generic number conversion
API between all of the String classes.
2023-12-23 20:41:07 +01:00
Shannon Booth
a4ecc65398 AK: Add DeprecatedFlyString::to_number<T> 2023-12-23 20:41:07 +01:00
Shannon Booth
159eda5c6d AK: Add ByteString::to_number<T>
To mirror the API with StringView and String.
2023-12-23 20:41:07 +01:00
Shannon Booth
cdf84a3e36 AK: Implement StringView::to_number<T> from String::to_number<T>
Do exactly what String does, then use StringView's implementation as
String's new one. This should allow us to call to_number on a
StringView.
2023-12-23 20:41:07 +01:00
Nico Weber
b63eb4a4dd LibPDF: Implement /Mask support with stream object argument 2023-12-23 20:39:11 +01:00
Nico Weber
a3507ef65b LibPDF: Move error for /ImageMask out of load_image()
...and tweak load_image() to support loading mask images
(which don't have a color space and are always 1 bit per pixel).
2023-12-23 20:39:11 +01:00
Nico Weber
3ad9782e25 LibPDF: Extract a apply_alpha_channel() function
No behavior change.
2023-12-23 20:39:11 +01:00
Nico Weber
4bd11c8eb4 LibPDF: Show a 'rendering unsupported' error for images with /Mask key 2023-12-23 20:39:11 +01:00
Timothy Flynn
7d2172ff3d LibLocale: Update to CLDR version 44.1.0
https://cldr.unicode.org/index/downloads/cldr-44#h.nvqx283jwsx
2023-12-23 20:05:36 +01:00
Timothy Flynn
ef6d1dbd4d Meta: Port recent changes to the GN build
5e1499d104
36f0499cc8
64912d4d02
809c5b0b03
2023-12-23 20:05:36 +01:00
Timothy Flynn
7233d5ed3e Meta: Alphabetically sort IDL files in the GN build 2023-12-23 20:05:36 +01:00
Timothy Flynn
697bb27c97 LibTimeZone: Update to TZDB version 2023d
https://mm.icann.org/pipermail/tz-announce/2023-December/000080.html
2023-12-23 20:05:16 +01:00
Nico Weber
80359517bd LibGfx: Do not use double negation in TIFFGenerator.py
No behavior change.
2023-12-23 12:25:08 -05:00