Commit graph

63890 commits

Author SHA1 Message Date
Tim Ledbetter
27f724b435 WebWorker: Allow the WebWorker process to optionally use Qt networking
This change adds a `--use-lagom-networking` flag to the WebWorker
process. Qt networking is used if this flag isn't passed. The flag is
passed the UI launches the WebWorker process unless the Qt chrome is
being run with the `--enable-qt-networking` flag.

(cherry picked from commit 886714632759c1e2feeb636388975f0e3b515839;
amended Qt/main.cpp to resolve minor conflict due to serenity not having
LadybirdBrowser/ladybird#284 LadybirdBrowser/ladybird#45, and
WebWorker/CMakeLists.txt due to serenity still having
`SERENITY_SOURCE_DIR` instead of `LADYBIRD_SOURCE_DIR` --
LadybirdBrowser/ladybird#17)
2024-11-15 19:07:17 -05:00
Tim Ledbetter
2a35f9a834 Tests/WPT: Enable Qt neworking when running WPT tests
(cherry picked from commit 21eefb788bcee36afce24e02ec4ef90e27510fbb;
amended to resolve a minor conflict)
2024-11-15 19:07:17 -05:00
Tim Ledbetter
42712fd165 WebDriver: Add option to use Qt networking
Using Qt networking when running web platform tests improves
performance significantly. The time to run the subset of tests we run
on CI drops from 21.9 seconds to 8.2 seconds on my machine.

(cherry picked from commit ff2123a949446b834e6c3b0be7ca4c994d71f3e1)
2024-11-15 19:07:17 -05:00
Ilya Mateyko
6b06454d5d DevContainer: Add a SSH server into a container
Fixes this error when trying to run `gh codespaces ssh`:

error getting ssh server details: failed to start SSH server:
Please check if an SSH server is installed in the container.
2024-11-15 13:20:10 -05:00
Andreas Kling
3c2e4999f4 LibWeb: Let determine_the_origin() take an optional URL after all
I originally believed that this could never receive a null URL and the
spec was inaccurate, but it seems like it can indeed.

I don't have a distilled test, but this makes logging in with GitHub
work on https://v0.dev/

(cherry picked from commit 1a4b0ded1f802fdcc3ef9b919b5749b086471fc2;
amended to also cherry-pick LadybirdBrowser/ladybird#2358)
2024-11-15 10:19:53 -05:00
Andrew Kaster
f97e5a7088 LibCore: Only include BeepInstruction in System.cpp on Serenity
(cherry picked from commit f98e28912a9c700e78f6e57eb497fd3eb3134661;
amended to not delete BeepInstruction.h, and to not insert a stray
newline after lstat)
2024-11-15 08:56:56 -05:00
Andrew Kaster
05fffee336 CMake: Move ca_certificate_download include up with other downloads
(cherry picked from commit 82b73b2eee8448e07925909720191bb3bbdac670)
2024-11-15 08:56:56 -05:00
Asutosh Variar
50cc1b5d63 Everywhere: Convert from_string_view -> from_string_literal where static
(cherry picked from commit 229b64a4b723a391c21f247d72d78cd575ace6ff;
minorly amended to fix conflict in image.cpp due to serenity in the
meantime adding webp writing support, and due to changes in Android and
Vulkan-related files that serenity doesn't have)
2024-11-15 08:56:39 -05:00
Sam Atkins
f63a15665d LibWeb: Calculate hidden password text using code-point count
This means that an `<input type=password>` will show the correct number
of *s in it when non-ASCII characters are entered.

We also don't need to perform text-transform on these as that doesn't
affect the output length, so I've moved it earlier.

(cherry picked from commit c747b1c6b56156b5797fad0d8d95164f415c8b25;
amended to slightly adjust some BlockContainer and PaintableWithLines
widths, since serenity does not use harfbuzz for text shaping)
2024-11-14 23:38:34 -05:00
Sam Atkins
59b862d978 WebContent: Dump style sheets that are inside shadow roots
Also include a header to say what shadow root each style sheet is in, so
we can distinguish between them.

(cherry picked from commit 1849eca50326c236e46e7fc619f928aa84cd760d)
2024-11-14 23:38:34 -05:00
Pavel Shliak
f445caa585 Tests: Remove duplicated test for FloatingPointParsing
(cherry picked from commit 672590c360e80a20d72f1b4f7f9918c53c5a89f3)
2024-11-14 23:38:34 -05:00
Pavel Shliak
cb7d2b706f Tests: Remove duplicated test for UnicodeCharacterTypes
(cherry picked from commit 5fe1d389553319e4d6554343141e5e4162f6776b)
2024-11-14 23:38:34 -05:00
Pavel Shliak
d990144180 Tests: Remove duplicated test for StringView
(cherry picked from commit cf5521ec68af3982bdabc9a80188dd0111798649)
2024-11-14 23:38:34 -05:00
Timothy Flynn
a8b34254cb LibWeb: Defer handling of WebDriver endpoint invocations
We can currently crash on WebDriver session shutdown when we receive a
Delete Session command. This destroys the WebDriver client while we are
inside the client's socket's on_ready_to_read callback. This is not
allowed by AK::Function.

To avoid this, we now only read data from the socket in the callback. We
then defer handling the message to break out of the callback.

(cherry picked from commit 47af8c673381b1ffe15c85f711463a3fbeac165e)
2024-11-14 23:38:34 -05:00
Timothy Flynn
5eaa3cc71f LibHTTP: Make HttpRequest default-movable
Otherwise, clangd correctly warns that this type is only copyable.

(cherry picked from commit db1bcb2c5600c98a33f48fdb68e16ac68e5a8e25)
2024-11-14 23:38:34 -05:00
Jonne Ransijn
9614721bde AK: Pass (Deprecated)FlyString::is_one_of arguments by reference
This avoid unnecessairy reference counting.

(cherry picked from commit 22a66bb1c2afde93096d9866d6386e2bca955f71)
2024-11-14 23:38:18 -05:00
Gingeh
c591562b0d LibURL: Use UTF-8 for percent encoding URL fragments
(cherry picked from commit c10cb8ac8d6c897c8fb184d5f0c2a09b8f699b1d)
2024-11-14 22:21:55 -05:00
Gingeh
af93b65e26 LibWeb: Use Content-Type header to set document encoding
Co-authored-by: Shannon Booth <shannon@serenityos.org>
(cherry picked from commit 8e342e3e23f5c0d7e6df5b1bcc3cc4db31a9de2b)
2024-11-14 22:21:55 -05:00
0x4261756D
fcfe89e21d 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

(cherry picked from commit c1a14f66adf4b5e55a0e2a78068749e7d8b3ed98)
2024-11-14 21:38:52 -05:00
Timothy Flynn
9e773e4977 LibWeb: Do not break WebDriver errors into multiple socket writes
Very similar to commit e5877cda61eb53cd9c1eebbfaf3c35d084b2973c.

By sending as much data as we can in a single write, we see a massive
performance improvement on WPT tests that hammer WebDriver with errors.

On my Linux machine, this reduces the runtime of:
    /webdriver/tests/classic/perform_actions/invalid.py
from 45-60s down to 3-4s.

(cherry picked from commit 7a15e3ee5caa9332f3f6011cc21058e6ceab838c)
2024-11-14 19:52:23 -05:00
Timothy Flynn
ed67435920 LibWeb: Ensure WebDriver response headers are exactly to spec
We must send a Cache-Control header, which then also requires that we
respond with an HTTP/1.1 response (the Pragma cache option is HTTP/1.0).

We should also send the Content-Type header using the same casing as is
written in the WebDriver spec (lowercase).

Both of these are explicitly tested by WPT.

(cherry picked from commit e436c31b97b5e25a6064013ae9deae0f979e95dc)
2024-11-14 19:52:23 -05:00
Timothy Flynn
60782cb219 AK: Do not coerce i64 and u64 values to i32 and u32
First, this isn't actually helpful, as we no longer store 32-bit values
in JsonValue. They are stored as 64-bit values anyways.

But more imporatantly, there was a bug here when trying to coerce an i64
to an i32. All negative values were cast to an i32, without checking if
the value is below NumericLimits<i32>::min.

(cherry picked from commit 7b3b608cafbed8049ac7a34104c66622c1445ffc)
2024-11-14 19:52:23 -05:00
Sönke Holz
61244cdad5 Kernel/EFI: Add header for the RISC-V EFI boot protocol
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
5772348b99 Kernel/EFI: Add header for the "Media Access" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
05b4e38ed0 Kernel/EFI: Add header for the "Loaded Image" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
83adb406a5 Kernel/EFI: Add header for the "Device Path" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
7cd62197da Kernel/EFI: Add header for the System Table
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
4a9480e7a9 Kernel/EFI: Add header for the Boot Services
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
fbce9ec8cc Kernel/EFI: Add header for the "Console Support" protocols
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Sönke Holz
1ac9aaa6ac Kernel/EFI: Add header for basic EFI data types
These definitions are adapted from the UEFI spec to match our code
style.
2024-11-15 01:18:04 +01:00
Daniel La Rocque
d84ef14a57 LibWeb: Assert navigationParams' request and response are not null
(cherry picked from commit db6ec2792a709d616b2f4aba8955a8c93837d9cb)
2024-11-14 17:46:06 -05:00
Daniel La Rocque
171a2ab2c0 LibWeb: Check if navigationParams is NullWithError
When we check whether navigationParams is null, we should check if it is
`NullWithError`, since `NullWithError` is equivalent to `Empty`, but is
used for error messages.

(cherry picked from commit 219cb04865fc02bfc05d39f048dd2a778714b7e1)
2024-11-14 17:46:06 -05:00
Tim Ledbetter
881b58b8b2 WebDriver: Don't return from new_window() until WebDriver is connected
Previously, tests would intermittently fail because the current session
wasn't yet aware of a newly created window handle.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
(cherry picked from commit 74983e6966cd847d0830cbdca173afbd01560a4d)
2024-11-14 17:46:06 -05:00
Andreas Kling
20057b3140 LibWeb: Scale up "inspected node" hint text to match screen DPI
This fixes an issue where the text would look very small on macOS.

(cherry picked from commit 72f425391114556973f356885dc9d4a6aeff8787;
amended to cast device_pixels_per_css_pixel() to float to pacify
-Wdouble-promotion)
2024-11-14 17:46:06 -05:00
stelar7
25374a193c LibWeb/Meta: Adjust how missing/invalid default values are generated
(cherry picked from commit d81f31c6993a422e02d48b02872de436a07e73b7)
2024-11-14 17:46:06 -05:00
Jelle Raaijmakers
35f4f5cf54 LibWeb: Implement AudioListener
This exposes BaseAudioContext.listener, which is a container for
parameters related to the configuration of an actual "listener" in 3D
space.

(cherry picked from commit 2a98f2a12d5069a2189fa38b4a7e158d84ee03ec)
2024-11-14 17:46:06 -05:00
Shannon Booth
7babbf4b2e LibWeb: Fix spec typo in inner_navigate_event_firing_algorithm
(cherry picked from commit 329e9ed820ead326ed309f6cfb07f04695aa4c48)
2024-11-14 17:46:06 -05:00
Shannon Booth
fe69f62160 LibWeb: Fire traversable event during "apply the history step"
These steps were recently clarified by Andrew in:

https://github.com/whatwg/html/commit/12b0d582
(cherry picked from commit dc9861174b52a941b98b02b04231d77d94203628)
2024-11-14 17:46:06 -05:00
Shannon Booth
4ee6a305af LibWeb: Simplify populate_session_history_entry_document conditional
(cherry picked from commit bd3ffcdabb42f097bfb008ef1c02cfa8708e7a72)
2024-11-14 17:46:06 -05:00
Shannon Booth
8e6d036dc5 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.

(cherry picked from commit 41f574155df89bb5122646a0978fa8821c35fc16)
2024-11-14 17:46:06 -05:00
Jelle Raaijmakers
f36546d591 LibWeb: Update DOM IDL specs
I noticed some of these were running behind the upstream spec.

(cherry picked from commit d5fd29adb79641830835e2efd9541de08d0ad6fc)
2024-11-14 17:46:06 -05:00
ronak69
5a9524f3cd LibWeb/CSS: Don't serialize empty rules in CSSMediaRule
This is a recent spec change:
https://github.com/w3c/csswg-drafts/pull/10981

(cherry picked from commit 8003d63ff9961623e3e1f2362caabb91cf0156a1)
2024-11-14 17:46:06 -05:00
ronak69
8fbecc096d 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

(cherry picked from commit 3ff613712132bd3d03f44f27986f7ca5aaea8eb5)
2024-11-14 17:46:06 -05:00
Sebastian-Webster
029cbbf61d LibWebView: Add Startpage search engine
(cherry picked from commit eec2602424d25cf4c83c6a87fa9e348ec6ed115a)
2024-11-14 17:46:06 -05:00
sin-ack
e88ee18e6d LibWeb: Remove redundant DedicatedWorkerGlobalScope prototype setting
Now that the global object correctly sets the property, we don't need
to do it here.

(cherry picked from commit 711faa8280ac4147f68ed778ad67047428329c67)
2024-11-14 17:46:06 -05:00
sin-ack
23e49f2835 BindingsGenerator: Handle global interfaces without named properties
DedicatedWorkerGlobalScope is an object with a Global extended
attribute, but does not define any named property getters. This needs to
be handled by setting the prototype chain to:

    DedicatedWorkerGlobalScope
    ^ DedicatedWorkerGlobalScopePrototype
    ^ WorkerGlobalScopePrototype

(This is different from something like Window, where there is an
intermediate WindowProperties object for named properties.)

Previously, we treated the GlobalMixin object as if it was a simple
prototype object, accidentally setting DedicatedWorkerGlobalScope's
prototype to WorkerGlobalScopePrototype. This caused the expression

    self instanceof DedicatedWorkerGlobalScope

to return false inside workers.

This makes us pass many more of the "/xhr/idlharness.any.worker" WPT
tests than before, rather than failing early.

(cherry picked from commit d5948709cd499ef0e7bfa3c24e8c03befed115fe)
2024-11-14 17:46:06 -05:00
Arhcout
0845de1018 LibWeb: Don't trigger onchange event when setting <select> value
(cherry picked from commit 5d00211a8605b0fab9f330082699f6f089961052)
2024-11-14 17:46:06 -05:00
Timothy Flynn
2740d7d17b WebDriver: Handle script execution results without spinning event loops
We currently spin the platform event loop while awaiting scripts to
complete. This causes WebContent to hang if another component is also
spinning the event loop. The particular example that instigated this
patch was the navigable's navigation loop (which spins until the fetch
process is complete), triggered by a form submission to an iframe.

So instead of spinning, we now return immediately from the script
executors, after setting up listeners for either the script's promise to
be resolved or for a timeout. The HTTP request to WebDriver must finish
synchronously though, so now the WebDriver process spins its event loop
until WebContent signals that the script completed. This should be ok -
the WebDriver process isn't expected to be doing anything else in the
meantime.

Also, as a consequence of these changes, we now actually handle time
outs. We were previously creating the timeout timer, but not starting
it.

(cherry picked from commit c2cf65adac78912883996153fb608dafe389b6e0)
2024-11-14 17:35:38 -05:00
Timothy Flynn
7e1d73b76d LibWeb: Spin the HTML event loop when awaiting a navigable fetch
Spinning the HTML event loop allows microtasks to run (i.e. Promise
completions).

(cherry picked from commit 6f31a19c5f0b7bcae89037ceb65c474b20482ca2)
2024-11-14 17:35:38 -05:00
Tim Ledbetter
2763dd8601 LibWeb/WebDriver: Align execute script methods with the specification
This change updates `ExecuteScript::execute_script()` and
`ExecuteScript::execute_script()` to bring their behavior in line with
each other and the current specification text.

Instances of the variable `timeout` have also been renamed to
`timeout_ms`, for clarity.

(cherry picked from commit 107549dc86eb0a02bb6468ccfa03475114474187)
2024-11-14 17:35:38 -05:00