Commit graph

35924 commits

Author SHA1 Message Date
Jonne Ransijn
07cd7d479f LibWeb: Remove reference counting for CSS::StyleProperties
`AK::CopyOnWrite` already does reference counting, so there is no need
to do it again.
2024-10-27 13:26:30 +01:00
Andreas Kling
ec0838b84e LibWeb: Implement HTMLElement.innerText closer to spec
And here's the wild part: instead of cloning WPT tests, import the
relevant WPT tests that this fixes into our own test suite.

This works by adding a small Ladybird-specific callback in
resources/testharnessreport.js (which is what that file is meant for!)

Note that these run as text tests, and so they must signal the runner
when they are done. Tests using the "usual" WPT harness should just
work, but tests that do something more freestyle will need manual
signaling if they are to be imported.

I've also increased the test timeout here from 30 to 60 seconds,
to accommodate the larger WPT-style tests.
2024-10-27 12:10:28 +01:00
Jonne Ransijn
afe74afa9e LibWeb/Fetch: Do not clone stored responses
Some checks are pending
Push notes / build (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Reading the RFC9111 spec makes it clear that the stored response was
not intended to be cloned. This is because there is a "clone response"
operation that is used in other places, but never for stored responses.
2024-10-27 11:28:37 +01:00
Jonne Ransijn
c7a51ed297 LibWeb/Fetch: Update cached responses when revalidating
Responses returned from `http_network_or_cache_fetch` were copied
directly from the cache, which is incorrect, since revalidation may
later modify the response, or even invalidate it, such as when the
`Access-Control-Allow-Origin` header is changed.

This fixes WPT test [wpt/cors/304.htm](http://wpt.live/cors/304.htm)
2024-10-27 11:28:37 +01:00
stelar7
96c053b36e LibCrypto: Remove some debug spam from RSA generation 2024-10-27 11:26:12 +01:00
stelar7
37f2818e90 LibWeb: Fix modulus length being wrong for RSA-OAEP key import 2024-10-27 11:26:12 +01:00
stelar7
23fc04d264 LibWeb: Implement RSAOAEP.decrypt() 2024-10-27 11:26:12 +01:00
stelar7
378808f6ba LibCrypto: Implement OAEP decode from newer spec 2024-10-27 11:26:12 +01:00
stelar7
3b423f1852 LibWeb: Add and use new name() helper on HashAlgorithmIdentifier 2024-10-27 11:26:12 +01:00
stelar7
48bd094712 LibWeb: Implement RSAOAEP.encrypt() 2024-10-27 11:26:12 +01:00
stelar7
6fc268f588 LibCrypto: Implement OAEP encode from newer spec 2024-10-27 11:26:12 +01:00
stelar7
b2b500ba82 LibCrypto: Extend OAEP test with RSA example 2024-10-27 11:26:12 +01:00
Kostya Farber
2dc788df00 LibWeb: Bring tab-size closer to the spec
When the css tab-size property is a number, we need to add
the associated letter-spacing and word-spacing to it's width.
2024-10-27 11:03:35 +01:00
Magnus Johansson
c6f77f4818 LibWeb: Fallback to auto when aspect ratio is degenerate as per spec
When aspect-ratio is degenerate (e.g. 0/1 or 1/0) we should
fallback to the same behaviour as `aspect-ratio: auto` according to spec
This commit explicitly handles this case and fixes five WPT test in
css/css-sizing/aspect-ratio (zero-or-infinity-[006-010])
2024-10-27 10:56:17 +01:00
Chase Knowlden
20376adbc3 LibWeb/HTML: Start implementing the download attribute 2024-10-27 10:23:45 +01:00
Ankush Chatterjee
85356094b5 LibWeb/CSS: Add math expression support for transform-origin 2024-10-27 10:21:22 +01:00
Lucas CHOLLET
3406b69614 LibGfx+LibWeb/CSS: Add support for the lab() color function
The support in LibWeb is quite easy as the previous commits introduced
helpers to support lab-like colors.

Now for the methods in Color:
 - The formulas in `from_lab()` are derived from the CIEXYZ to CIELAB
   formulas the "Colorimetry" paper published by the CIE.
 - The conversion in `from_xyz50()` can be decomposed in multiple steps
   XYZ D50 -> XYZ D65 -> Linear sRGB -> sRGB. The two first conversion
   are done with a singular matrix operation. This matrix was generated
   with a Python script [1].

This commit makes us pass all the `css/css-color/lab-00*.html` WPT
tests (0 to 7 at the time of writing).

[1] Python script used to generate the XYZ D50 -> Linear sRGB
conversion:

```python
import numpy as np

# http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html
# First let's convert from D50 to D65 using the Bradford method.
m_a = np.array([
    [0.8951000, 0.2664000, -0.1614000],
    [-0.7502000, 1.7135000, 0.0367000],
    [0.0389000, -0.0685000, 1.0296000]
])

# D50
chromaticities_source = np.array([0.96422, 1, 0.82521])
# D65
chromaticities_destination = np.array([0.9505, 1, 1.0890])

cone_response_source = m_a @ chromaticities_source
cone_response_destination = m_a @ chromaticities_destination

cone_response_ratio = cone_response_destination / cone_response_source
m = np.linalg.inv(m_a) @ np.diagflat(cone_response_ratio) @ m_a

D50_to_D65 = m

# https://en.wikipedia.org/wiki/SRGB#From_CIE_XYZ_to_sRGB
# Then, the matrix to convert to linear sRGB.
xyz_65_to_srgb = np.array([
    [3.2406, - 1.5372, - 0.4986],
    [-0.9689, + 1.8758, 0.0415],
    [0.0557, - 0.2040, 1.0570]
])

# Finally, let's retrieve the final transformation.
xyz_50_to_srgb = xyz_65_to_srgb @ D50_to_D65

print(xyz_50_to_srgb)
```
2024-10-27 10:20:03 +01:00
Lucas CHOLLET
8efa046e0c LibWeb/CSS: Make CSSOKLab inherit from a new CSSLabLike class
This class provides the common base for both CSSOKLab and the future
CSSLab classes.
2024-10-27 10:20:03 +01:00
Lucas CHOLLET
707bcaf604 LibWeb/CSS: Extract code to parse a lab-like color value
This is currently only used for `oklab()` but will soon be also used for
`lab()` as well.
2024-10-27 10:20:03 +01:00
Simek
c9c67a6f24 LibWeb: Correct default ARIA Roles for few tags 2024-10-27 10:17:12 +01:00
Jonne Ransijn
8409178a11 LibWeb: Return Web::CSS::Selector::pseudo_element by reference
This avoids many allocations and deallocations.
2024-10-27 09:33:17 +01:00
Shannon Booth
5d7a7a43c4 LibWeb: Add temp execution context for resolving promise in AudioContext
Fixes a crash seen on twitter.com, namely from the 'resume' function.
2024-10-27 08:10:11 +01:00
Ben Wiederhake
b1056121f2 LibWeb: Implement WebCrypto AES-CBC decrypt operation
This lets us pass an additional (roughly) 15 WPT tests:
WebCryptoAPI/encrypt_decrypt/aes_cbc.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
eb193251b8 LibWeb: Implement WebCrypto AES-CBC encrypt operation
This lets us pass an additional (roughly) 20 WPT tests:
WebCryptoAPI/encrypt_decrypt/aes_cbc.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
d86dcac4f7 LibWeb: Implement WebCrypto AES-CBC generateKey operation
This is progress towards passing more WPT tests, although none of them
gets green due to this commit.
2024-10-26 17:50:22 +02:00
Ben Wiederhake
9255a1ac2e LibWeb: Implement WebCrypto AES-CBC exportKey operation
This lets us pass an additional (roughly) 40 WPT tests:
WebCryptoAPI/import_export/symmetric_importKey.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
6f88376e24 LibWeb: Implement WebCrypto AES-CBC importKey operation
This alone lets us pass around 40 WPT tests:
WebCryptoAPI/import_export/symmetric_importKey.https.any
2024-10-26 17:50:22 +02:00
Ben Wiederhake
92d4cb7b09 LibCrypto: Fix and test CBC with CMS and ZeroLen padding 2024-10-26 17:50:22 +02:00
Jonne Ransijn
6e86ad65e9 LibGfx: Use FlyString for family name
This value gets converted to FlyString a lot, so let's just make it
a FlyString in the first place!
2024-10-26 17:40:56 +02:00
samu698
7865fbfe6d LibJS: Don't generate useless jumps for if statement
If statements without an else clause generated jumps to the next
instruction, this commit fixes the if statement generation so that it
dosen't produce them anymore.

This is an example of JS code that generates the useless jumps
(a => if(a){}) ();
2024-10-26 17:39:37 +02:00
Andreas Kling
257ebea364 LibJS: Store RegExp flags as a bitmask
This avoids having to do O(n) contains() in the various flag accessors.

Yields a ~20% speed-up on the following microbenchmark:

    const re = /foo/dgimsvy;
    for (let i = 0; i < 1_000_000; ++i)
        re.flags;
2024-10-26 15:42:57 +02:00
Jelle Raaijmakers
8fd59899fc LibWeb: Paint drop shadow filters 2024-10-26 11:26:42 +02:00
Jelle Raaijmakers
c99fad77e1 LibWeb: Fix filter: drop-shadow argument parsing
We were not discarding enough whitespace to actually get to the radius
and color values.
2024-10-26 11:26:42 +02:00
Jelle Raaijmakers
2d544a0d8c LibWeb: Remove LibGfx-specific blur radius modification 2024-10-26 11:26:42 +02:00
Jelle Raaijmakers
6c642d168d LibWeb: Apply correct clamping for each individual color filter
We were always clamping the amount, but this is actually defined per
filter. This allows the brightness filter to go beyond 100%, for
example.
2024-10-26 11:26:42 +02:00
Jelle Raaijmakers
1b9c50b664 LibWeb: Implement CSS filter painting
We can reuse our implementation for `backdrop-filter` and use it as a
painting filter for each stacking context.
2024-10-26 11:26:42 +02:00
Jelle Raaijmakers
29974de852 LibWeb: Parse and store filter property
This shares its implementation with `backdrop-filter`.
2024-10-26 11:26:42 +02:00
Timothy Flynn
0722a3b1c0 LibWeb+WebContent+WebDriver: Asynchronously wait for dialog dismissal
There was a timing issue here where WebDriver would dismiss a dialog,
and then invoke another endpoint before the dialog was actually closed.
This is because the dismissal first has to hop over to the UI process to
close the graphical dialog, which then asynchronously informs WebContent
of the result. It's not until WebContent receives that result that the
dialog is considered closed, thus those subsequent endpoints would abort
due a dialog being "open".

We now wait for dialogs to be fully closed before returning from the
dismissal endpoints.
2024-10-26 11:25:42 +02:00
Timothy Flynn
bf0bc62654 WebContent+WebDriver: Asynchronously wait for navigations to complete
Similar to commit c2cf65adac, we should
avoid spinning the event loop from the WebContent-side of the WebDriver
connection. This can result in deadlocks if another component in LibWeb
also spins the event loop.

The AO to await navigations has two event loop spinners - waiting for
the navigation to complete and for the document to reach the target
readiness state. We now use NavigationObserver and DocumentObserver to
be notified when these conditions are met. And we use the same async IPC
mechanism as script execution to notify the WebDriver process when all
conditions are met (or timed out).
2024-10-26 11:25:42 +02:00
Timothy Flynn
8598d4670d LibWeb: Move WebDriver's HeapTimer helper class to its own file
And generalize it a tiny bit to be reusable outside of ExecuteScript.
2024-10-26 11:25:42 +02:00
Timothy Flynn
74ef9dc393 LibWeb: Add a NavigationObserver to be notified of navigable updates
This contains a hook to be notified when a navigable navigation is
complete, to be used by WebDriver.
2024-10-26 11:25:42 +02:00
Timothy Flynn
247307a2a2 LibWeb: Allow removing DocumentObserver hooks
Some callers (namely WebDriver) will want to stop receiving updates from
the DocumentObserver.
2024-10-26 11:25:42 +02:00
Timothy Flynn
0bbe836f8c LibWeb: Add a DocumentObserver hook to be notified of readyState changes 2024-10-26 11:25:42 +02:00
Kostya Farber
44b1c4f2b5 LibWeb: Parse the word-break css property
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-10-26 00:18:02 +02:00
Ben Wiederhake
124bd115a1 LibWeb: Fix crash when importing malformed RSAOAEP key
This fixes a crash in WPT:
WebCryptoAPI/import_export/rsa_importKey.https.any

This allows us to pass 240 tests!
2024-10-26 00:14:42 +02:00
Ben Wiederhake
efad0b5676 LibWeb: Remove dead write in HKDF/PBKDF importKey operation
This corresponds to a recent change in the spec:
https://github.com/w3c/webcrypto/pull/379
2024-10-25 23:50:31 +02:00
Ben Wiederhake
ee3b86c3f8 LibWeb: Remove superfluous step in HKDF deriveBits operation
This corresponds to a recent change in the spec:
https://github.com/w3c/webcrypto/pull/372
Inspired by the following review comment:
https://github.com/LadybirdBrowser/ladybird/pull/1877#discussion_r1807648283
2024-10-25 23:50:31 +02:00
Andrew Kaster
2c3531ab78 LibWeb: Move JS::Promise <-> WebIDL conversion into IDL
This change also removes as much direct use of JS::Promise in LibWeb
as possible. When specs refer to `Promise<T>` they should be assumed
to be referring to the WebIDL Promise type, not the JS::Promise type.

The one exception is the HostPromiseRejectionTracker hook on the JS
VM. This facility and its associated sets and events are intended to
expose the exact opaque object handles that were rejected to author
code. This is not possible with the WebIDL Promise type, so we have
to use JS::Promise or JS::Object to hold onto the promises.

It also exposes which specs need some updates in the area of
promises. WebDriver stands out in this regard. WebAudio could use
some more cross-references to WebIDL as well to clarify things.
2024-10-25 14:04:21 -06:00
Andrew Kaster
52c449293a LibWeb: Update PromiseRejectionEvent's promise field to be object
This change was made in the HTML spec to address a comment from the
Gecko team for the Streams API in
a20ca78975

It also opens the door for some more Promise related refactors.
2024-10-25 14:04:21 -06:00
Jelle Raaijmakers
352a66390f LibWeb: Do not resolve inline block height early if height is definite
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This condition was included to implement flex containers with auto
height, but it actually can reset the definitive height to 0 for inline
blocks with only replaced elements such as an SVG. Removing the
condition does not break any in-tree test, so let's improve the
situation on the SVG side of things for now.
2024-10-25 15:13:30 +02:00
stelar7
d16414b61e LibJS: Extend supported date string formats 2024-10-25 07:24:22 -04:00
Jonne Ransijn
cc0fce3983 LibWeb: Fix infinite loop in Storage::internal_own_property_keys
Since `Storage::item_value` never returns an empty Optional,
and since `PlatformObject::is_supported_property_index` only
returns false when `item_value` returns an empty Optional,
the loop in `PlatformObject::internal_own_property_keys` will
never terminate when executed on a `Storage` instance.

This fix allows youtube.com to load successfully :^)
2024-10-25 12:42:29 +02:00
Andreas Kling
3536ba9a88 LibWeb: Use Document::hidden() instead of comparing state to "hidden"
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Just noticed this unnecessary string comparison in the rendering task.
2024-10-25 10:21:12 +02:00
Andreas Kling
5c6b879715 LibWeb: Don't allocate a new HeapFunction 60 times per second
We can reuse the same HeapFunction when queueing up a rendering task
on the HTML event loop. No need to create extra work for the garbage
collector like this.
2024-10-25 10:21:12 +02:00
Ali Mohammad Pur
1b127ac082 LibRegex: Apply atomic loop rewrite in one more case
This commit makes LibRegex's atomic loop rewrite opt also accept cases
where the follow block jumps to the end of the forking block
(which is essentially a loop without a proper header in fancy clothes)

This makes patterns like /([^x]*)x/ where the loop is not _immediately_
followed by a block significantly faster.
2024-10-25 09:15:51 +02:00
Jelle Raaijmakers
0de403fede AK+LibJS: Add [[nodiscard]] to operator* in common types
The order of precedence with the `*` operator sometimes makes it a bit
harder to detect whether or not the result is actually used. Let's fail
compilation if anyone tries to discard the result.
2024-10-25 09:15:28 +02:00
Jelle Raaijmakers
5ab07f277c LibWeb: Actually resolve promises in AudioContext
...instead of just dereferencing the function.

Co-authored-by: Andrew Kaster <andrew@ladybird.org>
2024-10-25 09:15:28 +02:00
Andreas Kling
206479b2b5 LibJS: Cache UTF-16 strings on the VM
We were already caching UTF-8 and byte strings, so let's add a cache
for UTF-16 strings as well. This is particularly profitable whenever we
run regular expressions, since the output of regex execution is a set of
UTF-16 strings.

Note that this is a weak cache like the other JS string caches, meaning
that strings are removed from the cache as they are garbage collected.

This avoids billions of PrimitiveString allocations across a run of WPT,
significantly reducing GC activity.
2024-10-24 19:00:00 -04:00
Timothy Flynn
e89d889219 LibWeb+WebContent: Ensure elements are in view before clicking them
This implements a couple of missing steps in the Element Click endpoint.
2024-10-24 18:59:51 -04:00
Timothy Flynn
0286eb4e3e LibWeb: Return a MarkedVector from Document::elements_from_point
A plain vector is not protected from GC.
2024-10-24 18:59:51 -04:00
Timothy Flynn
9682b150ac WebContent: Do not raise errors from invoking element.scrollIntoView
The spec does not say to do this. We must instead implement methods to
validate the element after attempting to scroll.
2024-10-24 18:59:51 -04:00
Timothy Flynn
9f872d9aab WebContent: Do not use NodeIterator to iterate DOM nodes backwards
A NodeIterator rooted at some element cannot produce an element before
that root. That is, in a DOM tree such as:

    <div id=one><div id=two><div id=three></div></div></div>

If we create a NodeIterator rooted at element `three`, then invoking the
previousNode() method on that iterator is guaranteed to return null.

There was also a bug here where if we ever did enter the while() loop,
we would have looped indefinitely, as we were not updating the current
node.
2024-10-24 18:59:51 -04:00
Timothy Flynn
a9c858fc78 LibWeb: Implement WebDriver element references according to the spec
Our currently ad-hoc method of tracking element references is basically
a process-wide map, rather than grouping elements according to their
browsing context groups. This prevents us from recognizing when an
element reference is invalid due to its browsing context having been
closed.

This implements the WebDriver spec concept of element references grouped
according to their browsing context groups.

This patch is a bit noisy because we now need to plumb the current BC
through to the element reference AOs.
2024-10-24 18:59:51 -04:00
sideshowbarker
ede6924db8 LibWeb: Complete support for all ARIA properties in current spec
This change completes handling for all ARIA properties defined in the
current ARIA spec — by adding handling for the following properties:

- aria-braillelabel
- aria-brailleroledescription
- aria-colindextext
- aria-description
- aria-rowindextext
2024-10-24 22:21:46 +02:00
Ali Mohammad Pur
536e4d1d36 LibRegex: Cache 1 MiB worth of bytecode for each parser
While LibJS does cache regex literals, there's more than one way to
create regex objects, this cache is hit regularly just browsing the web,
though no real measurement has been done on its potential speedups.
2024-10-24 20:55:08 +02:00
Timothy Flynn
0042bbb68d LibWeb: Dispatch WebDriver mouse events relative to the top-level frame
Some checks are pending
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
There are many WPT subtests which validate how we behave against frames
that have been removed. They do this by adding an iframe element with a
button whose click action removes the iframe element. When the click is
dispatched, the spec would have us generate a mouse event relative to
that iframe, rather than the top-level frame, thus the click would miss
the target button.

Serendipitously, a spec issue and PR were just opened to generate mouse
events relative to the top-level frame. This patch implements that PR;
it has some editorial issues to be resolved, but is a clear improvement
for these tests.
2024-10-24 18:27:55 +02:00
Timothy Flynn
9bdf2e928c LibWeb: Begin implementing FontFaceSet.prototype.load
This implementation is incomplete in that we do not fully implement the
steps to match the given font against the fonts in the set.

This is used by fonts.google.com to load the fonts used for sample text.
2024-10-24 17:50:19 +02:00
Jonne Ransijn
78ecde9923 LibJS: Add HashMap for finding Bindings by name
`find_binding_and_index` was doing a linear search, and while most
environments are small, websites using JavaScript bundlers can have
functions with very large environments, like youtube.com, which has
environments with over 13K bindings, causing environment lookups to
take a noticeable amount of time, showing up high while profiling.

Adding a HashMap significantly increases performance on such websites.
2024-10-24 17:49:48 +02:00
Ali Mohammad Pur
00c45243bd LibRegex: Don't blindly accept inverted charclasses for atomic rewrite 2024-10-24 07:36:51 -04:00
Pavel Shliak
0cc8ba305d LibJS: Fix base64 decoder typo
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
As the comments suggest, _ is supposed to be translated into /
but - is translated twice instead
2024-10-23 19:47:18 -04:00
Timothy Flynn
84ad36de06 LibJS: Update spec numbers for the Iterator Helpers proposal
This proposal has reached stage 4 and was merged into the ECMA-262 spec.
See: https://github.com/tc39/ecma262/commit/961f269
2024-10-23 17:26:33 -04:00
Timothy Flynn
896c2e2f0f LibJS: Close iterator records inside the Iterator{Next,Step} AOs
This is an editorial change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/c4c55b6
2024-10-23 17:26:33 -04:00
Timothy Flynn
3aca12d2fa LibJS: Update spec numbers for the Promise.try proposal
This proposal has reached stage 4 and was merged into the ECMA-262 spec.
See: https://github.com/tc39/ecma262/commit/d72630f
2024-10-23 17:26:33 -04:00
Florian Cramer
1775021d71 LibXML: Allow empty pubid when parsing document type 2024-10-23 21:08:56 +02:00
Florian Cramer
89192ecc46 LibXML: Allow empty systemid when parsing document type
This fixes at least one WPT under /domparsing
2024-10-23 21:08:56 +02:00
Andrew Kaster
7372b2af48 LibIPC+Everywhere: Introduce an IPC Transport abstraction
This abstraction will help us to support multiple IPC transport
mechanisms going forward. For now, we only have a TransportSocket that
implements the same behavior we previously had, using Unix Sockets for
IPC.
2024-10-23 12:29:01 -06:00
Andrew Kaster
9a6eccc590 LibWebView+LibCore: Move IPCProcess into WebView::Process
Ladybird's HelperProcess.cpp was the only user of the IPCProcess class.
Moving the helper class from LibCore allows for some more interesting
LibIPC changes in the upcoming commits.
2024-10-23 12:29:01 -06:00
uysalibov
34f7bf979d LibWeb: Implemented shadows support for CanvasRenderingContext2D 2024-10-23 11:42:56 -06:00
Ben Wiederhake
6d68d6ddb2 LibWeb: Test subtleties in HKDF 'salt' interpretation
This also doubles as HKDF implementation test.
2024-10-23 11:33:58 -06:00
Ben Wiederhake
f670c68ded LibWeb: Implement and test SubtleCrypto interface for HKDF operations
This fixes several hundred if not thousands of WPT tests:
https://wpt.live/WebCryptoAPI/derive_bits_keys/hkdf.https.any.html?1-1000
2024-10-23 11:33:58 -06:00
Ben Wiederhake
6072ae5bae LibWeb: Simplify WebCrypto accesses to keys 2024-10-23 11:33:58 -06:00
Ben Wiederhake
8abd399a53 LibCrypto: Implement and test HKDF 2024-10-23 11:33:58 -06:00
Ben Wiederhake
e1c3e212de LibCrypto: Fix HMAC nullptr deref when key has length 0
While a key of length zero seems like a bad idea in general, the WPT
tests end up calling exactly this, so we need to support it one way or
another.
2024-10-23 11:33:58 -06:00
Andrew Kaster
85541f1e76 LibWeb: Add most of ServiceWorker Update algorithm
This misses the final, most important part of actually creating a
service worker object and sending the script over to it in a WebWorker
process.
2024-10-23 11:33:28 -06:00
Jim Broadbent
7a66316297 LibWeb/Storage: Return undefined for non-existent key/index access
All tests at now pass: http://wpt.live/webstorage/defineProperty.window.html
2024-10-23 11:31:47 -06:00
Gingeh
c10cb8ac8d LibURL: Use UTF-8 for percent encoding URL fragments 2024-10-23 11:30:59 -06:00
Gingeh
8e342e3e23 LibWeb: Use Content-Type header to set document encoding
Co-authored-by: Shannon Booth <shannon@serenityos.org>
2024-10-23 11:30:59 -06:00
Shannon Booth
1096b64936 LibWeb: Put setting object's promise's in WindowOrWorkerGlobalScope
This aligns with an update to the HTML specification which instead
stores these promises on the global object instead of the settings
object.

It also makes progress towards implementing the ShadowRealm proposal
as these promises are not present in the 'synthetic' realm for that
proposal.
2024-10-23 11:29:53 -06:00
Shannon Booth
d1fc76bffd LibJS: Allow host to create ShadowRealm global object
This implements the proposed update to the ShadowRealm proposal for
integrating the ShadowRealm specification into the web platform.
2024-10-23 11:29:53 -06:00
Shannon Booth
0ec8af5b70 LibJS: Initialize ShadowRealm internal slots through setters
This allows us to align our implementation in the same order as the
specification.

No functional change with the current implementation of this AO.

However, this change is required in order to correctly implement a
proposed update of the shadow realm proposal for integration with
the HTML spec host bindings in order to give the ShadowRealm
object the correct 'intrinsic' realm.

This is due to that proposed change adding a step which manipulates the
currently executing Javascript execution context, making the ordering
important.
2024-10-23 11:29:53 -06:00
Daniel La Rocque
db6ec2792a LibWeb: Assert navigationParams' request and response are not null 2024-10-23 11:23:21 -06:00
Daniel La Rocque
219cb04865 LibWeb: Check if navigationParams is NullWithError
When we check whether navigationParams is null, we should check if it is
`NullWithError`, since `NullWithError` is equivalent to `Empty`, but is
used for error messages.
2024-10-23 11:23:21 -06:00
Jelle Raaijmakers
1f9295ca2e LibWeb: Remove unused members from ReplacedBox
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-10-23 11:05:39 +02:00
Timothy Flynn
b75a4d25b7 WebContent: Further validate cookie attributes set from WebDriver
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Implement a few missing steps in the Add Cookie endpoint.
2024-10-23 09:05:33 +02:00
Timothy Flynn
8988e7ef8d LibWeb+LibWebView: Move the cookie domain matching algorithm to LibWeb
This will be needed outside of LibWebView.
2024-10-23 09:05:33 +02:00
Timothy Flynn
527218da19 LibWeb: Implement the document.cookie setter/getter according to spec
This ensures we cannot set or get cookies on non-HTTP(S) origins. Since
this would prevent our ability to test cookies during LibWeb tests, this
also adds an internals API to allow cookie access on file:// URLs.
2024-10-23 09:05:33 +02:00
Alex Ungurianu
1dd3865de9 LibWeb: Usefully dump CSS property rules
Sample dump:
```
CSSPropertyRule:
  name: --valid
  syntax: <color> | none
  inherits: false
  initial-value: red
```
2024-10-23 06:55:37 +01:00
Alex Ungurianu
a4c72f50c0 LibWeb: Parse @property CSS directives
This is not a complete parse, as it doesn't validate or take into
account the parsed syntax.
Enough to get us a few more WPT tests though :)
2024-10-23 06:55:37 +01:00
Alex Ungurianu
50d64b0fb7 LibWeb: Add and implement CSSPropertyRule IDL and bindings 2024-10-23 06:55:37 +01:00
Aliaksandr Kalenik
648fac7215 LibWeb: Fix "input" events being dispatched twice when cancelled
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-10-22 19:41:07 -04:00
Kostya Farber
2534e7aeff LibWeb: Strip tabs before text shaping
Handling tabs during text shaping caused issues because we tried to
index 'input_glyph_info' whilst iterating until 'glyph_count' and these
can be different sizes.

The difference is due to when one or more characters get
merged into the same glyph when calling 'input_glyph_info' (see
https://lazka.github.io/pgi-docs/HarfBuzz-0.0/classes/glyph_info_t.html).

We don't want to render tabs as they come up as tofu characters so
instead let's strip them out of the text chunk before starting text
shaping.
2024-10-22 21:42:54 +02:00
Jelle Raaijmakers
77850b3540 LibWeb/EventHandler: Ignore repeated keyup events
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Platforms such as X11 will typically send repeated keyRelease/keyup
events as a result of auto-repeating:

  * KeyPress (initial)
  * KeyRelease (repeat)
  * KeyPress (repeat)
  * KeyRelease (repeat)
  * ad infinitum

Make our EventHandler more spec-compliant by ignoring all repeated keyup
events. This fixes long-pressing the arrow keys on
https://playbiolab.com/.
2024-10-22 11:20:35 -04:00
Jelle Raaijmakers
9309cc9df3 UI+LibWeb+WebContent: Implement KeyEvent repeat property
When a platform key press or release event is repeated, we now pass
along a `repeat` flag to indicate that auto-repeating is happening. This
flag eventually ends up in `KeyboardEvent.repeat`.
2024-10-22 11:20:35 -04:00
Jelle Raaijmakers
cf315d54ec UI+LibWeb: Remove unused includes 2024-10-22 11:20:35 -04:00
Kostya Farber
537cbf55c3 LibWeb: Add letter-spacing css property to Node 2024-10-22 15:32:34 +01:00
ronak69
6c3ecf6a34 LibWeb/CSS: Tweak in CSSRGB::to_color() to avoid floating point errors
Example of the difference:

    50 * 2.55      --> 127.4999 --> round towards +∞ --> 127
    50 * 255 / 100 --> 127.5000 --> round towards +∞ --> 128

Now, 9 failing WPT tests in /css/css-color/ pass.
2024-10-22 14:18:17 +01:00
Aliaksandr Kalenik
3e8b2454fb LibWeb: Stub InputEvent.getTargetRanges()
We need this, because https://www.slatejs.org/ that is used by Discord
checks this function to decide whether a browser has "beforeinput" event
support.
2024-10-22 08:44:51 -04:00
Aliaksandr Kalenik
63f502ab0a LibWeb: Implement dispatching of "beforeinput" event 2024-10-22 08:44:51 -04:00
Aliaksandr Kalenik
0de61b0f65 LibWeb: Implement dispatching of "input" event 2024-10-22 08:44:51 -04:00
Aliaksandr Kalenik
d88e6bee5d LibWeb: Put cursor in last text node when contenteditable is focused
With this change we match behavior of other engines a bit more closer.
2024-10-22 08:44:51 -04:00
Kostya Farber
da42c19cb6 LibWeb: Apply the word-spacing css property to Node
This will let us start to begin applying this during
text shaping.
2024-10-22 13:36:26 +01:00
Jelle Raaijmakers
e4533e5595 LibWeb: Do not floor SVG offset in SVGPathPaintable
Resolves a FIXME and improves the visuals of https://tweakers.net :^)
2024-10-22 07:37:59 -04:00
Timothy Flynn
c96c5e45ff LibWeb: Implement KeyboardEvent.charCode according to spec
It should be 0 for keydown/keyup events.
2024-10-22 12:48:58 +02:00
Timothy Flynn
1bbe8309d4 LibUnicode: Add a helper to determine if a code point is printable 2024-10-22 12:48:58 +02:00
Timothy Flynn
b24a7079f1 LibWeb+WebDriver: Add a flag to default WebDriver to headless mode
We previously only supported enabling headless mode on a per-session
basis via the capabilities record. We don't have the ability to mutate
this record from WPT, so this adds a flag to set the default mode.
2024-10-22 04:24:31 +01:00
samu698
d08d305399 LibWeb: Fixed IDL for HTMLInputElement
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Use Enumerated for the form{Enctype, Method} attributes
2024-10-21 15:41:00 -06:00
samu698
ab04f6d422 LibWeb: Fixed IDL for HTMLButtonElement
Use Enumerated for the form{Enctype, Method} attributes
2024-10-21 15:41:00 -06:00
samu698
6892482755 LibWeb: Use correct IDL for HTTPFormElement's method attribute
Removed the custom getter and updated the idl so that the attribute
is Reflected and Enumerated.
2024-10-21 15:41:00 -06:00
Timothy Flynn
ebe89a3207 WebContent: Parse the type hint in WebDriver's New Window endpoint
Although we aren't using this hint (we always create tabs), we do need
to validate the payload.
2024-10-21 13:15:11 -04:00
Tim Ledbetter
74983e6966 WebDriver: Don't return from new_window() until WebDriver is connected
Previously, tests would intermittently fail because the current session
wasn't yet aware of a newly created window handle.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-10-21 18:02:21 +01:00
Andreas Kling
72f4253911 LibWeb: Scale up "inspected node" hint text to match screen DPI
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This fixes an issue where the text would look very small on macOS.
2024-10-21 15:57:28 +02:00
Aliaksandr Kalenik
629a3ac61e LibWeb: Add missing check if scrollable overflow defined for paintable
With 6a549f6270 we need to check if
optional scrollable overflow exists for paintable box, because it's not
computed for inline nodes.

Fixes crashing after navigating into direct messages screen on Discord.
2024-10-21 15:57:19 +02:00
Jelle Raaijmakers
27928cd28c LibWeb: Add PointerEvent.getCoalescedEvents() and .getPredictedEvents()
Fixes at least 4 WPT subtests in /pointerevents.
2024-10-21 07:37:59 -04:00
Jelle Raaijmakers
effa21a69f LibWeb: Add PointerEvent.persistentDeviceId
Fixes at least 2 WPT subtests in /pointerevents.
2024-10-21 07:37:59 -04:00
Andreas Kling
325ff4ac27 Revert "LibGfx: Use actual vector size as indicated by HarfBuzz"
This reverts commit 14f5f51147.
2024-10-21 12:09:11 +02:00
Andreas Kling
fdfbfcab37 Revert "LibWeb: Unbreak harfbuzz text layout"
This reverts commit a8d0712c28.
2024-10-21 12:09:02 +02:00
Vincent Sgherzi
9ce139a3f0 LibWeb: Fix boolean logic mistake in XMLSerializer for empty public ID
Fixes 5 subtests on http://wpt.live/domparsing/xml-serialization.xhtml
2024-10-21 10:53:02 +02:00
Andreas Kling
a8d0712c28 LibWeb: Unbreak harfbuzz text layout
The reason we were keeping track of the pre-shaping buffer was to know
where we had tab characters in the input. This is a very strange way of
doing that, but since it broke the web, let's patch it up quickly.

Follow-up to #1870 which broke text layout on many web pages.
2024-10-21 10:30:12 +02:00
Ben Wiederhake
14f5f51147 LibGfx: Use actual vector size as indicated by HarfBuzz
This fixes a browser crash as experienced on Wikipedia when encountering
the &ne; entity. As a side-effect, this also affects some tab-align and
-wrap tests.
2024-10-21 10:15:39 +02:00
Jim Broadbent
97ca6036fa LibWeb/XHR: Progess event handle empty length
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-10-20 22:22:59 +02:00
samu698
50f642613d LibWeb/HTML: Implement inner text set according to spec
Replaced the ad-hoc implementation with a spec compliant one.
This change fixes 36 WPT tests.
2024-10-20 22:15:04 +02:00
Andreas Kling
58c523ae46 LibWeb: Honor appearance: none when creating input element layout node
Per css-ui-4, setting `appearance: none` is supposed to suppress the
creation of a native-looking widget for stuff like checkboxes, radio
buttons, etc.

This patch implements this behavior by simply falling back to creating
a layout node based on the CSS `display` property in such cases.

This fixes an issue on the hey.com imbox page where we were rendering
checkboxes on top of sender profile photos.
2024-10-20 21:58:58 +02:00
stasoid
6b73a2d8a4 LibCore: Port File to Windows
Co-authored-by: Cameron Youell <cameronyouell@gmail.com>
2024-10-20 10:18:03 -06:00
stasoid
f6430035e7 LibCore/System: Add initial Windows support
Co-authored-by: Cameron Youell <cameronyouell@gmail.com>
2024-10-20 10:18:03 -06:00
Timothy Flynn
6cba55893e WebContent: Return the handle of the newly opened window from New Window
We were returning the handle of the already opened window, rather than
the handle of the window we just opened.
2024-10-20 16:41:11 +01:00
Timothy Flynn
981aaba96c LibWeb: Break the Window open steps into two methods for internal use
Some callers (namely WebDriver) will need access to the navigable opened
by these steps. But if the noopener parameter is set, the returned proxy
will always be null.

This splits some of the Window open steps into an internal method that
returns the chosen navigable.
2024-10-20 16:41:11 +01:00
Bastian Müller
748e3c2e6c LibWeb/XHR: Pass API URL character encoding
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-10-20 07:58:22 -04:00
Bastian Müller
3be93ac49f LibWeb/XHR: Parse URL to resolve blob 2024-10-20 07:58:22 -04:00
Andreas Kling
4fdb266077 LibWeb: Make DOM Node unique IDs strongly typed (and 64 bit)
This is strictly nicer than passing them around as i32 everywhere,
and by switching to i64 as the underlying type, ID allocation becomes as
simple as incrementing an integer.
2024-10-20 13:42:33 +02:00
Tim Ledbetter
eca2318390 WebContent: Use window open steps to create a new window with WebDriver
This matches the specification steps and fixes a WPT regression caused
by us not loading `about:blank` when opening a new window.
2024-10-20 11:42:19 +01:00
Tim Ledbetter
f3c6326f27 LibWeb: Rename Window::open_impl() to Window::window_open_steps()
This is the same name used in the specification.
2024-10-20 11:42:19 +01:00
Shannon Booth
b999f925dc LibWeb: Allow splitting surrogate pairs in CharacterData.substringData() 2024-10-20 11:18:57 +01:00
thislooksfun
0b775da7c7 LibWeb/CSS: Evaluate media queries in shadow roots
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This fixes a rendering issue on https://prodengi.kz/ that someone on
Discord reported. :^)
2024-10-20 07:57:09 +01:00
Timothy Flynn
1aab7b51ea LibWebView: Generate hyperlinks for attributes that represent links
On the view-source page, generate anchor tags for any 'href' or 'src'
attribute value we come across. This handles both when the attribute
contains an absolute URL and a URL relative to the page.

This requires sending the document's base URL over IPC to resolve
relative URLs.
2024-10-20 08:50:01 +02:00
Cameron Youell
94601e1ffd LibCore: Add Windows version of DirIterator
Co-authored-by: stasoid <stasoid@yahoo.com>
2024-10-19 18:14:48 -06:00
rmg-x
57f82c029c LibWeb/HTML: Check if evaluationStatus has a value before dereferencing
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Previously, we would crash if scripting was disabled and a javascript
URL was evaluated.
2024-10-19 18:28:12 -04:00
Andreas Kling
f106aa9e8a LibWeb: Stop traversal early when marking nodes for child style update
These flags always propagate to the root, so once we encounter an
ancestor with the flag set, we can stop traversal since everything above
it will already be set as well.
2024-10-19 21:13:54 +02:00
Andreas Kling
d21c5631aa LibWeb: Avoid a weird reparse of style attributes for pseudo elements
For pseudo elements that represent a browser-generated shadow tree
element, such as ::placeholder, we were reparsing their style attribute
in StyleComputer for some reason.

Instead of doing this, just access the already-parsed version via
Element::inline_style().
2024-10-19 21:13:54 +02:00
Kemal Zebari
04d16a1ee3 LibWeb/HTML: Add missing HTMLElement IDL autocorrect as a stub
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
This adds an IDL stub for the autocorrect HTMLElement attribute.
2024-10-19 07:34:15 +01:00
Jelle Raaijmakers
4c189166f4 LibWeb: Implement indexed property support for HTML::Storage
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
We only supported named properties on Storage, and as a result
`localStorage[0]` would be disconnected from the Storage's backing map.

Fixes at least 20 subtests in WPT in /webstorage.
2024-10-18 23:10:22 +02:00