Commit graph

63903 commits

Author SHA1 Message Date
Sam Atkins
5d86305596 Meta: Make embed_as_string_view.py produce Strings instead
This is only used for CSS style sheets. One case wants it as a String,
and the others don't care, but will in future also want to have the
source as a String.

(cherry picked from commit 8cbc2116162764479edeec78e4b2b7c41447b643;
amended to fix conflicts in two cmake files, due to serenity
still having more code_generators, and still buildling
OutOfProcessWebView.cpp. Also kept embed_as_string_view because
it's used by stringify_gml. Did this by giving embed_as_string.py
a --type= argument that defaults to string but can also be set
to string-view.)
2024-11-15 23:10:03 -05:00
Sam Atkins
abf7a72545 LibWeb: Add helper for accessing Inspector's PageClient
This is a bit easier to understand.

(cherry picked from commit fd49562f50171401076c3c39e26e6668be2f26f2)
2024-11-15 23:10:03 -05:00
Sam Atkins
ce6078306b LibWeb/CSS: Set @import as the owner rule of their loaded style sheet
(cherry picked from commit 240b58e90fbc4420b8eb4509e42c5668330ad61a)
2024-11-15 23:10:03 -05:00
Sam Atkins
2c24635e63 LibWeb: Set the location URL for @import-ed/<link>-ed style sheets
The spec text had changed for the value of `<link>`'s location, so I've
updated that.

(cherry picked from commit 4e18fce3a586651894844c7ef0a06c774ce9eb2c)
2024-11-15 23:10:03 -05:00
Sam Atkins
23959eeb6f LibWeb: Rename Document::for_each_css_style_sheet for clarity
This only iterates style sheets that are in use, so make this clear by
renaming it to `for_each_active_css_style_sheet()`.

(cherry picked from commit c29f4f69ef9a16bd63a4bf133618120068e96bf3)
2024-11-15 23:10:03 -05:00
Sam Atkins
549f5fe374 UI/Qt: Assign dropdown handler for select in WebContentView, not Tab
This makes `<select>` elements also work outside of Tab content, for
example in the Inspector.

Co-authored-by: Tim Flynn <trflynn89@serenityos.org>
(cherry picked from commit 421fb6309f6d5ea13676c5788a3d8294631a403b;
amended to resolve conflict due to us not yet having
LadybirdBrowser/ladybird#910, so this will cause extra conflicts
when finally cherry-picking that. But that PR will need lots of
conflict resolving anyways.)
2024-11-15 23:10:03 -05:00
Sam Atkins
86b610e38a Inspector: Remove border-radius for tab areas
This wasn't visible, until I tried adding a top toolbar to a tab area,
which made it look silly.

(cherry picked from commit ced7b6de5e7b6fbe2b2739158d0116339901b4c3)
2024-11-15 23:10:03 -05:00
Jamie Mansfield
70d69c194f Ladybird/Qt: Rename convert functions to reflect their new types
This is a follow up to GH-1111 to reflect the new signatures that these
functions have.

(cherry picked from commit b0fc8b67d64089587552effbe3b994cdb5967ce5)
2024-11-15 23:10:03 -05:00
Sam Atkins
b647a74557 AK: Add Utf8View::for_each_split_view() method
Returns one Utf8View at a time, using a callback function to identify
code points to split on.

(cherry picked from commit 3f10a5701d9634e47111203b837283bdfc2d8b18)
2024-11-15 23:09:44 -05:00
Sam Atkins
4548cd6e5f AK: Ensure empty StringViews all compare as equal
Before this change, a StringView with a character-data pointer would
never compare as equal to one with a null pointer, even if they were
both length 0. This could happen for example if one is
default-initialized, and the other is created as a substring.

(cherry picked from commit ec5101a1d3cc7bc9068fa4863e16aa482536929a)
2024-11-15 23:09:44 -05:00
Luke Wilde
a57f1cde9f LibJS: Perform TLA async function construction in the module context
Previously it was only pushing the module context for the call to
capture the module execution context. This is incorrect, as the capture
occurs upon function construction. This resulted in it capturing the
execution context that execute_module was called from, instead of the
newly created module_context.
f87041bf3a/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp (L92)

This can be demonstrated with the following setup:
index.html:
```html
<script>
    var foo = 1;
</script>
<script type="module">
    import {test} from "./scriptA.mjs";
</script>
```

scriptA.mjs:
```js
function foo() {
	return {a: "b"};
}
export let test = await foo();
```

Before this fix, this would throw:
```
[TypeError] 1 is not a function (evaluated from 'foo')
    at module code with top-level await
    at module code with top-level await
    at <unknown>
    at <unknown>
```

Fixes #2245.

(cherry picked from commit 6319dedbcd4d6e448b4cc2615e62eba5ac576887)
2024-11-15 23:09:44 -05:00
Aliaksandr Kalenik
4a514f32b6 LibCore: Recognize .xht as XHTML in MIME parser for file names
Fixes a bug when https://wpt.live/css/CSS2/positioning/abspos-001.xht
saved as file fails because we incorrectly recognized its MIME type
as HTML, leading to incorrect self-closing tag handling and thus
incorrect rendering.

(cherry picked from commit 71eded0471f0c4f200ffa74094e2c3809d9a1090)
2024-11-15 23:09:44 -05:00
Timothy Flynn
4a6e669343 UI/Qt: Process drag-and-drop events through the web view
This forwards all drag-and-drop events from the UI to the WebContent
process. If the page accepts the events, the UI does not handle them.
Otherwise, we will open the dropped files as file:// URLs.

(cherry picked from commit 4833ba06eaef20053f85343a13c0307394d67ded)
2024-11-15 19:27:44 -05:00
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