Commit graph

35530 commits

Author SHA1 Message Date
rmg-x
db0dbb384e RequestServer: Set default timeout to 90 seconds for all requests 2024-10-10 19:56:11 +01:00
rmg-x
ff18114ae7 LibWeb+LibRequests+RequestServer: Report network error on request finish
This allows us to bubble up network errors to API consumers after
finishing a request.
2024-10-10 19:56:11 +01:00
Neil Viloria
9e2b70661e LibWeb/Layout: Unify grid justify-content handling for grid area
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-10 13:37:08 +02:00
Timothy Flynn
d6a8fc00c3 LibWeb: Implement dispatching WebDriver key down and key up actions
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-10 10:41:10 +02:00
Timothy Flynn
5b2633d90f LibWeb: Support non-required numpad code names
These aren't required to comply with the UIEvents spec, but they are
required by WebDriver.
2024-10-10 10:41:10 +02:00
Timothy Flynn
a11e5055c7 LibWeb: Allow multi-byte code point events to have their key field set
Multi-byte code point presses do not have a UIEvents::KeyCode value, so
we would previously set the event's key field to "Unidentified".
2024-10-10 10:41:10 +02:00
Timothy Flynn
96b5646fc1 LibWeb: Properly handle when (shift+)tab wraps around the page
We have support for using (shift+)tab to move focus to the next/previous
element on the page. However, there were several ways for this to crash
as written. This updates our implementation to check if we did not find
a node to move focus to, and to reset focus to the first/last node in
the document.

This doesn't seem to work when wrapping around from the first to the
last node. A FIXME has been added for that, as this would already not
work before this patch (the main focus here is not crashing).
2024-10-10 10:41:10 +02:00
Timothy Flynn
13fe3477ab WebContent: Wait for same-URL WebDriver navigations to complete
The spec says we don't need to await navigations if we navigate to the
same URL that we are already on, but at least in our implementation, we
should still await the page load. Otherwise, we will invoke WebDriver
endpoints on the wrong page.
2024-10-10 10:41:10 +02:00
Timothy Flynn
cbf8f1495c WebContent: Create an execution context when getting an element property
Calling Object::get requires a running execution context.
2024-10-10 10:41:10 +02:00
0x4261756D
96de4ef7e0 LibTextCodec: Add SingleByteEncoders
They are similar to their already existing decoder counterparts.
2024-10-10 10:39:28 +02:00
Andrew Kaster
7faebb2702 LibWeb: Implement most of Service Worker registration
Some checks are pending
Lint Code / lint (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (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
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
Push notes / build (push) Waiting to run
This approach will need some rework to be properly handled at the user
agent level instead of per renderer process, but it's a start.
2024-10-09 15:58:36 -06:00
Andrew Kaster
f4f70068a8 LibWeb: Teach AK how to hash StorageKeys 2024-10-09 15:58:36 -06:00
Andrew Kaster
2156de7172 LibWeb: Spoof the ESO's creation url in tests
This is necessary when we add more ServiceWorker capabilities, that
actually check this value. The more this spoof functionality is used,
the more we'll need to actually support serving test files over https.
2024-10-09 15:58:36 -06:00
Jelle Raaijmakers
25516e351e LibWeb: Clear grapheme segmenter when invalidating TextNode text
We only set the grapheme segmenter's text once after creating a new
segmenter, so we also need to clear it whenever we invalidate the text.
2024-10-09 23:07:13 +02:00
Timothy Flynn
4fcaeabe1a LibWeb+UI: Detect and handle left vs. right modifier keys
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (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
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
Our handling of left vs. right modifiers keys (shift, ctrl, etc.) was
largely not to spec. This patch adds explicit UIEvents::KeyCode values
for these keys, and updates the UI to match native key events to these
keys (as best as we are able).
2024-10-09 19:10:02 +02:00
Timothy Flynn
448754d95d LibWeb: Only fire keypress events if the key press produced a character
For example, pressing just the shift key should not producde a keypress
event.
2024-10-09 19:10:02 +02:00
Timothy Flynn
3925317c11 LibWeb: Fire keydown and keypress events sooner
Fire the events before handling any close requests or selection changes.
Pages must have an opportunity to cancel the events.
2024-10-09 19:10:02 +02:00
Jelle Raaijmakers
a58f39c9e2 LibWeb: Implement selectionchange event according to spec 2024-10-09 19:08:47 +02:00
Totto16
aab5a9e944 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
2024-10-09 17:46:27 +01:00
Aliaksandr Kalenik
a8788e5abb LibWeb: Don't ignore non-positioned stacking contexts on step 8 of paint
...traversal. We've already fixed step 3 and 9 to not filter out
non-positioned stacking contexts, because modern CSS has more ways to
create stacking context besides being positioned with z-index (like by
using "transform", "filter" or "clip-path" properties).

See following spec issue for more details https://github.com/w3c/csswg-drafts/issues/2717

Visual improvement on https://basecamp.com/
2024-10-09 18:42:20 +02:00
Aliaksandr Kalenik
83b6bc4ccb LibWeb: Don't allow SVG boxes to create a stacking context
Prior to this change, SVGs were following the CSS painting order, which
means SVG boxes could have established stacking context and be sorted by
z-index. There is a section in the spec that defines what kind of SVG
boxes should create a stacking context
https://www.w3.org/TR/SVG2/render.html#EstablishingStackingContex
Although this spec is marked as a draft and rendering order described in
this spec does not match what other engines do.

This spec issue comment has a good summary of what other engines
actually do regarding painting order
https://github.com/w3c/svgwg/issues/264#issuecomment-246432360
"as long as you're relying solely on the default z-index (which SVG1
does, by definition), nothing ever changes order when you apply
opacity/filter/etc".

This change aligns our implementation with other engines by forbidding
SVGs to create a formatting context and painting them in order they are
defined in tree tree.
2024-10-09 18:42:20 +02:00
Sam Atkins
b645e26e9b LibWeb/CSS: Bring TokenStream in line with spec
When the TokenStream code was originally written, there was no such
concept in the CSS Syntax spec. But since then, it's been officially
added, (https://drafts.csswg.org/css-syntax/#css-token-stream) and the
parsing algorithms are described in terms of it. This patch brings our
implementation in line with the spec. A few deprecated TokenStream
methods are left around until their users are also updated to match the
newer spec.

There are a few differences:

- They name things differently. The main confusing one is we had
  `next_token()` which consumed a token and returned it, but the spec
  has a `next_token()` which peeks the next token. The spec names are
  honestly better than what I'd come up with. (`discard_a_token()` is a
  nice addition too!)

- We used to store the index of the token that was just consumed, and
  they instead store the index of the token that will be consumed next.
  This is a perfect breeding ground for off-by-one errors, so I've
  finally added a test suite for TokenStream itself.

- We use a transaction system for rewinding, and the spec uses a stack
  of "marks", which can be manually rewound to. These should be able to
  coexist as long as we stick with marks in the parser spec algorithms,
  and stick with transactions elsewhere.
2024-10-09 17:29:29 +01:00
Andreas Kling
5df6c6eecf LibWeb: Don't crash when encountering calc() inside a CSS rect() value
This allows us to run the WPT tests under quirks/unitless-length/
without crashing, giving us over 4600 new passing subtests. :^)
2024-10-09 14:14:08 +01:00
Andreas Kling
5e240f997c LibWeb: Don't crash when encountering border-spacing: calc(...)
This allows us to progress further on this WPT test:
https://wpt.live/quirks/unitless-length/quirks.html

...although it still crashes before finishing.
2024-10-09 14:14:08 +01:00
Timothy Flynn
10853898fc headless-browser: Restore ability to rebaseline new tests
This regressed in commit 6eca60504e.

If we are rebaslining tests, do not fail if we are unable to open the
expectation file for reading.
2024-10-09 07:26:44 -04:00
Timothy Flynn
d80d951991 LibWeb: Restore check to prevent closing a traversable twice
We removed this check as a workaround for a spec issue that was resolved
in:

https://github.com/whatwg/html/commit/3a8303ece44ed509928be626a6a65639fd
2024-10-09 06:59:33 -04:00
Ali Mohammad Pur
cc1f0c3af2 LibRegex: Restore checkpoints when restoring the state post-fork
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
Fixes the lockup/OOM in #968.
2024-10-09 11:20:58 +02:00
Timothy Flynn
6eca60504e headless-browser: Only rebaseline tests that would have failed
We have a bit of forgiveness around allowing tests to pass with varying
trailing newlines. Only write a rebaselined test to disk if it would not
have passed under those conditions.
2024-10-09 01:45:57 +02:00
Neil Viloria
b9e7c6a2f6 LibWeb/Layout: Implement align-content for grid layout 2024-10-08 21:30:03 +02:00
Arhcout
5d00211a86 LibWeb: Don't trigger onchange event when setting <select> value
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-08 19:03:51 +02:00
Jelle Raaijmakers
69f11fc1c6 LibWeb: Implement navigator.deviceMemory
Fixes at least 2 subtests in wpt/device-memory.
2024-10-08 19:02:27 +02:00
Jelle Raaijmakers
6189d1ac9d LibWeb: Add WebIDL::Double type 2024-10-08 19:02:27 +02:00
Jelle Raaijmakers
9515290fde LibCore: Add System::physical_memory_bytes() 2024-10-08 19:02:27 +02:00
Andreas Kling
274411db97 LibWeb: Support Document.onvisibilitychange
We don't have a way to trigger this from a test, but the fix is so
simple that we might as well get it in. :^)
2024-10-08 18:49:11 +02:00
Andreas Kling
26be8f865a LibWeb: Support Document.onreadystatechange
This is just a standard IDL event attribute handler.

Fixes at least one WPT test:
https://wpt.live/html/dom/documents/resource-metadata-management/document-readyState.html
2024-10-08 18:49:11 +02:00
Jelle Raaijmakers
cb21201550 LibWeb: Implement AudioNode.channelCount 2024-10-08 14:33:42 +02:00
Jelle Raaijmakers
7b4f0d13ee LibWeb: Implement AudioNode.numberOfInputs and .numberOfOutputs 2024-10-08 14:33:42 +02:00
Jelle Raaijmakers
d7a3bad2b4 LibWeb: Forward declare AudioDestinationNode to break header loop 2024-10-08 14:33:42 +02:00
Andreas Kling
94721385ce 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.
2024-10-08 14:33:35 +02:00
Jamie Mansfield
f610a12671 LibWeb/UIEvents: Implement TextEvent 2024-10-08 11:45:39 +02:00
Jamie Mansfield
86e20ea246 LibWeb/UIEvents: Implement CompositionEvent 2024-10-08 11:45:39 +02:00
Jamie Mansfield
9fce70069d LibWeb/UIEvents: Implement InputEvent 2024-10-08 11:45:39 +02:00
Jamie Mansfield
60d9c3929c LibWeb: Correct forward for UIEvents::UIEvent 2024-10-08 11:45:39 +02:00
Andreas Kling
13ba491924 LibWeb: Don't let input element placeholders influence line-height
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
Before this change, we transferred the input element's line-height to
both the editable text *and* the placeholder. This caused some strange
doubling of the effective line-height when the editable text was empty,
pushing down the placeholder.
2024-10-08 08:12:07 +02:00
Tim Ledbetter
e1eeb93cc6 LibWeb: Fire iframe load event on document close
This matches the behavior of other browsers.
2024-10-08 06:55:01 +02:00
Timothy Flynn
00487a7b25 LibWebView+LibWeb: Remove ResourceLoader and WebSocket adapters
These were used to provide a layer of abstraction between ResourceLoader
and the networking backend. Now that we only have RequestServer, we can
remove these adapters to make the code a bit easier to follow.
2024-10-08 06:52:51 +02:00
Timothy Flynn
3de86cf0fa LibRequests: Add a forwarding header 2024-10-08 06:52:51 +02:00
Timothy Flynn
1b324f3ae1 LibWebView+UI: Remove Qt networking infrastructure
Now that we use libcurl, there's no reason to keep Qt networking around.
Further, it doesn't support all features we need anyways, such as non-
buffered request handling for SSE.
2024-10-08 06:52:51 +02:00
Tim Ledbetter
fd8d350b47 LibWeb: Don't discard PostedMessage tasks when closing a worker
The spec expects `postMessage()` to act as if it is invoked
immediately. Since `postMessage()` isn't actually invoked immediately,
keep tasks with source `PostedMessage` in the task queue, so that these
tasks are processed. Fixes a hang when `WorkerGlobalScope.close()` is
called immediately after `postMessage()`.
2024-10-08 06:51:04 +02:00
Noah Bright
d30ae92b82 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 :/
2024-10-08 03:44:55 +02:00