Commit graph

3207 commits

Author SHA1 Message Date
Timothy Flynn
f268f24dd5 LibWeb: Explicitly rethrow exceptions from writable stream start
This is an editorial change in the Streams spec. See:
https://github.com/whatwg/streams/commit/95a5adf
2025-04-11 12:10:46 -04:00
Timothy Flynn
e9a7694cdb LibWeb: Prefer react_to_promise over upon_fulfillment + upon_rejection
While debugging a spec-compliant implementation of ReadableStreamPipeTo,
I spent a lot of time inspecting promise internals. This is much less
noisy if we halve the number of temporary promises.
2025-04-11 12:10:46 -04:00
Timothy Flynn
3033929bb6 LibWeb: Pass abort signal as its concrete type to ReadableStreamPipeTo
There's no real need to wrap it in a JS::Value just to unrwap it again.
2025-04-11 12:10:46 -04:00
Timothy Flynn
ab43c3be23 LibWeb: Store WritableStream's strategy high water mark as a double
It is received from user JS as a double and is only used as a double in
all subsequent calculations. This bug would cause UBSAN errors in an
upcoming imported WPT test, which passes Infinity as the HWM.

Note there is an equivalent HWM for ReadableStream, which already stores
the value as a double.
2025-04-11 12:10:46 -04:00
Timothy Flynn
1d6e1637cc LibWeb: Implement an AO to close writable streams with error propagation 2025-04-11 12:10:46 -04:00
Timothy Flynn
f7c095a318 LibWeb: Implement an AO to get a promise to wait for promises to settle 2025-04-11 12:10:46 -04:00
Tim Ledbetter
f07a3fe6da LibWeb: Use discrete interpolation for degenerate ratios
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Degenerate ratios cannot be interpolated.
2025-04-11 11:38:05 +01:00
Tim Ledbetter
b3980d40f7 LibWeb: Round to the nearest integer when interpolating integer values 2025-04-11 11:31:54 +01:00
Jelle Raaijmakers
8257788a20 LibWeb: Ignore negative margins for margin box rect
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Negative margins are processed through the `offset` in layout state, and
should not contribute to the margin box' rect's size or position.

Fixes #4249.
2025-04-11 02:34:28 +01:00
Jelle Raaijmakers
76105d6a02 LibWeb: Use LayoutState::set_content_x/y() where possible
No functional changes.
2025-04-11 02:34:28 +01:00
Jelle Raaijmakers
4a6998497f LibWeb: Don't recalculate margin box rect for preceding floats
We already stored that rect while building up the side data during
floating box layout. No functional changes.
2025-04-11 02:34:28 +01:00
stelar7
0a298dba27 LibWeb/IDB: Dont go back to inactive if we finished during upgrade 2025-04-10 19:12:30 -06:00
stelar7
aa4e303b9f LibWeb/IDB: Make some debug messages more descriptive 2025-04-10 19:12:30 -06:00
stelar7
fc06d088c3 LibWeb/IDB: Implement IDBTransaction::objectStore 2025-04-10 19:12:30 -06:00
stelar7
8fcb54dada LibWeb/IDB: Abort requests in the transactions request list 2025-04-10 19:12:30 -06:00
stelar7
a61315a68e LibWeb/IDB: Use correct wait condition when upgrading database 2025-04-10 19:12:30 -06:00
stelar7
de640ffef4 LibWeb/IDB: Implement auto-commit for IDBTransaction 2025-04-10 19:12:30 -06:00
stelar7
da56c1b1eb LibWeb/IDB: Implement IDBTransaction::commit 2025-04-10 19:12:30 -06:00
stelar7
b6b00acbd1 LibWeb/IDB: Implement abort and wait steps for closing a connection 2025-04-10 19:12:30 -06:00
stelar7
fc93ec135e LibWeb/IDB: Keep track of the connection used to start a transaction 2025-04-10 19:12:30 -06:00
stelar7
d1dabb9039 LibWeb/IDB: Make close_a_database_connection take a GC::Ref 2025-04-10 19:12:30 -06:00
stelar7
7c3de67b16 LibWeb/IDB: Dont set the forced flag when aborting connection 2025-04-10 19:12:30 -06:00
stasoid
32ddeb82d6 LibURL+LibWeb: Remove leading slash when converting url to path
...on Windows
2025-04-10 19:04:21 -06:00
Aliaksandr Kalenik
b53694b4c0 LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC connection
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Bring back 2d625f5c23
2025-04-10 23:40:02 +02:00
Tim Ledbetter
1ee56d34e7 Revert "LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC…
…connection"

This reverts commit 2d625f5c23.
2025-04-10 16:24:38 +01:00
Sam Atkins
9dbeecb73d LibWeb: Correct some spec typos
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Corresponds to 285a58bf30
2025-04-10 04:01:37 +02:00
Andreas Kling
6bd2cf3195 LibWeb: Make Document::m_shadow_roots an IntrusiveList
This makes unregistering a ShadowRoot O(1) instead of O(n) and erases
a 2.2% item entirely from the Speedometer 2.1 profile.
2025-04-10 04:01:00 +02:00
Aliaksandr Kalenik
2d625f5c23 LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC connection
It's no longer needed because TransportSocket is now capable of properly
sending large messages.
2025-04-10 01:30:08 +02:00
Andreas Kling
938b1e91fe LibJS: Inline the fast path of Value::to_i32() and simplify to_u32()
The fast path of to_i32() can be neatly inlined everywhere, and we still
have to_i32_slow_case() for non-trivial conversions.

For to_u32(), it really can just be implemented as a static cast to i32!
2025-04-09 22:06:49 +02:00
stelar7
f1fba24538 LibWeb/IDB: Add ObjectStore to IDBDatabases store set 2025-04-09 11:48:49 -06:00
stelar7
1fc2d6f1af LibWeb/IDB: Comment out infinite loop while waiting for next PR
Since the steps needed to avoid this loop is quite long,
adding this as a fixme for the future will make this PR easier to review
2025-04-09 11:48:49 -06:00
stelar7
6ec914c7f7 LibWeb/IDB: Add some debug output 2025-04-09 11:48:49 -06:00
stelar7
4084a127de LibWeb/IDB: Change reference to a GC::Ref in abort_a_transaction 2025-04-09 11:48:49 -06:00
stelar7
5298ecfc94 LibWeb/IDB: Implement IDBTransaction attributes
This also uncovered a bug, where the transactions type was never set :^)
2025-04-09 11:48:49 -06:00
stelar7
718c805e95 LibWeb/IDB: Implement IDBObjectStore::deleteIndex 2025-04-09 11:48:49 -06:00
stelar7
fce936e05a LibWeb/IDB: Implement IDBObjectStore::index 2025-04-09 11:48:49 -06:00
stelar7
fba7ad6969 LibWeb/IDB: Implement IDBObjectStore::indexNames 2025-04-09 11:48:49 -06:00
stelar7
3367352991 LibWeb/IDB: Implement IDBObjectStore::createIndex 2025-04-09 11:48:49 -06:00
stelar7
a235dd4300 LibWeb/IDB: Fillout IDBIndex attributes 2025-04-09 11:48:49 -06:00
stelar7
9321ad04c0 LibWeb/IDB: Add internal Index object 2025-04-09 11:48:49 -06:00
Sam Atkins
8beade51e0 LibWeb/CSS: Make it clear that StyleSheet::media() is never null 2025-04-09 18:45:57 +01:00
Sam Atkins
848a250b29 LibWeb/CSS: Mark CSSImportRule.media as nullable
See the linked spec issue for more details. The MediaList can be null
internally, and this was upsetting GCC as it meant our bindings code
was dereferencing a null pointer.
2025-04-09 18:45:57 +01:00
Sam Atkins
0f42d5ec3e LibWeb/CSS: Don't resolve @import URLs until they are used
The regression in the "conditional-CSSGroupingRule" test is we now fail
the "inserting an `@import`" subtests differently and the subtests
aren't independent. Specifically, we don't yet implement the checks in
`CSSRuleList::insert_a_css_rule()` that reject certain rules from being
inserted. Previously we didn't insert the `@import` rule because we
failed to parse its relative URL. Now we parse it correctly, we end up
inserting it.
2025-04-09 18:45:57 +01:00
Sam Atkins
ca0890ce16 LibWeb/CSS: Only try to fetch @imports with a parent style sheet
When `CSSRuleList::remove_a_css_rule()` is called, the removed rule has
its parent style sheet set to null. We shouldn't try to fetch an import
in this case.
2025-04-09 18:45:57 +01:00
Sam Atkins
c679643391 LibWeb/CSS: Extract CSSStyleSheet's ParsingParams code into a method
This repeated code is a bit unwieldy.
2025-04-09 18:45:57 +01:00
Sam Atkins
1abc628cd8 LibWeb/CSS: Allow CSSImportRule's document to be null on construction
It's possible to parse an `@import` rule that isn't attached to a
document. We only actually need it to have one when fetching the linked
style sheet, and that should only happen when the CSSImportRule is
attached to a document. So, we can just accept a null pointer when
constructing it.

We relied on that Document to get the Realm, so pass that in as a
separate parameter.
2025-04-09 18:45:57 +01:00
Sam Atkins
a8ab4d64c4 LibWeb/DOM: Use document's URL as location for inline stylesheets
This is ad-hoc, and the spec doesn't seem to tell us what to actually do
here. Without this, following the spec steps for loading relative
`@import` URLs from a `<style>` tag always fails, because that uses the
parent style sheet's location as the base URL.
2025-04-09 18:45:57 +01:00
Sam Atkins
bc02e3e9a9 LibWeb/CSS: Pass location to parse_a_stylesheet() 2025-04-09 18:45:57 +01:00
Sam Atkins
7216c6b050 LibWeb/CSS: Parse <url> as a new CSS::URL type
Our previous approach to `<url>` had a couple of issues:
- We'd complete the URL during parsing, when we should actually keep it
  as the original string until it's used.
- There's nowhere for us to store `<url-modifier>`s on a `URL::URL`.

So, `CSS::URL` is a solution to this. It holds the original URL string,
and later will also hold any modifiers. This commit parses all `<url>`s
as `CSS::URL`, but then converts it into a `URL::URL`, so no user code
is changed. These will be modified in subsequent commits.

For `@namespace`, we were never supposed to complete the URL at all, so
this makes that more correct already. However, in practice all
`@namespace`s are absolute URLs already, so this should have no
observable effects.
2025-04-09 18:45:57 +01:00
Sam Atkins
c82f4b46a2 LibWeb/CSS: Qualify uses of LibURL
To prepare for introducing a CSS::URL type, we need to qualify any use
of LibURL as `::URL::foo` instead of `URL::foo` so the compiler doesn't
get confused.

Many of these uses will be replaced, but I don't want to mix this in
with what will likely already be a large change.
2025-04-09 18:45:57 +01:00