Commit graph

68640 commits

Author SHA1 Message Date
Timothy Flynn
086a921213 AK: Disallow construction of JsonParser
JsonParser has a footgun where it does not retain ownership of the
string to be parsed. For example, the following results in UAF:

    JsonParser parser(something_returning_a_string());
    parser.parse();

Let's avoid this altogether by only allowing use of JsonParser with
a static, safe method.
2025-03-20 10:50:24 +01:00
Timothy Flynn
64aaf73775 LibWeb: Avoid using JsonParser directly in WebDriver
No need to construct a temporary parser.
2025-03-20 10:50:24 +01:00
Timothy Flynn
9214322129 UI/Qt: Do not make assumptions about autocomplete response types
For example, we expect a JSON array from Google. Let's not crash if we
get a JSON object or some other unexpected type.
2025-03-20 10:50:24 +01:00
Timothy Flynn
8847079d8a UI/Qt: Invert check for DuckDuckGo autocomplete parse results 2025-03-20 10:50:24 +01:00
Timothy Flynn
86a93b9b47 UI/Qt: Prevent UAF while parsing autocomplete response data
JsonParser only holds a view into the provided string, the caller must
keep it alive. Though we can actually just use JsonValue::from_string
here instead.
2025-03-20 10:50:24 +01:00
Jelle Raaijmakers
ea8213f7fa Meta: Add Open Collective to FUNDING.yml 2025-03-20 10:00:02 +01:00
Jess
12cbefbee7 LibJS+LibCrypto: Use a bitwise approach for BigInt's as*IntN methods
This speeds up expressions such as `BigInt.asIntN(0x4000000000000, 1n)`
(#3615). And those involving very large bigints.
2025-03-20 09:44:12 +01:00
Jess
92d0cd3c7c LibJS: Make InvalidIndex detail the full range of allowed values 2025-03-20 09:44:12 +01:00
Timothy Flynn
daca9f5995 LibDevTools+LibWebView+WebContent: Selectively fetch DOM node properties
When we inspect a DOM node, we currently serialize many properties for
that node, including its layout, computed style, used fonts, etc. Now
that we aren't piggy-backing on the Inspector interface, we can instead
only serialize the specific information required by DevTools.
2025-03-20 09:01:26 +01:00
Timothy Flynn
19529590b9 LibDevTools+WebContent: Simplify sending box-model properties a bit
Now that we aren't piggy-backing on the Inspector interface, we can make
our box-model serialization provide exactly the values that DevTools
requires.
2025-03-20 09:01:26 +01:00
Aliaksandr Kalenik
1f8e7c3cca LibWeb/Layout: Improve grid item sizing for replaced boxes
With this change we no longer stretch "width: auto" for replaced
elements and also use "width calculation rules for block-level replaced
elements", like suggested by the spec.
2025-03-20 03:36:56 +01:00
stasoid
2dd657f530 LibWebView: Port to Windows 2025-03-19 20:25:24 -06:00
stasoid
2abc792938 LibCore: Implement System::set_close_on_exec 2025-03-19 20:25:24 -06:00
stasoid
2e200489c8 LibCore: Implement StandardPaths::user_data_directory on Windows 2025-03-19 20:25:24 -06:00
stasoid
10db20a537 LibCore: Implement System::current_executable_path on Windows 2025-03-19 20:25:24 -06:00
Andrew Kaster
ddcd48d12e Documentation: Update build instructions to remove -GXcode suggestion
Also some other assorted docs cleanup.
2025-03-19 20:42:16 -04:00
Psychpsyo (Cameron)
2f6de5d9ac LibWeb: Import typo fix from the spec 2025-03-19 17:36:48 +00:00
Tim Ledbetter
5d57723ebf LibWeb: Implement CSSImportRule.supportsText
Returns the supports condition specified by the given import at-rule.
2025-03-19 16:42:51 +01:00
Tim Ledbetter
c37a47f76f LibWeb/CSS: Implement import at-rule supports conditions
This indicates the features the browser must support for the given
stylesheet to be fetched.
2025-03-19 16:42:51 +01:00
Tim Ledbetter
d38b5e260e LibWeb: Mark CSSImportRule.styleSheet IDL definition as nullable
The stylesheet may be null if its `supports()` condition does not match.
This matches the current specification.
2025-03-19 16:42:51 +01:00
Timothy Flynn
942f26a846 LibWebView: Remove now-unused ProcessManager HTML generator 2025-03-19 10:03:17 -04:00
Timothy Flynn
45d8cd5c9f UI/Qt: Replace the Task Manager window with about:processes 2025-03-19 10:03:17 -04:00
Timothy Flynn
67a1dd72db UI/AppKit: Replace the Task Manager window with about:processes 2025-03-19 10:03:17 -04:00
Timothy Flynn
843209c6a9 LibWeb+LibWebView+WebContent: Add an about:processes page
The intent is that this will replace the separate Task Manager window.
This will allow us to more easily add features such as actual process
management, better rendering of the process table, etc. Included in this
page is the ability to sort table rows.

This also lays the ground work for more internal `about` pages, such as
about:config.
2025-03-19 10:03:17 -04:00
Timothy Flynn
9dcbf5562a LibWeb: Extract some Internals functionality to a base class
This will just allow re-using these definitions on other internal pages.
2025-03-19 10:03:17 -04:00
Sam Atkins
2d220a8bbc LibWeb: Return CSSStyleProperties as a GC::Ref 2025-03-19 13:53:00 +00:00
Sam Atkins
9b06f66571 LibWeb/CSS: Return GC::Ref from Parser::convert_to_style_declaration() 2025-03-19 13:53:00 +00:00
Sam Atkins
a28197669a LibWeb/CSS: Move property code from CSSStyleDeclaration to *Properties
CSSStyleDeclaration is a base class that's used by various collections
of style properties or descriptors. This commit moves all
style-property-related code into CSSStyleProperties, where it belongs.

As noted in the previous commit, we also apply the CSSStyleProperties
prototype now.
2025-03-19 13:53:00 +00:00
Sam Atkins
83bb92c4e0 LibWeb/CSS: Merge style declaration subclasses into CSSStyleProperties
We previously had PropertyOwningCSSStyleDeclaration and
ResolvedCSSStyleDeclaration, representing the current style properties
and resolved style respectively. Both of these were the
CSSStyleDeclaration type in the CSSOM. (We also had
ElementInlineCSSStyleDeclaration but I removed that in a previous
commit.)

In the meantime, the spec has changed so that these should now be a new
CSSStyleProperties type in the CSSOM. Also, we need to subclass
CSSStyleDeclaration for things like CSSFontFaceRule's list of
descriptors, which means it wouldn't hold style properties.

So, this commit does the fairly messy work of combining these two types
into a new CSSStyleProperties class. A lot of what previously was done
as separate methods in the two classes, now follows the spec steps of
"if the readonly flag is set, do X" instead, which is hopefully easier
to follow too.

There is still some functionality in CSSStyleDeclaration that belongs in
CSSStyleProperties, but I'll do that next. To avoid a huge diff for
"CSSStyleDeclaration-all-supported-properties-and-default-values.txt"
both here and in the following commit, we don't apply the (currently
empty) CSSStyleProperties prototype yet.
2025-03-19 13:53:00 +00:00
Sam Atkins
687d32b712 LibWeb: Remove ElementInlineCSSStyleDeclaration entirely
All of its behavior has now been moved up into its parent classes.
2025-03-19 13:53:00 +00:00
Sam Atkins
50455c2f5e LibWeb: Stop constructing temporary ElementInlineCSSStyleDeclarations
Previously, parse_css_style_attribute() would parse the string, extract
the properties, add them to a newly-created
ElementInlineCSSStyleDeclarations, and then user code would take the
properties back out of it again and throw it away. Instead, just return
the list of properties, and the caller can create an EICSD if it needs
one.
2025-03-19 13:53:00 +00:00
Sam Atkins
f0d198ca3f LibWeb/CSS: Move CSSStyleDeclaration subclasses' fields into it
The spec defines several properties on the declaration which we
previously made virtual or stored on subclasses. This commit moves these
into CSSStyleDeclaration itself, and updates some of the naming.
2025-03-19 13:53:00 +00:00
Sam Atkins
3425aa0737 LibWeb/DOM: Introduce an ElementReference type
We have the "Element, but also maybe a pseudo-element of it" concept in
a lot of places, so let's wrap it up in a single type to make it easier
to deal with.
2025-03-19 13:53:00 +00:00
Sam Atkins
dea5fde3f9 LibWeb/HTML: Fix source insertion/removal steps
Corresponds to be5f269ca8

We don't yet implement "moving steps" so that's left for when we do.
2025-03-19 13:52:20 +00:00
Jelle Raaijmakers
c2e21d33eb LibWeb: Do not calculate corner radii if no radius is set
The `as_corner()` and `floored_device_pixels()` functions popped up
frequently in profiles when selecting text on some Tweakers.net pages.
For every corner we're performing multiple device pixel calculations
regardless of whether any radius was actually set.

Add an early return if no radius is set. On my machine this reduces the
time taken in both `as_corner()` and `floored_device_pixels()` by 46%
(63% fewer calls).
2025-03-19 14:22:10 +01:00
devgianlu
cfeb916e61 LibWeb: Remove unused underlying_buffer_source function
This function is not used anywhere and will most likely end up causing
problems so just remove it.
2025-03-19 13:46:50 +01:00
devgianlu
033ba43faf LibWeb: Use get_buffer_source_copy for getting the actual byte buffer
`WebIDL::underlying_buffer_source` gets the underlying buffer source
which is not resized according to, for example, `subarray`.
2025-03-19 13:46:50 +01:00
devgianlu
e02521911a LibWeb: Refactor {Dec,C}ompressionStream to handle split chunks 2025-03-19 13:46:50 +01:00
devgianlu
2b3934e34e LibCrypto: Remove leftover checksum helpers 2025-03-19 13:46:50 +01:00
devgianlu
f3631d6517 LibCrypto: Remove unused cksum class 2025-03-19 13:46:50 +01:00
devgianlu
6b2515657c LibCrypto: Remove unused CRC32, CRC16 and CRC8 classes 2025-03-19 13:46:50 +01:00
devgianlu
0561d130f3 LibCrypto: Remove unused Adler32 class 2025-03-19 13:46:50 +01:00
devgianlu
1c2b373e9c LibCompress: Refactor deflate de/compressor using zlib
Also remove two crash tests that are not relevant anymore because the
implementation changed substantially.
2025-03-19 13:46:50 +01:00
devgianlu
2baa7977a4 LibCompress: Refactor gzip de/compressor using zlib 2025-03-19 13:46:50 +01:00
devgianlu
dafbe32626 LibCompress: Refactor zlib de/compressor using zlib 2025-03-19 13:46:50 +01:00
devgianlu
c4b76bea13 LibCompress: Introduce generic de/compressor using zlib
This compressor decompressor is capable of handling zlib, gzip and
deflate all in one.
2025-03-19 13:46:50 +01:00
devgianlu
1c836588d9 LibWeb: Add some compression WPT tests
These are relevant for the next commits.
2025-03-19 13:46:50 +01:00
devgianlu
1612c1688e LibWeb: Change hardcoded compression test to round trip
As compression is not always deterministic, we cannot hardcode what
it'll be like, do a round trip instead.
2025-03-19 13:46:50 +01:00
devgianlu
3d3e77cd3e Meta: Add explicit vcpkg dependency for zlib
zlib is already included transitively for other dependencies, include it
explicitly and link it with `LibCompress`.
2025-03-19 13:46:50 +01:00
Sam Atkins
d5b9c39a98 LibWeb: Replace webkit meter-state pseudo-elements with pseudo-classes
This also implements the `:high-value` and `:low-value` that are in the
spec.

Same note as before about this being based on the very-drafty CSS Forms
spec. In fact, some of this isn't even in that spec yet. Specifically,
the `:suboptimal-value` and `:even-less-good-value` names are undecided
and subject to change. However, it's clear that this is a pseudo-class
situation, not a pseudo-element one, so I think this is still an
improvement, as it allows styling of the `::fill` pseudo-element
regardless of what state it is in.

Relevant spec issue: https://github.com/openui/open-ui/issues/1130
2025-03-19 10:10:03 +00:00