Commit Graph

1704 Commits

Author SHA1 Message Date
Ben Wiederhake
806f30d1d2 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!

(cherry picked from commit 124bd115a1342d9b4a7536fa62acedee279a12c9)
2024-11-12 07:14:25 -05:00
sideshowbarker
aa34916d45 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

(cherry picked from commit ede6924db8e4440ef3bdb0fbb34d31226568e55a)
2024-11-12 07:14:25 -05:00
Florian Cramer
60c67c02f0 LibXML: Allow empty pubid when parsing document type
(cherry picked from commit 1775021d7128ebe7fff680e13e1d37d14c62fd12)
2024-11-12 07:14:25 -05:00
Florian Cramer
cbd9e7d9fe LibXML: Allow empty systemid when parsing document type
This fixes at least one WPT under /domparsing

(cherry picked from commit 89192ecc46576b0872ff51a073d088f89223cd61)
2024-11-12 07:14:25 -05:00
Ben Wiederhake
7811ed378e LibWeb: Test subtleties in HKDF 'salt' interpretation
This also doubles as HKDF implementation test.

(cherry picked from commit 6d68d6ddb2d74f7fdcfe44169366aee9b127f1df)
2024-11-12 07:14:25 -05:00
Timothy Flynn
1402fe99d5 LibWeb: Do not assume the shadow root has a host when updating selection
For example, if the shadow root was detached from the document in some
manner, its host will be null.

(cherry picked from commit 8fb2cc2be1d7a63eba7b1ae5c93e3db181ca393f)
2024-11-12 07:13:58 -05:00
Timothy Flynn
af3222b686 LibWeb: Update the document cursor position when the selection changes
Otherwise, it looks a bit awkward where the cursor position does not
update while the selection is elsewhere.

Note that this requires passing along the raw selection positions from
`set the selection range` to the elements. Otherwise, consider what will
happen if we set the selection start and end to the same value. By going
through the API accessor, we hit the case where the start and end are
the same value, and return the document cursor position. This would mean
the cursor position would not be updated.

The test changes here more closely match what Firefox produces now. It
is not a 100% match; the `select event fired` test case isn't right. The
problem is the event fires for the input element, but we most recently
focused the textarea element. Thus, when we retrieve the selection from
the input element, we return the document's cursor position, which is
actually in the textarea element. The fix will ultimately be to fully
implement the following:

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-textarea/input-cursor

That is, each input / textarea element should separately track its own
text cursor position.

(cherry picked from commit fd289deb44e0fc26f54a133c637c136bf0716cd5)
2024-11-12 07:13:58 -05:00
Ali Mohammad Pur
bc9e03ea38 AK: Cache all the line positions in LineTrackingLexer
Also updates a LibWeb text test that used to report the wrong line
number.

(cherry picked from commit 02b50d463b174e5d525c7ab8ce8dd173d550de28;
amended to exclude LineTrackingLexer from KERNEL, since that now use
make<>)
2024-11-12 04:25:50 -05:00
Timothy Flynn
3aec9df468 LibWeb: Do not unconditionally prevent escape keys from being propagated
We should only block the escape key from being sent to the web page if
the CloseWatcherManager actually closed something.

We use the escape key in the Inspector to cancel editing a DOM field.
This unconditional early return broke this feature.

(cherry picked from commit 099956a7cd2bec55e7e0376d54525f8a3f7b1955)
2024-11-12 04:24:58 -05:00
stelar7
816e658dfd LibWeb: Bring performance.now() closer to spec
(cherry picked from commit f6991a29559add9f0b3b4dee4a9ace2338a25511)
2024-11-12 04:24:21 -05:00
Pavel Shliak
8818cca08a LibAudio: Manage channelCountMode in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html

(cherry picked from commit f2ed59879f7781019152a18740fc5743cc513016)
2024-11-12 04:24:21 -05:00
Totto16
c1b0ac6376 LibWeb: Reject Promise in createImageBitmap for Not Implemented Types
If we don't reject the Promise, it lasts forever,
so rejecting non implemented Promises is essential,
to not timeout in e.g. WPT tests

(cherry picked from commit aab5a9e944f8b1c1a9de321047556bbcaa282a56)
2024-11-11 19:54:09 -05:00
Andreas Kling
1600dcaf19 LibWeb: Ignore boxes wholly in the negative scrollable overflow region
This fixes an issue where https://hey.com/ was horizontally scrollable
even though it shouldn't be.

(cherry picked from commit 94721385ceb17e20428b94a946d39828bdd5b74e)
2024-11-11 19:54:09 -05:00
Tim Ledbetter
f9158f4210 LibWeb: Fire iframe load event on document close
This matches the behavior of other browsers.

(cherry picked from commit e1eeb93cc6095a47371d23db0bbf55eb30215cee)
2024-11-11 19:54:09 -05:00
Noah Bright
8725bb12f2 LibWeb: Define PerformanceEventTiming
https://www.w3.org/TR/event-timing/#sec-performance-event-timing

Add idl, header and stubs for PerformanceEventTiming interface.

Two missing `PerformanceEntry` types that have come up in issues
are the `first-input` and the `event` entryTypes. Those are both
this.

Also, because both of those are this same interface, the static
methods from the parent class are difficult to implement because
of instance-specific details. Might either need subclasses or to
edit the parent and also everything that inherits from it :/

(cherry picked from commit d30ae92b82d997bc4db407c563c88f90d8260093)
2024-11-11 19:54:09 -05:00
Shannon Booth
9150241db9 LibWeb: Throw a SyntaxError on invalid URL for Location href setter
Aligning with a spec update, fixing 195 tests for:

https://wpt.live/url/failure.html
(cherry picked from commit ea971792b5da5f10cadb4f88f49c9722d88b32f6)
2024-11-11 17:22:42 -05:00
Ángel Carias
245d577235 LibWeb/DOM: Implement Node.lookupPrefix
Adds https://dom.spec.whatwg.org/#dom-node-lookupprefix

(cherry picked from commit 9624e0d2a2dc952b80e1ce1999f816f60c1ad813)
2024-11-11 15:46:34 -05:00
samu698
a37e4092bc 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.

(cherry picked from commit 50f642613de54c73473c216fdc4d7e607e712679)
2024-11-10 21:48:40 -05:00
Bastian Müller
62894c9d3f LibWeb/XHR: Parse URL to resolve blob
(cherry picked from commit 3be93ac49fc93b905b5466896605c3375835c97c)
2024-11-10 21:48:40 -05:00
Shannon Booth
b901a8753d LibWeb: Allow splitting surrogate pairs in CharacterData.substringData()
(cherry picked from commit b999f925dcfb0417c534e1a21aa74626a06b466b)
2024-11-10 21:48:40 -05:00
Gasim Gasimzada
696021e252 LibJS: Set configurable toStringTag property for console
(cherry picked from commit c5b8e75204cb1603e2470e6cfeee3f2161a49b91)
2024-11-10 18:24:10 -05:00
Tim Ledbetter
736255ae87 LibWeb: Avoid division by zero in SourceSet width descriptor calculation
(cherry picked from commit 087d4004721193c290b18515e90b047192880a70)
2024-11-10 18:24:10 -05:00
Timothy Flynn
26551f6700 LibWeb: Always call document.close after document.write
This ensures the HTML parser completes running if it previously stopped
at an insertion point during a call to `document.write`.

(cherry picked from commit 230314238655204b89dd0736da4537b475eb252a)
2024-11-10 17:42:37 -05:00
Kemal Zebari
9714e98dc9 LibWeb/MimeSniff: Update the MIME type sniffing algo to meet specs
The spec moved/added the xml and html checks to the beginning and
removed sniffing resource feeds.

(cherry picked from commit b8a5e18a016dc32ba065417a4d6d32bbc03f101d)
2024-11-10 10:46:01 -05:00
Andrew Kaster
1b36465eea LibWeb: Deduplicate attributes when emitting start and end tags
The HTML tokenizer specification says that we're supposed to do this
when leaving the Attribute name or when emitting the token, as
appropriate.

Hopefully 'as appropriate' can mean only when emitting the token, as
that's the easiest place to insert this logic without complicating the
tokenizer any more.

(cherry picked from commit 7aa0165fe75bb94b79bc847484c7913d249ce263)
2024-11-10 10:46:01 -05:00
Andreas Kling
bca2b88b45 LibWeb: Always blockify the root element
This is what the spec tells us to do:

    The root element’s display type is always blockified,
    and its principal box always establishes an independent
    formatting context.

    Additionally, a display of contents computes to block
    on the root element.

Spec link: https://drafts.csswg.org/css-display/#root

Fixes #1562

(cherry picked from commit f1be662f683155705f851bcf440fe30d0e606a87)
2024-11-10 10:46:01 -05:00
Tim Ledbetter
fa08ac3631 LibWeb: Fire error event when script has an execution error
We now use the "report an exception" AO when a script has an execution
error. This has mostly replaced the older "report the exception" AO in
various specifications. Using this newer AO ensures that
`window.onerror` is invoked when a script has an execution error.

(cherry picked from commit 579a289d3db849657987c3310e7b1d71d290b566)
2024-11-10 10:46:01 -05:00
Andreas Kling
16473663ea LibJS: Don't infinite loop on unknown console.log formatting specifiers
(cherry picked from commit ef9208047dc8770f6263b483d7a442df703bc42b)
2024-11-10 10:46:01 -05:00
Sam Atkins
c369a2b48c LibWeb/CSS: Correct behavior of revert inside a @layer
`revert` is supposed to revert to the previous cascade origin, but we
previously had it reverting to the previous layer. To support both,
track them separately during the cascade.

As part of this, we make `set_property_expanding_shorthands()` fall back
to `initial` if it can't find a previous value to revert to. Previously
we would just shrug and do nothing if that happened, which only works
if the value you want to revert to is whatever is currently in `style`.
That's no longer the case, because `revert` should skip over any layer
styles that have been applied since the previous origin.

(cherry picked from commit bea47a25545adfb96d83a16a3e4f4435bae05e39)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
070fa6febf LibWeb/WebVTT: Implement VTTCue idl interface
(cherry picked from commit 973f774e56b519964f2f43d965035d9076658096)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
b8530d3848 LibWeb/WebVTT: Implement VTTRegion idl interface
(cherry picked from commit 1a012f279a9791c685781b7189fba6cddb973f96)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
7003437a43 LibWeb/HTML: Implement TextTrackCueList idl interface
(cherry picked from commit cfec88feb312f3fbffe2270009a9ba07e2fd9b3f)
2024-11-10 10:46:01 -05:00
Jamie Mansfield
24f5f7289f LibWeb/HTML: Implement TextTrackCue idl interface
(cherry picked from commit 0b2449d8d264f58b39ed2a4a69b0afb8eb762011)
2024-11-10 10:46:01 -05:00
Andreas Kling
b0b5a056b3 LibWeb: Allow setting shorthand CSS properties via CSSStyleDeclaration
We now expand shorthands into their respective longhand values when
assigning to a shorthand named property on a CSSStyleDeclaration.

We also make sure that shorthands can be round-tripped by correctly
routing named property access through the getPropertyValue() AO,
and expanding it to handle shorthands as well.

A lot of WPT tests for CSS parsing rely on these mechanisms and should
now start working. :^)

Note that multi-level recursive shorthands like `border` don't work
100% correctly yet. We're going to need a bunch more logic to properly
serialize e.g `border-width` or `border` itself.

(cherry picked from commit e40ad73ae79023f64e250f854d0730c21e0f54fc)
2024-11-10 10:46:01 -05:00
Andreas Kling
adad01a830 LibWeb: Always flush character insertions before exiting HTML parser
This fixes an issue where document.write() with only text input would
leave all the character data as unflushed text in the parser.

This fixes many of the WPT tests for document.write().

(cherry picked from commit a0ed12e839f14b3ac80caca0e18a09ca256fd99d)
2024-11-10 10:46:01 -05:00
Tim Ledbetter
5272446a09 LibWeb: Return a WindowProxy from document.defaultView
This aligns our implementation with the most recent specification steps.

(cherry picked from commit 089139f09dbc78455c5c09916cbc97e33f823ca0)
2024-11-10 10:46:01 -05:00
Andreas Kling
cfa323ed6e LibWeb: Let style elements remember which StyleSheetList they live in
Instead of trying to locate the relevant StyleSheetList on style element
removal from the DOM, we now simply keep a pointer to the list instead.

This fixes an issue where using attachShadow() on an element that had
a declarative shadow DOM would cause any style elements present to use
the wrong StyleSheetList when removing themselves from the tree.

(cherry picked from commit 8543b8ad6a4d96bd0c247052572b8c2abf3929a7)
2024-11-10 10:46:01 -05:00
Annya
a371e02c5f LibWeb: Implement Range's extension method
This patch implements `Range::getClientRects` and
`Range::getBoundingClientRect`. Since the rects returned by invoking
getClientRects can be accessed without adding them to the Selection,
`ViewportPaintable::recompute_selection_states` has been updated to
accept a Range as a parameter, rather than acquiring it through the
Document's Selection.

With this change, the following tests now pass:

- wpt[css/cssom-view/range-bounding-client-rect-with-nested-text.html]
- wpt[css/cssom-view/DOMRectList.html]

Note: The test
"css/cssom-view/range-bounding-client-rect-with-display-contents.html"
still fails due to an issue with Element::getClientRects, which will
be addressed in a future commit.

(cherry picked from commit 75c7dbc5d2dd045733a4c319aeab6644b5b7b36d)
2024-11-10 10:46:01 -05:00
Andreas Kling
4779c6ac60 LibWeb: Keep custom properties from all cascade layers
Before this change, we were cascading custom properties for each layer,
and then replacing any previously cascaded properties for the element
with only the set from this latest layer.

The patch fixes the issue by making each pass of the custom property
cascade add to the same set, and then finally assigning that set of
properties to the element.

(cherry picked from commit 95bd0602ba079e0bd7608e39bcbc3b0403ed89d1)
2024-11-10 10:46:01 -05:00
Aliaksandr Kalenik
8d56f0ed15 LibWeb: Print FIXME instead of crashing in abspos SVG element layout
Currently we are crashing in `verify_cast<BlockContainer>(box)` on
attempt to create BFC for SVG box.

(cherry picked from commit fa907029ee6f202095011b84b109bc4a2b56c58b)
2024-11-09 16:08:01 -05:00
Tim Ledbetter
8bf45930df LibWeb: Expose crypto object to workers
This change moves the `crypto()` getter from `Window` to
`WorkerOrWindowGlobalScope`. This aligns our implementation with the
WebCrypto specification.

(cherry picked from commit 89b6cd3fb1b9a3058dbada9e12606950b466936a)
2024-11-09 16:08:01 -05:00
Tim Ledbetter
961272cf60 LibWeb: Don't crash when determining slot element auto directionality
(cherry picked from commit 0de314507153b6ae17d15f3b03df10a7844ed224)
2024-11-09 16:08:01 -05:00
Tim Ledbetter
5d9aac0330 LibWeb: Abort dependent signals before firing abort event
Previously, there was a bug in the specification that would cause an
assertion failure, due to the abort event being fired before all
dependent signals were aborted.

(cherry picked from commit 3ae4ea7b10e5022079d0b203844fc93899c08a09)
2024-11-09 16:08:01 -05:00
sideshowbarker
8ce5f6257b Tests: Add some colorful pass/fail emoji to a test case
This change adds green and red pass/fail emoji indicators to an in-tree
test — to make it easier to manually scan through the test results and
quickly see which cases are passing, and which are failing.

(cherry picked from commit 6f5d0de5e780f10c63d168bb1d29c69a963376ac)
2024-11-09 16:08:01 -05:00
Jamie Mansfield
ee8de58b98 LibWeb/HTML: Implement DataTransferItem.webkitGetAsEntry()
(cherry picked from commit 2e9aec984cc3c75f10ea3e6f50ea2ed34f4bd2b6)
2024-11-09 16:08:01 -05:00
Jamie Mansfield
722e144eba LibWeb/EntriesAPI: Implement FileSystemEntry
(cherry picked from commit 169163b0023302ae3a0762d875e7b7840cfcb687)
2024-11-09 16:08:01 -05:00
Khaled Lakehal
71a01c8122 LibWeb: Add setter implementation for location.search
This commit implements the setter for `location.search`, allowing
updates to the query string of the URL.

(cherry picked from commit 514a2a1757b10b9b4ff020237c84f70ba5a79c4b)
2024-11-09 16:08:01 -05:00
Shannon Booth
85e0c80061 LibWeb: Sort URLSearchParams using UTF-16 code units
We were previously sorting using code points which could give the wrong
result for certain inputs.

Fixes the last two failing tests on:

https://wpt.live/url/urlsearchparams-sort.any.html
(cherry picked from commit d56da8cf9a0298d3e6e3ee8984f60d4a3217183b)
2024-11-09 07:30:40 -05:00
Shannon Booth
4a8e46090a LibWeb: Strip trailing spaces from opaque URL path on query change
This was added in https://github.com/whatwg/url/commit/fdaa0e5a
to fix a case where roundtrips could fail. We had already partially
implemented these steps - but it seems this was missed in the update of
URLSearchParams.

Fixes the last failing WPT test for:

https://wpt.live/url/urlsearchparams-delete.any.html
(cherry picked from commit cff3e78a1472a4cf49f0f8121d78c90a3483525d)
2024-11-09 07:30:40 -05:00
Tim Ledbetter
943f47fa97 LibWeb: Implement the setter for location.protocol
(cherry picked from commit 1365289d984c32ca7bc076b7892dd56041ab26e2)
2024-11-09 07:30:40 -05:00