Commit graph

66737 commits

Author SHA1 Message Date
Luke Wilde
927bdf909b LibWeb/WebGL2: Implement a bunch of parameters read by CreepJS
This also fixes GLfloat and GLboolean to use their appropriate glGet
functions.
2025-01-18 10:23:07 +01:00
Tim Ledbetter
5fd130b02d LibWeb: Add BaseAudioContext.createStereoPanner() factory method 2025-01-18 10:20:41 +01:00
Tim Ledbetter
56907e2de6 LibWeb: Add StereoPannerNode interface 2025-01-18 10:20:41 +01:00
Timothy Flynn
26c2484c2f LibJS: Implement the AsyncDisposableStack interface
This is very similar to the DisposableStack interface, except disposal
of resources is promise-based.
2025-01-17 20:46:32 +01:00
Timothy Flynn
5ea0aa5f08 LibJS: Bring the explicit resource management implementation up to date
While we don't yet have a working `using` implementation with our byte
code, we can still keep our DisposableStack implementation up to date.
The changes brought in here are all editorial, and set us up to start
an AsyncDisposableStack implementation.
2025-01-17 20:46:32 +01:00
Timothy Flynn
f82b1c5a2d LibJS: Alphabetically sort the list of well-known symbols 2025-01-17 20:46:32 +01:00
Tim Ledbetter
31532e36a8 LibWeb: Add AudioContext.createMediaElementSource() factory method 2025-01-17 19:04:47 +00:00
Tim Ledbetter
aa39aa50f7 LibWeb: Add MediaElementAudioSourceNode interface 2025-01-17 19:04:47 +00:00
Luke Wilde
a588756105 LibJS: Use correct this value for tagged template literals with members
Required by creepjs, which does Date().split` `[3] to get the current
year.
2025-01-17 17:15:12 +01:00
Luke Wilde
5f33383a7b LibJS: Propagate direct eval presence if the current scope is screwed
Previously it only deoptimized the parent scope if the current scope
contains direct eval, which is incorrect because code ran in direct
eval mode has access to the entire scope chain it was executed in.
The fix is to also propagate direct eval's presence if the current
scope is marked as being screwed by direct eval.

This fixes Google's botguard failing to complete on Google sign in, as
it tried to access local variables outside of a direct parent function
with eval, causing it throw "unhandled" exceptions. Unhandled is in
quotes because their bytecode VM _technically_ caught it, but it was
considered an unhandled exception. This was determined by removing get
optimizations and then adding debug output for every get operation.
Using this, I noticed that for these errors, it would access the
'message' and 'stack' properties. This is because their error handler
function noticed this was not a synthesised error, which is never
expected to happen. That was determined by using Chrome Devtools 'pause
on handled exception' feature, and noticing it never threw a '[var] is
not defined' exception, but only synthesized error objects which
contained a sentinel value to let it know it was synthesized.

I added debug output to eval to print out what was being eval'd because
it makes heavy use of eval. This revealed that the exceptions only came
from eval.

I then dumped every generated executable and noticed the variables it
was trying to access were generated as local variables in the top
scope. This led to checking what makes a variable considered local or
not, which then lead to this block of code in ~ScopePusher that
propagates eval presence only to the immediate parent scope. This
variable directly controls whether to create all variables properly
with variable environments and bindings or allow them to be stored as
local registers tied to that function's executable.

Since this now lets botguard run to completion, it no longer considers
us to be an insecure/potential bot browser when signing in, now
allowing us to be able to sign in to Google.
2025-01-17 14:36:03 +01:00
devgianlu
991cb8942d LibWeb: Always return a KeyAlgorithm from RsaHashedKeyAlgorithm
The spec never mentions the possibility for the `hash` member of
`RsaHashedKeyAlgorithm` to be a string, it should be a `KeyAlgorithm`
object containing a `name` string member.

Spec: https://w3c.github.io/webcrypto/#dfn-RsaHashedKeyAlgorithm
2025-01-17 12:43:03 +01:00
devgianlu
999f456ba4 LibWeb: Support RSASSA-PKCS1-v1_5 in WebCryptoAPI 2025-01-17 12:43:03 +01:00
devgianlu
e05ee9d297 LibWeb: Support RSA-PSS in WebCryptoAPI 2025-01-17 12:43:03 +01:00
devgianlu
3eeb35e787 LibCrypto: Implement RSA_PSS_EMSA with OpenSSL 2025-01-17 12:43:03 +01:00
Ali Mohammad Pur
cce000d57c LibRegex: Don't repeat the same fork again
If some state has already been tried, skip over it as it would never
lead to a match regardless.
This fixes performance/memory issues in cases like
/(a+)+b/.exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
or
/(a|a?)+b/...

Fixes #2622.
2025-01-17 10:13:51 +01:00
Ali Mohammad Pur
7ceeb85ba7 LibRegex: Avoid use-after-move of trivial object
This is not an actual problem as the object is just an enum, but clion
was bugging me.
2025-01-17 10:13:51 +01:00
Ali Mohammad Pur
5876417357 AK: Add a const iterator for COWVector 2025-01-17 10:13:51 +01:00
Timothy Flynn
59a4203cf0 LibWeb: Implement the exclusive <details> accordion
This is a relatively new feature which allows naming <details> groups to
ensure only one <details> element in that group is opened at a time.
2025-01-17 10:13:35 +01:00
Timothy Flynn
1fb1d5fcb9 LibWeb: Update the HTMLDetailsElement attribute change steps
No functional change here, but this contains spec steps to handle the
'name' attribute (not implemented here).
2025-01-17 10:13:35 +01:00
Sam Atkins
b3b9eea986 LibWeb/CSS: Merge RotationStyleValue into TransformationStyleValue
Same again, although rotation is more complicated: `rotate`
is "equivalent to" multiple different transform function depending on
its arguments. So we can parse as one of those instead of the full
`rotate3d()`, but then need to handle this when serializing.
2025-01-17 10:12:39 +01:00
Sam Atkins
03a4ecce19 LibWeb/CSS: Merge TranslationStyleValue into TransformationStyleValue
As with ScaleStyleValue, the serialization is the only unique part of
this class, and we can just move it over.
2025-01-17 10:12:39 +01:00
Sam Atkins
ac15e626dd LibWeb/CSS: Merge ScaleStyleValue into TransformationStyleValue
The only ways this varies from the `scale()` function is with parsing
and serialization. Parsing stays separate, and serialization is done by
telling `TransformationStyleValue` which property it is, and overriding
its normal `to_string()` code for properties other than `transform`.
2025-01-17 10:12:39 +01:00
Sam Atkins
bd5d1b092a LibWeb/CSS: Move TransformationSV -> Transformation code into TSV 2025-01-17 10:12:39 +01:00
Sam Atkins
01d782a5ca LibWeb/CSS: Return TransformationStyleValue values by reference
Avoid copying the vector when we read from it.
2025-01-17 10:12:39 +01:00
Noah Bright
6c6bf322ea LibWeb/WebAudio: Define and partially implement AnalyserNode
https://webaudio.github.io/web-audio-api/#AnalyserNode

Most of the interface is naively implemented. Container types
probably need adjusted (Vector<double> is used for all the processing).
A Fourier Transform is needed, but that's waiting on either a 3rd
party library or a complex number type.

There are lots of simple miscellaneous filters that need to be applied.
It could be reasonable to implement from scratch, supposing that
it can be parallelized. It might be hard to find one library with
everything. Not my call though.

Some additional scaffolding around blocks and render quanta is
probably needed before this is developed much further, which
probably comes in at the level of the AudioNode.

Co-authored-by: Tim Ledbetter <tim.ledbetter@ladybird.org>
2025-01-17 10:11:24 +01:00
aplefull
50445dc9ef LibWeb: Don't add extra gap when placing flex items in reverse order 2025-01-17 10:10:43 +01:00
Shannon Booth
ac9670fb55 LibWeb/HTML: Fix grammar in spec note for error checking serialization
See: https://github.com/whatwg/html/commit/90720ff
2025-01-17 10:08:42 +01:00
Shannon Booth
76397c9ecd LibWeb: Use finalize for cleaning up all navigables
The use of this HashMap looks very spooky, but let's at least use
finalize when cleaning them up on destruction to make things slightly
less dangerous looking.
2025-01-17 10:08:42 +01:00
Timothy Flynn
59162c8155 LibJS: Adjust ad-hoc clamping behavior in RegulateISODate
Instead of clamping to the limits allowed by ISOYearMonthWithinLimits,
clamp to the limits allowed by the type we are converting to (i32). This
allows some callers to then reject years outside that range.
2025-01-17 10:08:06 +01:00
Timothy Flynn
d5b26183f3 LibJS: Convert errant MUST to TRY in Temporal.PlainDateTime.with 2025-01-17 10:08:06 +01:00
Timothy Flynn
c3fc8996bf LibJS: Refer to RFC 9557 instead of ISO 8601 where appropriate
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/9bb84b2
2025-01-17 10:08:06 +01:00
Timothy Flynn
313c050a61 LibJS: Do not override the timeZoneName option in Intl.DateTimeFormat
This is an editorial change in the Temporal proposal. See:
https://github.com/tc39/proposal-temporal/commit/d76d11b
2025-01-17 10:08:06 +01:00
Tim Ledbetter
ea67f37348 Meta: Support importing WPT crash tests 2025-01-17 09:08:15 +01:00
Tim Ledbetter
ded19eaab8 Tests: Convert existing text test to crash test 2025-01-17 09:08:15 +01:00
Tim Ledbetter
bef7e704c5 headless-browser: Add support for crash tests
These are essentially the same as text tests, but they have no
associated expectation file. These tests pass if the test fully loads
without crashing.
2025-01-17 09:08:15 +01:00
Jelle Raaijmakers
76192e6ae7 CI: Do not insinuate PRs can be reopened in stalebot's close message
Elevated permissions are required to do so. Contributors can create a
new pull request based on their branch instead.
2025-01-16 23:40:19 +01:00
Timothy Flynn
e6b7c8cde2 LibUnicode: Consistently reject out-of-bounds segmenter indices
In the UTF-8 implementation, this prevents out-of-bounds access of the
underlying text data, as the ICU macro would essentially do something
akin to `text[text.length()]`.

The UTF-16 implementation already checks for out-of-bounds, but would
previously return 0. We now return an empty Optional in both impls. This
doesn't affect LibJS (the user of the UTF-16 impl), as it already does
bounds checking before invoking LibUnicode APIs.
2025-01-16 23:22:48 +01:00
Timothy Flynn
0c09a099a5 LibWeb: Add missing #include to InputEventsTarget.h
While investigating an issue with Unicode::Segmenter (the result of
which is passed to functions in this file), this missing include was
causing clangd to be unable to find non-virtual implementations.
2025-01-16 23:22:48 +01:00
Tim Ledbetter
d7ff409032 LibWeb: Align OfflineAudioContext constructors with current spec steps 2025-01-16 13:56:18 +00:00
Tim Ledbetter
f01ccf5424 LibWeb: Align AudioContext constructor with current spec steps 2025-01-16 13:56:18 +00:00
Shannon Booth
c33d72bb41 LibWeb/Fetch: Remove FIXME for since fixed spec bug 2025-01-16 01:16:47 +00:00
Tim Ledbetter
3d20587911 LibWeb: Fetch source file when HTMLTrackElement src attribute changes
This commit begins to implement the track processing model. When the
`src` attribute is updated, we now fetch the given source file.
Currently, we always fire an `error` event once fetching is completed,
as we don't support processing the fetched data.
2025-01-15 20:59:18 +01:00
Tim Ledbetter
e44fcc644f LibWeb: Use AttributeNames::value rather than StringView literals 2025-01-15 20:59:18 +01:00
Sam Atkins
18e0ff6537 LibWeb/CSS: Properly classify calculations inside transform functions
Assuming all calculations produce `<length-percentage>` is a very bad
assumption, and was causing crashes on https://ai.cloudflare.com/
2025-01-15 14:29:08 +00:00
matan-h
6fc62c1538 Docs: Add info about --enable-idl-tracing flag 2025-01-15 13:25:35 +00:00
Shannon Booth
51102254b5 LibWeb/HTML: Scroll to the fragment before loading the document
Otherwise nowhere ends up scrolling to the fragment specified by the
fragment in document's URL. This fixes ladybird scrolling to the
correct location in the document when navigating to a link that
has a fragment, e.g:

https://html.spec.whatwg.org/multipage/browsing-the-web.html#try-to-scroll-to-the-fragment

As well as use of the :target selector.
2025-01-15 12:43:48 +00:00
Shannon Booth
e74ca82083 LibWeb/XHR: Isomorphic decode accessing XMLHttpRequest response headers
Fixes a crash on:

https://wpt.live/html/browsers/browsing-the-web/navigating-across-documents/refresh/subresource.any.html
2025-01-15 12:35:56 +00:00
Tim Ledbetter
731c2365b6 WebDriver: Disable scrollbar painting when launching the browser 2025-01-15 12:33:53 +00:00
Tim Ledbetter
dd819d1dea LibWebView: Add an option to disable painting viewport scrollbars 2025-01-15 12:33:53 +00:00
Tim Ledbetter
639ed5a052 WebContent+LibWeb: Add an option to disable painting viewport scrollbars 2025-01-15 12:33:53 +00:00