Commit graph

69027 commits

Author SHA1 Message Date
Andreas Kling
1772adb600 LibWeb: Don't crash on non-finite values in CSS clamp() function
Stops a WPT test from crashing, giving us 29 new subtest passes. :^)
2025-04-24 18:26:54 +02:00
Andreas Kling
2f76b24b89 LibWeb: Throw on deleting CSS @namespace rule in disallowed conditions
Fixes one(!) WPT test :^)
2025-04-24 18:26:54 +02:00
aplefull
223c9c91e6 LibJS: Implement rawJSON and isRawJSON functions
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
2025-04-24 09:33:49 -04:00
aplefull
e0ceb66580 LibGfx: Fix incorrect colors in ICO-embedded BMPs 2025-04-24 13:46:54 +01:00
Andrew Kaster
9bae24cc4a LibJS: Add and use ValidateNonRevokedProxy AO
This refactor is from two editorial changes to the spec from a while
back.

44d1cae2b2
21ffeee869
2025-04-24 10:37:39 +02:00
Aliaksandr Kalenik
e48645c83f LibJS: Cache arguments span in ExecutionContext
Allows us to avoid doing math in ExecutionContext::argument()
2025-04-24 10:30:52 +02:00
Aliaksandr Kalenik
ff751173ac LibJS: Delete unused m_arguments member in Interpreter 2025-04-24 10:30:52 +02:00
Aliaksandr Kalenik
a329868c1b LibJS: Allocate ExecutionContext memory using alloca() when possible
This should be faster than heap allocation. However, heap allocation is
still necessary in some cases, such as with generators and async
functions.
2025-04-24 10:30:52 +02:00
Aliaksandr Kalenik
5a92929282 LibJS: Put vector of regs+consts+locals+args in tail of ExecutionContext
By doing that we avoid doing separate allocation for each such vector,
which was really expensive on js heavy websites. For example this change
helps to get EC allocation down from ~17% to ~2% on Google Maps. This
comes at cost of adding extra complexity to custom execution context
allocator, because EC no longer has fixed size and we need to maintain
a list of buckets.
2025-04-24 10:30:52 +02:00
Aliaksandr Kalenik
c6cd03d7ca LibJS+LibWeb: Join arguments into vector of registers+constants+locals
This is better because:
- Better data locality
- Allocate vector for registers+constants+locals+arguments in one go
  instead of allocating two vectors separately
2025-04-24 10:30:52 +02:00
Aliaksandr Kalenik
cd9e491742 AK: Use TypedTransfer in Span::overwrite()
Using `__builtin_memmove` was unsafe if items in source buffer are not
trivially copyable.
2025-04-24 10:30:52 +02:00
Aliaksandr Kalenik
005551b530 AK: Fix out of bound access check in Span::overwrite()
Previously `data_size` (in bytes) was mistakenly compared with `size()`
that returns number of elements in a span.
2025-04-24 10:30:52 +02:00
Aliaksandr Kalenik
80a8040794 LibJS+LibWeb: Calculate count of regs+consts+locals before EC allocation
This is a preparation step before joining arguments vector into vector
of registers+constants+locals.
2025-04-24 10:30:52 +02:00
Ali Mohammad Pur
fca1d33fec LibRegex: Correctly calculate the target for Repeat in table alts
Fixes a bunch of websites breaking because we now verify jump offsets by
trying to remove 0-offset jumps.
This has been broken for a good while, it was just rare to see Repeat
inside alternatives that lended themselves well to tree alts.
2025-04-24 01:17:27 -06:00
Aliaksandr Kalenik
8f20899533 LibGfx: Make Bitmap atomic ref-counted
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
Fixes race condition when rendering thread runs destructor for
Gfx::Bitmap owned by PaintingSurface, which was not thread-safe.
2025-04-24 03:12:19 +02:00
Timothy Flynn
234c07adc9 LibWebView: Split about:settings into modules
The about:settings page has gotten beefy enough that it is a bit of a
paint to manage in a single HTML file. This patch breaks the settings
into several modules to make this page easier to mantain.

Modules have some nice benefits over classic scripts, such as enabling
strict mode by default, and allowing each module to function without
polluting the global object.
2025-04-23 19:58:58 -04:00
Timothy Flynn
6a6c56aabe LibWebView: Create a dedicated settings observer for the Application
We had a bit of an awkward setup where we want the Application to be a
SettingsObserver, but neither the Settings object nor the Application
itself was fully initialized by the time the observer was created. So
we invented a deferred observer initializer specifically for the
Application.

Instead, let's just create a dedicated observer subclass that is owned
by the Application. We can then create it once we have the singleton
Application appropriately set up.
2025-04-23 19:58:58 -04:00
Timothy Flynn
6539c72e7e LibWeb: Allow CORS requests from opaque origins to resource:// URLs
JavaScript module requests (in a non-worker context) always have CORS
enabled. However, CORS requests are only allowed for same-origin or
HTTP/S requests. This patch extends this to allow resource:// requests
from opaque origins (e.g. about: URLs).

We must also set the Access-Control-Allow-Origin header to "null" to
ensure that the response is accepted by the CORS checks. This does not
affect requesting resource:// URLs from resource:// URLs as those are
same-origin and skip CORS checks.

This ultimately enables requesting resource:// JS modules from the
about:settings page.
2025-04-23 19:58:58 -04:00
Timothy Flynn
5f9b1d3cd4 LibWeb: Make the main fetch response callback a bit easier to read
Each `if` branch in this callback returns a value, so let's add a bit of
whitespace between them to be easier on the eyes.
2025-04-23 19:58:58 -04:00
Andreas Kling
26c48c16aa LibWeb: Remove broken anonymous table wrapper layout invalidation
The special case for anonymous table wrappers actually ended up hurting
correctness by preventing the full ancestor chain from being marked for
for intrinsic size cache invalidation.

Caused Layout/input/table/propagate-style-update-to-wrapper.html to
flake on CI, and was easy to reproduce locally with sanitizers.

The fix here is simply to remove the special handling of anonymous table
wrapper parents, since *all* parents are invalidated automatically
anyway!

Began flaking in fa9c463ffd.
2025-04-23 19:43:34 -04:00
Tim Ledbetter
fc1026984c LibWeb: Don't crash when processing a transition with value none 2025-04-24 00:00:23 +02:00
Ali Mohammad Pur
4b9abdb963 LibRegex: Remove useless jumps (Jump* +0) before running opts
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
This leads to some more significant performance increases on the simple
/<script|<style|<link/ regex in speedometer (~2x)
2025-04-23 22:57:49 +02:00
Ali Mohammad Pur
ec0836c9ea LibRegex: Don't blindly treat multi-target tree jumps as a single jump
The tree generation was broken, we just didn't notice it because it was
very rarely being picked for more complex bytecodes.
2025-04-23 22:57:49 +02:00
Ali Mohammad Pur
09eb28ee1d LibRegex: Better estimate the cost of laying out alts as a chain
Previously we were counting the total number of *nodes* in the tree for
the chain cost, which greatly underestimated its cost when large
bytecode entries were present,
This commit switches to estimating it using the total bytecode *size*,
which is a closer value to the true cost than the tree node count.

This corresponds to a ~4x perf improvement on /<script|<style|<link/ in
speedometer.
2025-04-23 22:57:49 +02:00
Tim Ledbetter
64577ad704 LibWeb: Allow multiple values for the transition-duration property 2025-04-23 21:02:59 +01:00
Tim Ledbetter
1ca9f2a44d LibWeb: Allow multiple values for the transition-delay property 2025-04-23 21:02:59 +01:00
Tim Ledbetter
c5f1f36119 LibWeb: Allow multiple values for transition-timing-function property 2025-04-23 21:02:59 +01:00
Tim Ledbetter
7a391f419a LibWeb: Handle single value properties when normalizing transition lists
Previously, if a transition property was not wrapped in a list, it
would be replaced with the default value in
`StyleComputer::compute_transitioned_properties`.
2025-04-23 21:02:59 +01:00
Tim Ledbetter
1f8f3804a3 LibWeb: Allow transition-property with multiple values 2025-04-23 21:02:59 +01:00
stelar7
5d48652890 LibWeb/IDB: Implement IDBObjectStore::put 2025-04-23 12:31:14 -06:00
stelar7
ca1e94f9ea LibWeb/IDB: Implement IDBObjectStore::add 2025-04-23 12:31:14 -06:00
stelar7
a06cec7a3c LibWeb/IDB: Implement IDBObjectStore::add_or_put 2025-04-23 12:31:14 -06:00
stelar7
fb17dae42b LibWeb/IDB: Implement store_a_record_into_an_object_store 2025-04-23 12:31:14 -06:00
stelar7
afe7951af4 LibWeb/IDB: Implement delete_records_from_an_object_store 2025-04-23 12:31:14 -06:00
stelar7
7fa3bd00b5 LibWeb/IDB: Implement inject_a_key_into_a_value_using_a_key_path 2025-04-23 12:31:14 -06:00
stelar7
1bdf519b60 LibWeb/IDB: Implement possibly_update_the_key_generator 2025-04-23 12:31:14 -06:00
stelar7
dbe0db0cab LibWeb/IDB: Implement generate_a_key 2025-04-23 12:31:14 -06:00
stelar7
f8b09148be LibWeb/IDB: Implement asynchronously_execute_a_request 2025-04-23 12:31:14 -06:00
stelar7
551969de30 LibWeb/IDB: Implement more of IDBCursor 2025-04-23 12:31:14 -06:00
stelar7
abb11a26a8 LibWeb/IDB: Implement fire_a_success_event 2025-04-23 12:31:14 -06:00
stelar7
5c814e1a62 LibWeb/IDB: Implement fire_an_error_event 2025-04-23 12:31:14 -06:00
stelar7
d801d25c82 LibWeb/IDB: Change return type of IDBRequest::error() 2025-04-23 12:31:14 -06:00
stelar7
1d97b0d18e LibWeb/IDB: Implement check_that_a_key_could_be_injected_into_a_value 2025-04-23 12:31:14 -06:00
stelar7
eab7a2bb05 LibWeb/IDB: Implement extract_a_key_from_a_value_using_a_key_path 2025-04-23 12:31:14 -06:00
stelar7
84ea78eb4d LibWeb/IDB: Implement evaluate_key_path_on_a_value 2025-04-23 12:31:14 -06:00
stelar7
f36c4d88ff LibWeb/IDB: Implement convert_a_value_to_a_multi_entry_key 2025-04-23 12:31:14 -06:00
stelar7
8bfbcf6d9b LibWeb/IDB: Adjust return type of convert_a_value_to_a_key 2025-04-23 12:31:14 -06:00
stelar7
499548c3d0 LibWeb/IDB: Implement clone_in_realm 2025-04-23 12:31:14 -06:00
Ali Mohammad Pur
eea81738cd AK+Everywhere: Recognise that surrogates in utf16 aren't all that common
For the slight cost of counting code points when converting between
encodings and a teeny bit of memory, this commit adds a fast path for
all-happy utf-16 substrings and code point operations.

This seems to be a significant chunk of time spent in many regex
benchmarks.
2025-04-23 07:56:02 -06:00
Andrew Kaster
86c756a589 LibWeb: Import WebAssembly jsapi cross-realm torture tests from WPT
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
The failures here are due to us not actually implementing the
error types yet.
2025-04-23 14:09:09 +02:00