Commit graph

35627 commits

Author SHA1 Message Date
Tim Ledbetter
ebe1dc6dcd LibWebSocket: Send closing frame when server begins a closing handshake 2024-10-16 08:31:49 +02:00
Tim Ledbetter
0b365061d1 LibWebSocket: Ensure connection is failed on invalid opening handshake 2024-10-16 08:31:49 +02:00
Andrew Kaster
9d0ce4df0f LibWeb: Add support for parsing comments in the Swift HTML tokenizer 2024-10-16 08:31:42 +02:00
Andrew Kaster
36a8ad9157 LibGfx: Move FontDatabase internals to SystemFontProvider interface
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 will be the first step is making better use of system libraries
like fontconfig and CoreText to load system fonts for use by the UI
process and the CSS style computer.
2024-10-15 15:09:16 -06:00
Sam Atkins
81596b4145 LibWeb/CSS: Stop invalidating style when setting an animation's effect
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 reverts 6d25bf3aac

Invalidating the style here means that transitions can cause an element
to leave style computation with its "needs style update" flag set to
true. This then causes a VERIFY to fail in the TreeBuilder.

This invalidation does not otherwise seem to have any effect. The
original commit suggests this was to fix a bug, but it's not clear what
bug that was. If it reappears, we can try to solve the issue in a
different way.
2024-10-15 08:43:26 -04:00
Benjamin Bjerken
63d9ed9d8c LibWeb: Fix CloseWatcher constructor for detached iframes
This fixes the last subtest in /close-watcher/frame-removal.html :)
2024-10-15 08:41:54 -04:00
Jelle Raaijmakers
14b2e5849d LibWeb: Add barebones BaseAudioContext.decodeAudioData()
Implement just enough steps to get https://zty.pe/ working! :^)
2024-10-15 10:02:15 +02:00
Jelle Raaijmakers
7b76438d57 LibWeb: Accept JS::HeapFunction when queuing a media element task
This opens up the possibility of easier memory management in future
changes.
2024-10-15 10:02:15 +02:00
Jelle Raaijmakers
177e5210e0 LibWeb: Move 'queue a media element task' to BaseAudioContext
We need these steps to be available for the yet to be implemented
`BaseAudioContext.decodeAudioData()`.
2024-10-15 10:02:15 +02:00
Jelle Raaijmakers
273a46cc76 LibWeb: Remove unused include from AudioBuffer 2024-10-15 10:02:15 +02:00
Jelle Raaijmakers
3df3977ca5 LibWeb: Correct AudioBuffer spec link 2024-10-15 10:02:15 +02:00
justus2510
7a92b47a35 LibWeb: Make FileReader fire progress event
Fixes wpt/FileAPI/reading-data-section/filereader_events.any.html :)
2024-10-15 08:42:37 +02:00
Timothy Flynn
c0102aa818 LibJS: Support date strings of the form "Wed Apr 17 2019 23:08:53""
Seen on https://www.skaping.com/valloire/galibier.
2024-10-15 08:25:32 +02:00
Andrew Kaster
a3157c8c69 LibWasm: Reject indirect calls to external function references
Some checks failed
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
Build Dev Container Image / build (push) Has been cancelled
This fixes a test in the WebAssembly spec test suite that was
added in 924c1f816d
2024-10-14 18:14:18 -06:00
Shannon Booth
329e9ed820 LibWeb: Fix spec typo in inner_navigate_event_firing_algorithm
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-14 20:49:03 +02:00
Shannon Booth
dc9861174b LibWeb: Fire traversable event during "apply the history step"
These steps were recently clarified by Andrew in:

https://github.com/whatwg/html/commit/12b0d582
2024-10-14 20:49:03 +02:00
Shannon Booth
bd3ffcdabb LibWeb: Simplify populate_session_history_entry_document conditional 2024-10-14 20:49:03 +02:00
Shannon Booth
41f574155d LibWeb: Factor out AO for 'try to scroll to the fragment'
I had made a stab at implementing this to determine whether it could
assist in fixing an issue where scroll_to_the_fragment was not getting
called at the appropriate time. It did not fix that issue, and actually
ended up breaking one of our in tree tests. In the meantime, factor out
this method into a standalone function.
2024-10-14 20:49:03 +02:00
Andreas Kling
279d229f71 LibWeb: Remove unnecessary use of TRY_OR_THROW_OOM in XMLHttpRequest 2024-10-14 20:47:35 +02:00
Andreas Kling
fa1c5a3e85 LibWeb: Make XMLHttpRequests functions related to MimeType infallible 2024-10-14 20:47:35 +02:00
Andreas Kling
600cb5ccba LibWeb: Make MimeSniff::Resource::sniff() infallible
Everyone was already using this API as if it were infallible anyway.
2024-10-14 20:47:35 +02:00
Andreas Kling
5c20bc2afc LibWeb: Make MimeSniff::MimeType::parse() infallible
It already returns an empty Optional for failures, so there's no need to
wrap it in an ErrorOr as well.
2024-10-14 20:47:35 +02:00
Andreas Kling
88e7688940 LibWeb: Make more MimeSniff::MimeType APIs infallible 2024-10-14 20:47:35 +02:00
Andreas Kling
9a8db40a23 LibWeb: Make MimeSniff::MimeType::create() infallible 2024-10-14 20:47:35 +02:00
Andreas Kling
073bcfd386 AK+LibWeb: Add {Fly,}String::to_ascii_{upper,lower}_case()
These don't have to worry about the input not being valid UTF-8 and
so can be infallible (and can even return self if no changes needed.)

We use this instead of Infra::to_ascii_{upper,lower}_case in LibWeb.
2024-10-14 20:47:35 +02:00
Andreas Kling
dd419b5a8d AK: Make String::number() infallible
This API will always succeed in creating a String representing the
provided number in base-10.
2024-10-14 20:47:35 +02:00
Edward Banner
03569fc509 LibWeb: Fix table overflow issues
- Include vertical border spacing in row group offset calculation so
  that they are axis-aligned with child row/cell elements. This makes it
  so there isn't horizontal and vertical overflow caused by child
  row/cell elements.
- Include horizontal border spacing in tr width calculations. This makes
  it so tr elements don't have overflow anymore when there are multiple
  columns.
- Apply vertical caption offset to row group top offset.
- Don't double-count top padding when calculating vertical offset for
  tr and row groups.
2024-10-14 17:30:17 +01:00
Jelle Raaijmakers
70b3936188 LibMedia: Handle EOF as end of stream in FFmpegLoader
We were dealing with EOF by returning a generic I/O error, but
Audio::Loader requires us to return empty chunks at the end of stream.
2024-10-14 11:59:23 -04:00
Jelle Raaijmakers
c6d0075796 LibWeb: Report audio decoding errors to debug console 2024-10-14 11:59:23 -04:00
ronak69
917a2a3c86 LibWeb: Only return HTML elements from getElementsByName()
Fixes two WPT tests:
document.getElementsByName-namespace-xhtml.xhtml and
document.getElementsByName-namespace.html
2024-10-14 17:59:00 +02:00
Jelle Raaijmakers
d5fd29adb7 LibWeb: Update DOM IDL specs
I noticed some of these were running behind the upstream spec.
2024-10-14 11:57:58 -04:00
Sam Atkins
c79f261bec LibWeb/CSS: Mark grid-[gap, column-gap, row-gap] properties as aliases
These are legacy name aliases for the properties without the 'grid-'
prefix. See https://drafts.csswg.org/css-align-3/#gap-legacy
2024-10-14 17:57:34 +02:00
Bastian Neumann
b3fdeef5d7 LibWeb: Do not accept malformed xml namespace
This runs wpt domparsing/DOMParser-parseFromString-xml-parsererror.html
that previously crashed because of a malformed XML namespace in the
test.
2024-10-14 16:20:57 +01:00
Shannon Booth
cde3545a51 LibWeb: Correct some faulty logic in 'apply the history step'
We were checking if the parent was _not_ null, and not checking for an
auxiliary browsing context at all.
2024-10-14 13:45:34 +01:00
ronak69
592cf556a1 LibWeb/CSS: Don't serialize empty rules in CSSStyleRule
This is a recent spec change:
https://github.com/w3c/csswg-drafts/pull/10974
2024-10-14 13:43:16 +01:00
ronak69
8003d63ff9 LibWeb/CSS: Don't serialize empty rules in CSSMediaRule
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 is a recent spec change:
https://github.com/w3c/csswg-drafts/pull/10981
2024-10-14 09:50:41 +01:00
Taylor Mapes
0522e514a9 LibWeb: Implement CanvasRenderingContext2D.createImageData(ImageData)
Fixes at least one WPT test.
https://wpt.live/html/canvas/element/pixel-manipulation/2d.imageData.create1.basic.html
2024-10-14 09:33:49 +01:00
Taylor Mapes
6ffe83c9da LibWeb: Correct spec link for CanvasImageData 2024-10-14 09:33:49 +01:00
Andreas Kling
5b060da4f4 LibJS: Cache symbolicated stack frames on ExecutionContext
Instead of re-symbolicating entire stacks from scratch every time
we want a JS VM backtrace, we now use the ExecutionContext object as
cache storage via a new CachedSourceRange object.

This means that once a stack frame has been symbolicated, we don't
have to resymbolicate it again (unless the program counter moves
within that stack frame).

This drastically reduces time spent in symbolication in some WPT tests.
2024-10-14 09:51:13 +02:00
Timothy Flynn
e070ed5658 LibWeb+LibWebView: Add an internal API to expire cookies with an offset
Cookies have a minimum expiry resolution of 1 second. So to test cookie
expiration, the test had to idle for at least a second, which is quite a
noticeable delay now that LibWeb tests are parallelized.

Instead, we can add an internal API to expire cookies with a time offset
to avoid this idle delay.
2024-10-14 08:25:41 +02:00
Cory Virok
560c3824b9 LibWeb: Implemented the CanvasRenderingContext2D::createImageData() spec
The only real change here is to use the absolute magnitude of the
width/height when creating the ImageData.

This fixes the crash on this WPT test:
https://wpt.fyi/results/html/canvas/element/pixel-manipulation/2d.imageData.create2.double.html?label=master&product=ladybird
2024-10-14 08:25:19 +02:00
Cory Virok
01301c374b LibWeb: Wrap negative dims for getImageData()
Given negative width or height values for CanvasRenderingContext2D
getImageData(), translate the source rect.

I wasn't able to find this in the spec, but WPT tests for it and MDN
defines this behavior.

Fixes this WPT test:
https://wpt.live/html/canvas/element/pixel-manipulation/2d.imageData.get.source.negative.html

Described in MDN here:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData#sw

getImageData() spec:
https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-getimagedata
2024-10-14 08:24:36 +02:00
Cory Virok
d71887e48c LibWeb: Use abs() dimensions for canvas getImageData()
Similar to https://github.com/LadybirdBrowser/ladybird/pull/1774

Fixes the crash in the WPT test:
https://wpt.fyi/results/html/canvas/element/pixel-manipulation/2d.imageData.get.double.html?label=master&product=ladybird
2024-10-14 08:24:36 +02:00
Sam Atkins
e0be17e4fb LibWeb/CSS: Rewrite CSS Parser core methods according to new spec
CSS Syntax 3 (https://drafts.csswg.org/css-syntax) has changed
significantly since we implemented it a couple of years ago. Just about
every parsing algorithm has been rewritten in terms of the new token
stream concept, and to support nested styles. As all of those
algorithms call into each other, this is an unfortunately chonky diff.

As part of this, the transitory types (Declaration, Function, AtRule...)
have been rewritten. That's both because we have new requirements of
what they should be and contain, and also because the spec asks us to
create and then gradually modify them in place, which is easier if they
are plain structs.
2024-10-14 08:08:37 +02:00
Sam Atkins
f11c0e6cc0 LibWeb/CSS: Implement "is a custom property name string" to spec
This will be needed in the Parser soon, so for lack of a better place,
it's going in a separate header.
2024-10-14 08:08:37 +02:00
Sam Atkins
7723873016 LibWeb/CSS: Make CSSStyleRule be a CSSGroupingRule
As part of this, we can now fill in the missing serialization steps.

The parsing is a stub for now, and will be filled out in a subsequent
commit.
2024-10-14 08:08:37 +02:00
Andreas Kling
ac48222ed7 LibWeb: Recompute targetStep during "apply the history step"
This is an ad-hoc change to account for the fact that we may run
arbitrary code while waiting for the tasks in this function to complete.

I don't have a way to reproduce it, but I've seen trouble caused by
navigables disappearing, which causes the history step numbers to be
disturbed.
2024-10-14 07:45:19 +02:00
ronak69
3ff6137121 LibWeb: Insert title as first child on setting title of svg document
Before, the new title element got appended instead of prepended, as
nullptr was passed as the "child" argument to the insert_before()
function.

This change makes two WPT tests pass in:
http://wpt.live/html/dom/documents/dom-tree-accessors/document.title-09.html
2024-10-14 07:13:58 +02:00
Aliaksandr Kalenik
910f9c2c09 LibWeb: Remove BrowsingContext pointer from Layout::Node
It's no longer needed.
2024-10-14 07:12:36 +02:00
Aliaksandr Kalenik
5559a3dc6e LibWeb: Remove BrowsingContext pointer from Paintable
It's no longer needed.
2024-10-13 22:11:04 +01:00