Commit graph

35681 commits

Author SHA1 Message Date
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
John Diamond
18ade57ae9 LibWeb: Use correct boundary point comparison in Selection.extend
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 Selection.extend() used only the relative node order to decide which
direction to extend the selection. This leads to incorrect behaviour if
both the existing and new boundary points are within the same DOM node
and the selection direction is reversed.

This change fixes all the failing subtests in the WPT extend-* test
suites.
2024-10-13 15:11:49 +02:00
Shannon Booth
ee35e93eb2 LibJS: Early return from Date string parsing on empty string
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
Loading Ladybird on Github results in 37 debug logs about being unable
to parse an empty Date string. This log is intended to catch Date
formats we do not support to detect web compatability problems, which
makes this case not particuarly useful to log.

Instead of trying to parse all of the different date formats and
logging that the string is not valid, let's just return NAN immediately.
2024-10-13 10:12:56 +02:00
Gingeh
f41cbfa2a9 LibWeb: Set both start and end in Selection::extend 2024-10-13 09:47:07 +02:00
Gingeh
93927d8243 LibWeb: Set direction to forwards in addRange 2024-10-13 09:47:07 +02:00
Gingeh
a7953f5e09 LibWeb: Implement Selection::direction 2024-10-13 09:47:07 +02:00
Sebastian-Webster
eec2602424 LibWebView: Add Startpage search engine 2024-10-13 08:36:49 +01:00
sin-ack
f1cab5de7a LibWeb: Compare navigable active_url with fragments included
This was previously negated due to a misread of
https://url.spec.whatwg.org/#concept-url-equals. This change fixes a
bunch of WPT crashes such as
"/html/browsers/history/the-history-interface/001".
2024-10-13 06:47:43 +02:00
Glenn Skrzypczak
3804c4dea1 LibWeb: Don't crash when encountering a resolution in a calculation
calc() seems to support resolutions by now.

The change allows us to pass this WPT test:
http://wpt.live/css/css-values/round-mod-rem-invalid.html
2024-10-12 22:23:03 -06:00
Glenn Skrzypczak
7ed08a401f LibWeb: Support the 'x' resolution unit identifier
The 'x' unit is the same as 'dppx', but was previously not considered
when parsing resolutions.
2024-10-12 22:23:03 -06:00
Ali Mohammad Pur
24c2ad059b 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.
2024-10-13 00:24:44 +02:00
Ali Mohammad Pur
fd5ee06bbf LibXML: Avoid allocating ByteStrings for AcceptedRule
These come from string literals and compiletime-known values, no need to
allocate a ByteString.
2024-10-12 23:00:09 +02:00
Ali Mohammad Pur
4d3f764d95 LibXML: Resolve the entity reference definition in DTDs
Fixes the rendering of `<` in XHTML docs.
2024-10-12 23:00:09 +02:00
Ali Mohammad Pur
5c23ef1596 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
2024-10-12 23:00:09 +02:00
Andreas Kling
175f3febb8 LibWeb: Make DOMException take error message as a String
There was no need to use FlyString for error messages, and it just
caused a bunch of churn since these strings typically only existed
during the lifetime of the error.
2024-10-12 21:14:18 +02:00
ronak69
5f9a36feac LibWeb: Frameset should be the body element if it comes before body
Fixes one WPT test: "Frameset followed by body inside the html element"
http://wpt.live/html/dom/documents/dom-tree-accessors/Document.body.html
2024-10-12 11:52:53 -06:00
sin-ack
711faa8280 LibWeb: Remove redundant DedicatedWorkerGlobalScope prototype setting
Now that the global object correctly sets the property, we don't need
to do it here.
2024-10-12 19:21:59 +02:00
0x4261756D
6923008a55 JPEGLoader: Fix infinite loop on incomplete data
If the image data to decode is incomplete, e.g. a corrupt image missing
its last scanlines the decoder would previously keep looping for ever.
By breaking out of the loop if no more scanlines were produced we can at
least display the partial image up to that point.
2024-10-12 19:21:03 +02:00
Andreas Kling
02da288413 LibWeb: Allow CSS @import rule to import non-UTF-8 style sheets
This fixes a number of WPT crashes in the /css/CSS2/syntax directory.
2024-10-12 19:20:22 +02:00
0x4261756D
c1a14f66ad HTMLEncodingDetection: Use mime type in encoding sniffing
Also added proper spec comments.
Fixes at least one WPT test that was failing previously:
https://wpt.live/encoding/single-byte-decoder.window.html?document
2024-10-12 16:14:38 +02:00
Timothy Flynn
dae6200c1d LibWeb: Update (not replace) timeout values in WebDriver's Set Timeouts
Contradictory to the spec, the Set Timeouts endpoint should update the
existing timeouts configuration in-place, rather than replacing it. WPT
expects this, and other browsers already implement this endpoint this
way.
2024-10-12 15:02:41 +02:00
Timothy Flynn
8396afeb76 LibWeb: Update WebDriver timeout parsing/serializing to the latest spec
Namely, all fields in the timeouts object may now be null. There are a
few calling AOs that we will want to bring up to date as well.
2024-10-12 15:02:41 +02:00
Timothy Flynn
8598ed86fe LibWeb+WebContent: Implement the Element Clear endpoint 2024-10-12 15:01:35 +02:00
Timothy Flynn
516f5f7008 LibWeb: Implement the form associated element clear algorithm
This is a method defined in the WebDriver spec, but requires access to a
bunch of private fields in these classes, so this is implemented in the
same manner as the reset algorithm.
2024-10-12 15:01:35 +02:00
John Diamond
fadb14d31d LibWeb: Compare anchor/focus offsets in selection.isCollapsed
The "isCollapsed" attribute on a selection must "return true if and only
if the anchor and focus are the same".

In addition to checking that the anchor and focus belonged to the same
DOM node, we now also check that they refer to the same position within
the node.

With this change Ladybird passes all the subtests in the "isCollapsed"
WPT suite.

https://wpt.live/selection/isCollapsed.html
2024-10-12 15:00:35 +02:00
sin-ack
27b1d94e04 LibWeb: Obtain basename before passing base_url to ClassicScript::create
This would previously crash because it depended on a specific order for
evaluating function arguments, which is undefined.
2024-10-12 15:00:09 +02:00
Aliaksandr Kalenik
6452bfb612 LibWeb: Store scroll and sticky frames state in single vector
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 way we don't have to allocate separate vector with both scroll and
sticky frame that is used for display list player (scroll and sticky
frames share id pool), so player could access offset by frame id.

No behavior change.
2024-10-12 13:13:14 +02:00
Aliaksandr Kalenik
d07643b122 LibWeb: Introduce a new class responsible for scroll state
It's good to have a wrapper for scroll and sticky state instead of
directly mutating vectors with frames.

No behavior change.
2024-10-12 13:13:14 +02:00
Aliaksandr Kalenik
34261e5490 LibWeb: Don't produce save & restore commands for scroll frame id change
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 allows to substantially decrease display list length and
save/restore churn during painting.

Display list size comparison:

|               | Before | After  |
| ------------- | ------ | ------ |
| basecamp.com  | 19066  | 12248  |
| ladybird.org  | 8878   | 2220   |
| react.dev     | 39074  | 24382  |
2024-10-11 17:26:54 +02:00
Aliaksandr Kalenik
4eec621d3a LibWeb: Remove translation from display list recorded state
...and add display list item that does translation instead. By doing
that we no longer need to map each coordinate in display list by
translation in recorder state.
2024-10-11 17:26:54 +02:00
Aliaksandr Kalenik
1892cac80b LibWeb: Remove unused clip_rect from display list recorder state 2024-10-11 17:26:54 +02:00
Aliaksandr Kalenik
35d0d11e65 LibWeb: Remove post_transform_translation for stacking context
There is no explanation why it's needed and removing it does not break
any of our tests.
2024-10-11 17:26:54 +02:00
rmg-x
10acf3f6c7 RequestServer: Set CURLOPT_CONNECTTIMEOUT instead of CURLOPT_TIMEOUT
Set the connection timeout which only limits the connection phase of the
request.

Previously, CURLOPT_TIMEOUT would apply to all transfer operations which
could result in legitimate upload or download operations being
cancelled.
2024-10-11 13:18:05 +02:00
Bastian Neumann
9650cf8b15 LibJS: Do not print large arrays
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
Printing the whole array causes wpt
console/console-log-large-array.any.html to crash.
This limits logged arrays to 100 elements and
truncates the rest with ...
2024-10-11 09:59:39 +01:00
Timothy Flynn
79365c9519 UI: Migrate headless-browser to be alongside other Ladybird chromes
The headless-browser source is getting a bit unwieldy. The ordering of
class and method definitions is fragile; e.g. the application and web
view classes each require full definitions of each other. So it has
reached the point where it makes sense to give headless-browser some
better file structure.

To prepare for that, this patch simply moves its source to live along-
side the other browser chromes. This location is a bit better prepared
for creating more files, as the Utilities folder doesn't even have its
own CMakeLists.txt.
2024-10-11 09:09:40 +02:00
Timothy Flynn
23d134708c LibWeb: Begin implementing the Element Send Keys endpoint 2024-10-11 09:09:23 +02:00
Timothy Flynn
922837f31b WebDriver: Generalize asynchronous event handling
Instead of having N functions all implement the same practice of looping
until an async event has arrived, this templatizes the bulk of the work.
2024-10-11 09:09:23 +02:00
Timothy Flynn
63b24e38fa LibWeb: Support appending files to <input type=file>
This isn't exposed to the Web, but WebDriver requires this feature.
2024-10-11 09:09:23 +02:00
Aliaksandr Kalenik
0dec2dc21c LibWeb: Improve grid area calculation for abspos items in GFC
- Add support for placement of abspos items into track formed by last
  line and padding edge of grid container
- Correctly handle auto-positioned abspos items by placing them between
  padding edges of grid container

Fixes crashing on https://wpt.live/css/css-grid/abspos/positioned-grid-descendants-001.html
2024-10-11 09:08:46 +02:00
Aliaksandr Kalenik
32c467cc0e LibWeb: Introduce axis-agnostic alignment type in GFC
Allows to reuse code for both dimensions instead of duplicating the
entire switch-case.
2024-10-11 09:08:46 +02:00
rmg-x
9dd7b901ab LibWeb/ResourceLoader: Display HTTP reason phrase in error status 2024-10-11 07:43:23 +01:00
Fernando Kiotheka
caf74e7ed6 LibWeb: Implement activation behavior on input[type=reset]
This fixes WPT html/semantics/forms/resetting-a-form/reset-form.html.
I added a test based on the WPT test, but simpler.
2024-10-11 07:40:49 +01:00
pheonixfirewingz
9456359f32 LibMedia: Disable ffmpeg on windows
Also don't try to find_package the library on Android while we're here.
2024-10-10 21:48:41 -06:00
Noah Bright
f23cc02603 LibWeb: Remove constexpr from service worker ==
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
Appeasing clang. The binary == wasn't constexpr and that
crashed compilation
2024-10-10 19:08:44 -06:00
Nico Weber
cc0cfd044b LibWeb: Add stroke-linecap attribute and plumb it to SVGGraphicsElement
SVGGraphicsElement then goes ahead and does nothing with it for now.
2024-10-11 00:27:47 +01:00
Ali Mohammad Pur
202bfabdc6 LibXML: Shift some rule acceptances to make errors nicer
Instead of saying "expected />", make the parser output the real cause
for the following ("unknown reference"):
    <foo>&unknown;</foo>
2024-10-10 23:53:48 +01:00
Ali Mohammad Pur
70e769a18a LibXML: Avoid ByteString::formatted() on static "expected" errors
This is a fairly significant (~8%) speedup when parsing references.
2024-10-10 23:53:48 +01:00
Ali Mohammad Pur
02b50d463b AK: Cache all the line positions in LineTrackingLexer
Also updates a LibWeb text test that used to report the wrong line
number.
2024-10-10 23:53:48 +01:00
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
Tim Ledbetter
d0008ae5e0 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.
2024-10-07 21:22:12 +02:00
Timothy Flynn
598fabbdd3 LibWebView: Increase the open file limit in a more central location
We don't create a ChromeProcess in headless-browser, so it is currently
not increasing it's open file limit. This is causing crashes on macOS,
which has a very low default limit.
2024-10-07 14:03:03 -04:00
Aliaksandr Kalenik
97066f09f4 LibWeb: Use PaintableBox::is_scrollable() while dispatching wheel event
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
With this change we use the same function to determine whether to render
scroll thumb and whether box wants to accept scroll UI events.
2024-10-07 18:35:24 +02:00
Aliaksandr Kalenik
a46c2a0887 LibWeb: Forbid scrolling of viewport if overflow=hidden
Before this change viewport was allowed to be scrolled whenever it has a
scrollable overflow, which is not correct when overflow is specified to
be hidden.
2024-10-07 18:35:24 +02:00
Khaled Lakehal
77761e123d LibWeb/CSS: Add support for unicode-bidi property 2024-10-07 14:57:15 +01:00
Gingeh
16f2f6aa42 LibWeb: Make empty media query lists evaluate to true 2024-10-07 14:50:57 +01:00
Shannon Booth
30377e6e35 LibWeb: Do not spin the event loop on processing iframe attributes
Partially reverting a3149c1ce9

Spinning the event loop was causing a crash on:

https://wpt.live/url/percent-encoding.window.html

As it was turning what is meant to be a synchronous operation into an
asynchronous one.

The sequence demonstrated by the reproducing test is as follows:
  * A src attribute is changed for the iframe
  * process_the_iframe_attributes entered with valid content navigable
  * Event loop is spun, allowing the queued iframe removal to execute
  * process_the_iframe_attributes continues with null content navigable
  * 💥
2024-10-07 15:10:41 +02:00
Timothy Flynn
62e732e5ad Revert "WebContent+WebDriver: Inform WebDriver when a window is closed"
This reverts commit 556a0936dd.

This was causing a large slow down in WPT, and a crash on macOS during
session shutdown when running WebDriver manually.
2024-10-07 07:40:22 -04:00
Carwyn Nelson
30f59cfe1a LibWeb: Skip transitions for pseudo elements
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
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.
2024-10-07 09:31:40 +02:00
Andreas Kling
2fdf2b9215 LibWeb: Allow SVG root elements to have visible overflow
We were overly aggressive in clipping SVG roots, which effectively made
them behave as if they always had `overflow: hidden`.

This fixes incorrect clipping of the logo on https://basecamp.com/
2024-10-07 09:31:25 +02:00
Shannon Booth
f2134dc1e9 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.
2024-10-06 22:54:27 -06:00
Timothy Flynn
dfabdb7fed headless-browser: Support running LibWeb tests concurrently
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 currently create a single WebView and run all 1400+ LibWeb tests in
serial over that WebView. Instead, let's create as many WebViews as
there are processes on the system, and run LibWeb tests concurrently
over those views.

To do this performantly requires that we never block the main thread of
the headless-browser process once the tests are running. Doing so will
effectively pause execution of all other tests. So test execution is now
Promise-based.

On my machine (with a hardware concurrency of 32), this reduces the run
time of LibWeb tests from 31.382s to 3.640s. CPU utilization increases
from 5% to 67%.
2024-10-06 19:24:25 +02:00
Timothy Flynn
49a53a6194 headless-browser: Move completion handlers for dump/ref tests to lambdas
No functional difference here, and this probably seems a bit silly, but
the purpose is to make the diff of a future patch much easier to read.
2024-10-06 19:24:25 +02:00
Timothy Flynn
08426efebc headless-browser: Define the test-related structures earlier
And re-order the Test fields to have the test mode first.

No functional change - this is just to reduce diff noise a bit in an
upcoming patch.
2024-10-06 19:24:25 +02:00
Timothy Flynn
e6975ec76a headless-browser: Make taking screenshots during tests more asynchronous
This will be necessary to run tests concurrently, otherwise taking a
screenshot for one test will block all tests from executing.
2024-10-06 19:24:25 +02:00
Timothy Flynn
642a611418 headless-browser: Do not track the current test path
Instead, just log the view's current URL when the WebView crashes. It
won't make any sense to track the executing test this way once there are
many tests running concurrently.
2024-10-06 19:24:25 +02:00
Timothy Flynn
adfe120d1e headless-browser: Migrate service management to the browser Application
We currently run all tests in a single WebView instance. That instance
owns the process-wide RequestClient / ImageDecoderClient, so if we were
to create a second instance, we'd run into trouble.

This migrates ownership of these services to the Application class, and
makes the Application own the WebView. In the future, this will let the
Application own a list of views.
2024-10-06 19:24:25 +02:00
Timothy Flynn
377d1f22ae headless-browser: Make the browser Application more accessible
We currently pass around the individual fields of the Application class
to a bunch of free functions. This makes adding a new field, and passing
it all the way to e.g. run_dump_test pretty annoying, as we have to go
through about 5 function calls.

This will get much worse in an upcoming patch to run LibWeb tests
concurrently. There, we will have to further pass these flags around as
async lambda value captures.

To make this nicer, just access the flags from Application::the(), which
is how the "real" UIs access their application objects as well.
2024-10-06 19:24:25 +02:00
Aliaksandr Kalenik
d0463bf652 LibWeb: Simplify static position calculation for block-level boxes
There is no need to save vertical offset in UsedValues to use later,
when static position could be assigned directly upon encountering
abspos box.
2024-10-06 18:51:16 +02:00
Aliaksandr Kalenik
7225087fa2 LibWeb: Replaced remaining usage and delete Size::resolved() 2024-10-06 18:51:03 +02:00
Timothy Flynn
76152845fd LibWeb: Remove debug spam from Navigator methods
These are logged ~1000 times on fast.com.
2024-10-06 18:50:44 +02:00
Aliaksandr Kalenik
908455ab06 LibWeb: Skip queuing a rendering task if task queue already contains it
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
If, by the time we need to schedule rendering of the next frame, the
previous one is still not processed, we could skip it instead of growing
task queue.

Should help with https://github.com/LadybirdBrowser/ladybird/issues/1647
2024-10-06 16:25:33 +02:00
Shannon Booth
ea971792b5 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
2024-10-06 10:06:26 -04:00
Andreas Kling
59ed823724 LibWeb: Resolve flex item % main size to 0 during min-content sizing
When the flex container is sized under a min-content constraint in the
main axis, any flex items with a percentage main size should collapse
to zero width, not take up their own intrinsic min-content size.

This is not in the spec, but matches how other browsers behave.

Fixes an issue where the cartoons on https://basecamp.com/ were way
too large. :^)
2024-10-06 16:04:00 +02:00
Aliaksandr Kalenik
1a78edb8c9 LibWeb: Define static position calculation separately for each FC
Static position of a box is defined by formatting context type it
belongs to, so let's define this algorithm separately for each FC
instead of assuming FormattingContext::calculate_static_position_rect()
understands how to handle all of them.

Also with this change calculate_static_position_rect() is no longer
virtual function.
2024-10-06 15:45:08 +02:00
Timothy Flynn
5056bda043 LibCore: Ensure shared memory file names on macOS are unique
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
At least on my mac, clock_gettime only provides millisecond resolution.
So if many WebContent processes are opened at once, it is not unlikely
that they will all create their backing stores within the same ms. When
that happens, all but the first will fail (and crash).

To prevent this, generate the shared memory file name based on the PID
and a static counter.
2024-10-06 07:44:06 +02:00
Timothy Flynn
aa1df95b31 LibWeb: Implement window.close and window.closed 2024-10-06 01:42:24 +01:00
Timothy Flynn
ae130822a0 headless-browser: Allow popups for LibWeb testing 2024-10-06 01:42:24 +01:00
Timothy Flynn
ce11a90726 WebContent+WebDriver: Handle when new windows are immediately closed
This happens when window.close() is invoked immediately upon a window
being opened.
2024-10-06 01:42:24 +01:00
Timothy Flynn
556a0936dd WebContent+WebDriver: Inform WebDriver when a window is closed from JS
This hooks into the same PageClient method that closes the UI tab after
an invocation to window.close().
2024-10-06 01:42:24 +01:00
Timothy Flynn
84df1bf585 LibWeb: Mark a BC's navigable as destroyed if it does not exist 2024-10-06 01:42:24 +01:00
Timothy Flynn
5aa50bff8b LibWeb+WebDriver+WebContent: Implement the Element Click endpoint 2024-10-06 01:42:24 +01:00
Timothy Flynn
95bf6c9877 WebContent: Do not wait for navigations on BCs that have no navigable
This avoids a crash seen in WPT when a click event is fired on a BC that
has been removed from the document.
2024-10-06 01:42:24 +01:00
Timothy Flynn
ab3cfd9bbb WebContent: Separately store the WebDriver parent and top-level BCs
We are currently trying to access the current parent and top-level
browsing contexts from the current BC itself. However, if the current BC
is closed, its association to the parent and top-level BCs is lost, and
we are no longer able to handle WebDriver endpoints involving those BCs.

Instead, let's store the parent and top-level BCs separately, and update
them in accordance with the spec.
2024-10-06 01:42:24 +01:00
Timothy Flynn
969361abdb WebDriver: Allow deleting sessions with an invalid window handle
This case was missed in commit b5aa8f65b1.
2024-10-06 01:42:24 +01:00
Andreas Kling
077bc68a4c LibWeb: Allow intrinsic width layout to see definite heights
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 were already allowing intrinsic height layout to see definite widths,
and I can't think of a reason *not* to allow it the other way around.

More importantly, this fixes an issue where things with an aspect ratio
didn't have a height to resolve against before.

Makes the logo show up on https://basecamp.com/ :^)
2024-10-05 19:24:20 +02:00
Neil Viloria
4bda65c8b3 LibWeb/Layout: Implement justify-content for column spacing in grid 2024-10-05 19:21:49 +02:00
Andreas Kling
aae191aa33 LibWeb: Bail from various navigable operations when no active window
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
If we end up in a situation where the navigable no longer has an active
window, we can't perform navigation or many other navigable operations.

These are all ad-hoc, since the navigables spec is basically all written
as if there's always an active window. Unfortunately, the active window
comes from the active document's browsing context, which is a nullable
concept even in the spec, so we do need to deal with null here.

This removes all the locally reproducible crashes when running WPT over
the legacy Japanese encoding directory on my computer.

Yes, this is a bit of a monkey patch, but it should be harmless since
we're (as I understand it) dealing with navigables that are still
hanging around with related tasks queued on them. Once all these tasks
have been completed, the navigables will go away anyway.
2024-10-05 16:24:10 +02:00
Shannon Booth
088b659abd LibURL: Do not treat port of 0 as a null port in Origin
It is not treated as the same thing in the specification, or by us in
other places too. This fixes 8 more origin related URL tests on WPT.
2024-10-05 10:46:30 +02:00
Shannon Booth
501f92b54e LibWeb+LibURL: Consolidate Origin parsing and serialization into LibURL
Because of the previous awkward factoring of Origin we had two
implementations of Origin serializing and creation. Move the
implementation of DOMURL::url_origin into URL::origin, and
instead use the implemenation of URL::Origin::serialize for
serialization (replacing URL::serialize_origin).

This happens to fix 8 URL subtests as the two implemenations had
diverged, and URL::serialize_origin was previously missing the spec
changes of: whatwg/url@eee49fd and whatwg/url@fff33c3
2024-10-05 10:46:30 +02:00
Shannon Booth
12ea470417 LibWeb+LibURL: Get blob's environments origin from URL's blob entry
This closer matches specification - and removes any dependency on
LibWeb in the implementation of DOMURL::url_origin.

It is also one step closer to moving BlobURLRegistry to a singleton
process to match LibWeb's multiprocess Worker architecture.
2024-10-05 10:46:30 +02:00
Shannon Booth
43973f2d0a LibURL: Define Origin methods depending on URL::Parser out of line
This is also in an effort towards resolving a future circular dependency
between Origin.h and URL.h
2024-10-05 10:46:30 +02:00
Shannon Booth
53ad982bb7 LibURL: Factor Host into a standalone header file
This will help solve a future circular dependency between URL.h
and Origin.h
2024-10-05 10:46:30 +02:00
Shannon Booth
dc401f49ea LibWeb+LibURL: Move HTML::Origin to URL::Origin
While Origin is defined in the HTML spec - this leaves us with quite an
awkward relationship as the URL spec makes use of AO's from what is
defined in the HTML spec.

To simplify this factoring, relocate Origin into LibURL.
2024-10-05 10:46:30 +02:00
Totto16
abe1172d70 LibWeb: Make HTMLVideoElement part of CanvasImageSource union
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-05 09:20:58 +02:00
rmg-x
d8c36ed458 LibCore: Remove unused classes and headers 2024-10-05 09:18:54 +02:00
Tim Ledbetter
1fa948f114 LibWeb: Implement the "check if unloading is canceled" AO
This method is responsible for firing `beforeunload` events.
2024-10-05 09:17:34 +02:00
Tim Ledbetter
f807b2800e LibWeb: Ensure special error event handling applies to workers 2024-10-05 09:17:34 +02:00
Tim Ledbetter
99ef078c97 LibWeb: Implement BeforeUnloadEvent
This is required to support legacy behavior of the `returnValue`
attribute.
2024-10-05 09:17:34 +02:00