Commit graph

20 commits

Author SHA1 Message Date
Zaggy1024
55262fb6a3 LibWeb: Close IDB connections when the page is destroyed
This fixes a timeout in WPT's abort-in-initial-upgradeneeded.any.html
test. The timeout was a rare one, caused by idbfactory_open.any.html
leaving the second connection in the final test open, since support.js
only tracks the connection created by the first createdb call. By
leaving the connection open, the harness's deleteDatabase() call would
never take effect. This in turn meant that the upgradeneeded test would
fail an assertion on the number of databases. That assertion was also
uncaught by the harness, turning it into a timeout instead of a fail.

By closing the connections when a document is destroyed, we can ensure
that the connection doesn't leak over to the next test and cause the
exception to be thrown.
2026-04-08 03:03:38 +02:00
Timothy Flynn
fb821ead7d LibWeb: Use CacheStorage as a forward declaration
This nearly eliminates the build overhead of changing CacheStorage.h
(where it was previously 2000+ targets rebuilt).
2026-04-03 11:04:12 +02:00
Andreas Kling
269d5f739b LibWeb: Use repeating timers for setInterval() to reduce drift
The timer nesting level throttling change (7577fd2a57) inadvertently
reverted the repeating timer optimization from 4d27e9aa5e, causing
setInterval() to use single-shot timers that re-arm after the callback
completes. This meant the next firing was scheduled relative to callback
completion rather than the previous fire time, causing drift
proportional to callback execution time.

For example, DiabloWeb's 50ms game loop with ~20ms of WASM work per
frame was only achieving 14 FPS (71ms intervals) instead of 20 FPS.

Fix this by using repeating Core::Timer for setInterval() again. The
repeating timer fires on schedule regardless of callback duration. On
re-arm, we update the callback (for nesting level changes) and the
interval (in case nesting level clamping kicks in), but don't restart
the timer since it's already running on the correct schedule.
2026-03-13 03:31:25 +00:00
Tim Ledbetter
7577fd2a57 LibWeb: Implement timer nesting level throttling
This clamps the interval of repeating timers to 4ms after they have run
5 times. This prevents CPU spinning for `setInterval()` calls with low
timeouts.
2026-02-11 16:32:20 +00:00
Shannon Booth
f9a996650b LibWeb/HTML: Implement the Origin interface
See: 68909b2
2025-12-30 12:40:27 +01:00
Andreas Kling
4d27e9aa5e LibWeb: Make setInterval() reuse the timer to reduce drift
Instead of creating a new single-shot timer every time a setInterval
timer reschedules itself, we now use a repeating Core::Timer internally.

This dramatically reduces timer drift, since the next timeout is now
based on when the timer fired, rather than when the timer callback
completed (which could take arbitrarily long since we run JS).

It's not perfect, but it's a huge improvement and allows us to play
DiabloWeb at full framerate (20 fps).
2025-12-01 19:58:47 +01:00
ayeteadoe
3df8e00d91 LibWeb: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
Tete17
8fdd9b68dc LibWeb: First implementation of the TrustedTypePolicyFactory
Most of the functions are either not implemented of filled with dummy
values.
2025-07-30 15:51:35 +01:00
Aliaksandr Kalenik
7efdd1c1ec LibWeb: Stub CacheStorage interface
With this change we can again open login form https://discord.com/login
instead of failing in js because `caches.open()` is not defined.
2025-06-05 23:02:21 +02:00
Luke Wilde
6d1f78198d LibWeb: Implement Resource Timing 2025-03-06 09:00:53 -07:00
Luke Wilde
67cfb64d07 LibWeb: Separate adding to performance buffers and queueing to observers
The User Timing, Resource Timing and Navigation Timing specifications
have not been updated to account for the queue method to also append to
the underlying performance buffer and it's method of checking it's
full.

This separates the functionality into a different function, with a flag
to indicate whether to use the custom full buffer logic or not.
2025-03-06 09:00:53 -07:00
Luke Wilde
12a07b4fad LibWeb: Close WebSockets when document is unloaded
Previously, they would stay open for the entire WebContent lifetime,
or until the server closed the connection. This was particularly
noticeable on collaborative websites/games such as
https://jigsawpuzzles.io/, where the user using Ladybird would stick
around even after they had navigated away.
2025-02-26 11:47:32 +01:00
Psychpsyo
9b8120d8e8 Meta: Disallow links to single-page HTML spec 2025-02-05 16:04:50 -07:00
Shannon Booth
57479c2d4b LibWeb/HTML: Include better information in 'report an exception' event
Instead of always reporting a colno and lineno of zero try and use the
values from the Error object that may be provided, falling back to the
source location of the invocation if not provided. We can definitely
improve the reporting even more, but this is a start!

Also update this function to latest spec while we're in the area.
2025-01-12 18:49:55 +00:00
Andreas Kling
3bfb0534be LibGC: Rename MarkedVector => RootVector
Let's try to make it a bit more clear that this is a Vector of GC roots.
2024-12-26 19:10:44 +01:00
Shannon Booth
05b4676917 LibWeb: Ensure global objects are an event target
All global objects current need to be event targets so that they
can have events dispatched to them. This allows for removing of
verify_cast for these global objects.
2024-12-03 00:18:11 +01:00
Shannon Booth
6a668f27c7 LibWeb: Push promise rejection handling onto UniversalGlobalScopeMixin
This is needed for shadow realms which don't have a window or worker
global object. Fixes a crash for the attached test.
2024-11-30 11:55:11 +01:00
Shannon Booth
8f6fe1de83 LibURL+LibWeb: Make URL serialization return a String
This can only ever fail from OOM, and will never by string containing
random byte sequences.
2024-11-23 16:43:55 +01:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.h (Browse further)