Commit Graph

10235 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
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
Ben Wiederhake
810fc49571 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

(cherry picked from commit f670c68ded838a30d0db341636585a67b9f9e9b5)
2024-11-12 07:14:25 -05:00
Ben Wiederhake
a2cee45b78 LibWeb: Simplify WebCrypto accesses to keys
(cherry picked from commit 6072ae5baee89e887d82d8cfc0712f0226184ca6)
2024-11-12 07:14:25 -05:00
sideshowbarker
6598ff9926 LibWeb: Ensure spaces get added where expected within accessible names
This change implements the https://w3c.github.io/accname/#comp_append
step in the “Accessible Name and Description Computation” spec — so that
when an accessible name is computed from multiple sources in a document
subtree, the parts of the computed text are joined together with spaces.

Otherwise without this change, in accessible names computed from
multiple sources in a document subtree, the parts of the computed text
are unexpectedly run together, with no spaces between the parts.

(cherry picked from commit 3ba7c536681e8471e9b53aaf8e5dd32d801e26e4)
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
1b958c9745 LibWeb: Convert internal test event coordinates to device pixels
This allows for coming up with coordinates that work on macOS with a DPR
of 2 more easily.

(cherry picked from commit 59fe7ca8300ca64ad92e47a694ee352e8f99a1f8)
2024-11-12 07:13:58 -05:00
Timothy Flynn
6cef8e5bfd LibWeb: Remove range-count filter from selection change handlers
The implementation of setBaseAndExtent will create a new range.

(cherry picked from commit 96ad310643ff90af557b9ca71db450ebd4d37ba5)
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
Timothy Flynn
9f9c9c8bcb LibWeb+LibWebView+WebContent: Return a named enum from UI event handlers
UI event handlers currently return a boolean where false means the event
was cancelled by a script on the page, or otherwise dropped. It has been
a point of confusion for some time now, as it's not particularly clear
what should be returned in some special cases, or how the UI process
should handle the response.

This adds an enumeration with a few states that indicate exactly how the
WebContent process handled the event. This should remove all ambiguity,
and let us properly handle these states going forward.

There should be no behavior change with this patch. It's meant to only
introduce the enum, not change any of our decisions based on the result.

(cherry picked from commit 541968b30dc50208f473566498100769711f10c8;
amended to fix tiny conflict in ConnectionFromClient.h due to serenity
not having #1182 yet)
2024-11-12 06:45:27 -05:00
Ali Mohammad Pur
2717669104 LibWeb+LibXML: Cache the result of parsing the XHTML DTD and reuse it
There's no reason to parse this again and again every time we parse an
XHTML document.

(cherry picked from commit 24c2ad059b9523711bd468ef50d613366c557499)
2024-11-12 04:25:50 -05:00
Ali Mohammad Pur
4847ec75a9 LibWeb: Assume XHTML <html> elements are in the HTML namespace
...unless specified otherwise explicitly.
This is dervied from an interpretation of a note in the html5 spec at
https://html.spec.whatwg.org/#xml

(cherry picked from commit 5c23ef1596b954da2515f00c7a939809cd7c4fb4)
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
Timothy Flynn
f9b74206ae LibWeb: Add a testing helper to send a single named key to an element
Unlike internals.sendText(), this allows sending keys like the escape
key.

(cherry picked from commit 53f775afb959b1912aca70c98bfbee90e2fcd07c)
2024-11-12 04:24:58 -05:00
Timothy Flynn
9c512129f7 LibWeb: Add a helper to lookup a key code from its string name
(cherry picked from commit f14e7c7261a41d1843610167cdf8e3cd671f403a;
amended to resolve conflict due to #25060)
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
Shannon Booth
57cec9ba63 LibWeb: Avoid potential infinite recursion in Document::update_layout
(cherry picked from commit aa585c4182b8755f01118062c6ea54f5739fffcd)
2024-11-12 04:24:21 -05:00
Shannon Booth
001db03171 LibWeb: Ensure fully active document before appending to an iframe
(cherry picked from commit 15c15116dd3d62c5a9ee17f6c80e1782cd2a1a96)
2024-11-12 04:24:21 -05:00
Shannon Booth
78651dda36 LibWeb: Avoid possible infinite recursion in Document::is_fully_active
(cherry picked from commit bfc28bd62157507db711ffab7ae2683cd466da51)
2024-11-12 04:24:21 -05:00
Pavel Shliak
3bbceb3a79 WebAudio: Initialize BiquadFilterNode properly
That helps to pass WPT tests
under webaudio/the-audio-api/the-biquadfilternode-interface/ctor-biquadfilter.html

(cherry picked from commit c78c7064228d41d2afddeba3a3900f0c772d7be4)
2024-11-12 04:24:21 -05:00
Piotr
850692f6c1 LibWeb: Set textarea rows and cols default value if 0
The cols and rows attributes are limited to only positive numbers with
fallback. The cols IDL attribute's default value is 20. The rows IDL
attribute's default value is 2.

The default value was returned only for the negative number. I added an
additional check for the case when the attribute is 0 to match the
specification.

(cherry picked from commit 205155a7abb9b9754cd0917901cfc04d86291820)
2024-11-12 04:24:21 -05:00
Pavel Shliak
a757259f32 LibAudio: Manage channelCount in DynamicsCompressorNode
That helps to pass more WPT tests
under /webaudio/the-audio-api/the-dynamicscompressornode-interface/ctor-dynamicscompressor.html

(cherry picked from commit 8ac60273a69cd900e744c375a5650438e9692b05)
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
Sam Atkins
3af997c4b2 LibWeb/DOM: Update a spec comment in Range::create_contextual_fragment()
Corresponds to https://github.com/whatwg/html/pull/10732

(cherry picked from commit 1777ddc5e2647d43e65d92da2203fb295ff7a92e)
2024-11-11 19:54:09 -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
Jelle Raaijmakers
07b7693349 LibWeb: Implement AudioNode.channelCount
(cherry picked from commit cb212015505f9a029c282d13697c9bd7e33df513)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers
8c86f9ad75 LibWeb: Implement AudioNode.numberOfInputs and .numberOfOutputs
(cherry picked from commit 7b4f0d13eede588368189bb612ca9c90e2d56894)
2024-11-11 19:54:09 -05:00
Jelle Raaijmakers
7189d342f5 LibWeb: Forward declare AudioDestinationNode to break header loop
(cherry picked from commit d7a3bad2b4c08b02c3df73e6c344c6bf7dadcbeb)
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
Tim Ledbetter
c8319c9166 LibWeb: Don't print messages from workers to the console twice
Previously, any message logged to the console within a worker with a
log level greater than trace was printed twice.

(cherry picked from commit d0008ae5e0100984f3188c32a67008a03c05bea8)
2024-11-11 19:54:09 -05:00
Timothy Flynn
85c6ca8417 LibWeb: Remove debug spam from Navigator methods
These are logged ~1000 times on fast.com.

(cherry picked from commit 76152845fdb74d4881c6d8e43790146780fbe7b3)
2024-11-11 19:54:09 -05:00
stelar7
2ba1e4083b LibWeb: Parse mimetype when creating Blob and File
(cherry picked from commit 193c0dcafcb81052694e9d95078f5efba0aacae6)
2024-11-11 19:54:09 -05:00
stelar7
ed7af71508 LibWeb: Iterate over utf8 codepoints when checking validity
(cherry picked from commit 0739f1b1e6ec09250b415e1efa3cdf6a038e2181)
2024-11-11 19:54:09 -05:00
Edwin Hoksberg
94d2315a59 LibWeb: Handle Refresh header
Fixes a bunch of tests in:
- https://staging.wpt.fyi/results/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh

(cherry picked from commit cbe4ba7f8c825d9732346964c8f1f1f8eec00eac)
2024-11-11 19:54:09 -05:00
Kostya Farber
02797c6e8e LibWeb/CSS: Implement delete method for FontFaceSet
(cherry picked from commit 09aec4be7165f27d65caf614b097ec2ff11ad9c0)
2024-11-11 19:30:05 -05:00
Kostya Farber
3b7adbca69 LibWeb/CSS: Implement add for FontFaceSet
There is still some work to do with some of the underying methods
called inside this method (e.g is_css_connected) but this is a start.

(cherry picked from commit 14d62d7f31e49e021332f3e64e6ea4b285dcdd15)
2024-11-11 19:30:05 -05:00
Carwyn Nelson
7a76f8b265 LibWeb: Skip transitions for pseudo elements
Transitions are currently not implemented for pseudo elements which
causes the transition to be applied to the "real"/"parent" element. When
a transition adjusts width/height on a pseudo element this causes the
real elements layout to break.

As a quick fix we just skip doing transitions when they are against
pseudo elements.

(cherry picked from commit 30f59cfe1aec0b385631a40da8b2447eed62ad79)
2024-11-11 17:22:42 -05:00
Shannon Booth
191b686699 LibWeb: Throw exception for invalid URL before creating traversable
Which fixes the following WPT test from failing due to issues stemming
from all of the windows which have been opened.

https://wpt.live/url/failure.html

This will give us 1205 new subtests passing in WPT.

(cherry picked from commit f2134dc1e960cb1d0c743b375509fe165885ddbe)
2024-11-11 17:22:42 -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
Andreas Kling
3479bf0470 LibWeb: Make Document::m_intersection_observers a weak mapping
These registrations are not meant to keep the observers alive.
This fixes a handful of world leaks on Speedometer.

(cherry picked from commit b397a0d5350fad04f43e3e5d9bdb9c801a4e712a)
2024-11-11 17:22:05 -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
Andreas Kling
fcc40ca35f LibWeb: Stub out SVGGraphicsElement.getScreenCTM()
This allows us to run Speedometer 3.0 to completion. :^)

(cherry picked from commit 72320be1240039822693aa1659c4adbb24cde87f)
2024-11-11 09:17:08 -05:00
Shannon Booth
e1e4b50a9c 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.

(cherry picked from commit 1096b6493668724ff9776929339e40b33213f410)
2024-11-11 09:14:29 -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
da3b916ba3 LibWeb/XHR: Pass API URL character encoding
(cherry picked from commit 748e3c2e6c680fa78b24d7a2643fe79b234943d6)
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