Commit Graph

72565 Commits

Author SHA1 Message Date
Andreas Kling
e967631763 LibJS: Remove ExecutionContext::arguments_offset and just compute it 2025-10-29 21:20:10 +01:00
Andreas Kling
fdb85a330e LibJS: Stop tracking whether execution context is strict mode or not
This was only used for basic testing, and forced us to plumb this flag
flag in a bunch of places.
2025-10-29 21:20:10 +01:00
Andreas Kling
fb05063dde LibJS: Let bytecode instructions know whether they are in strict mode
This commits puts the strict mode flag in the header of every bytecode
instruction. This allows us to check for strict mode without looking at
the currently running execution context.
2025-10-29 21:20:10 +01:00
Andreas Kling
3fb678b376 LibGC: Delete operators ! and bool from GC::Ref
The GC::Ref smart pointer is always non-null, so there's no need for it
to be convertible to bool.

This exposed a small number of unnecessary null checks which we remove.
2025-10-29 21:20:10 +01:00
Tim Ledbetter
e4e18ca84b UI/AppKit: Support dead keys on MacOS 2025-10-29 12:38:59 -04:00
InvalidUsernameException
35254d17d1 LibWeb/CSS: Do not crash when parsing some multi-layer mask shorthands
This fixes a silly bug where we would crash when parsing a multi-layer
mask shorthand property that contained the no-clip keyword but no value
for mask-origin.

Fixes a crash when parsing the CSS of https://www.browserbase.com/. The
site still has other, unrelated problems though.
2025-10-28 23:50:46 -07:00
Zaggy1024
418f1575b0 LibWeb: Stop returning the value in HTMLMediaElement::set_current_time
This wasn't actually affecting the result in a script assigning a
variable to the result of an expression assigning to currentTime.
2025-10-29 06:22:48 +00:00
Lorenz A
14dba82202 LibWeb: Allow whitespace in not after a boolean-expr-group 2025-10-28 21:54:48 -07:00
dependabot[bot]
32cfb4e7d8 CI: Bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-28 21:41:38 -07:00
stelar7
964c0ddde9 LibWeb/IDB: Import getAllRecords test 2025-10-28 19:25:26 -04:00
stelar7
8fcba173e0 LibWeb/IDB: Correctly implement IDBRecord getters 2025-10-28 19:25:26 -04:00
ayeteadoe
244f086709 LibRequests: Decode RequestTimingInfo IPC fields as i64's
On 64-bit Windows, long's are only 4 bytes. This meant that when the
client is deocding the IPC message from a async_request_finished call,
we were corrupting the RequestTimingInfo field and all the fields after
it as we were 4 bytes off.
2025-10-28 19:09:42 -04:00
Luke Wilde
d2b2d57387 LibWeb: Set attribute value directly in HTMLScriptElement::set_src
Otherwise we'll try to use the Utf16String that has already been
through Trusted Types and put it through again. That can also fail if
there's no default policy and there's a `require-trusted-types-for
'script'` directive.

Fixes Outlook failing to load.
2025-10-28 11:05:09 -07:00
Luke Wilde
498e59f71d LibWeb: Set width/height of ImageBitmap when deserializing or receiving 2025-10-28 10:05:56 -07:00
Luke Wilde
3ca4ff6037 LibWeb/WebGL: Don't attempt to do texture transforms on an empty texture
Skia will not give us a surface if the width or height is zero.
2025-10-28 10:05:56 -07:00
Tete17
b0e02af040 Tests: Add previously crashing TrustedTypes tests
Some of these fail, but we think it is due to a discrepancy between
what the spec says and what the WPT test.

Ref: https://github.com/w3c/trusted-types/issues/595
2025-10-28 13:46:54 +00:00
Tete17
676171bccd IDLGenerators: Allow set_attribute's to throw exceptions 2025-10-28 13:46:54 +00:00
Timothy Flynn
7f37889ff1 RequestServer: De-duplicate some disk cache requests
We previously had no protection against the same URL being requested
multiple times at the same time. For example, if a URL did not have any
cache entry and became requested twice, we would open two cache writers
concurrently. This would result in both writers piping the response to
disk, and we'd have a corrupt cache file.

We now hold back requests under certain scenarios until existing cache
entries have completed:

* If we are opening a cache entry for reading:
  - If there is an existing reader entry, carry on as normal. We can
    have multiple readers.
  - If there is an existing writer entry, defer the request until it is
    complete.

* If we are opening a cache entry for writing:
  - If there is an existing reader or writer entry, defer the request
    until it is complete.
2025-10-28 11:52:51 +01:00
Timothy Flynn
95d23d02f1 RequestServer: Pass the Request object to disk cache entry factories
This object will be needed in a future commit to store requests awaiting
other requests to finish. Doing this in a separate commit just to make
that commit less noisy.
2025-10-28 11:52:51 +01:00
Timothy Flynn
5384f84550 RequestServer: Create disk cache writers for new requests immediately
We previously waited until we received all response headers before we
would create the cache entry. We now create one immediately, and handle
writing the headers in its own function. This will allow us to know if
a cache entry writer already exists for a given cache key, and thus
prevent creating a second writer at the same time.
2025-10-28 11:52:51 +01:00
Timothy Flynn
d67dc23960 RequestServer: Fix typo in CacheEntry::close_and_destroy_cache_entry 2025-10-28 11:52:51 +01:00
Timothy Flynn
822fcc39de RequestServer: Manage request lifetimes as a simple state machine
We currently manage request lifetime as both an ActiveRequest structure
and a series of lambda callbacks. In an upcoming patch, we will want to
"pause" a request to de-duplicate equivalent requests, such that only
one request goes over the network and saves its response to the disk
cache.

To make that easier to reason about, this adds a Request class to manage
the lifetime of a request via a state machine. We will now be able to
add a "waiting for disk cache" state to stop the request.
2025-10-28 11:52:51 +01:00
Timothy Flynn
6cf22c424e RequestServer: Remove extra verbose disk cache log entry
This isn't particularly useful anymore, and is especially verbose for
large responses.
2025-10-28 11:52:51 +01:00
Timothy Flynn
dc10c28b57 RequestServer: Remove erroneous placeholders from dbgln statements
Apparently Services aren't compiled with ENABLE_COMPILETIME_FORMAT_CHECK
2025-10-28 11:52:51 +01:00
Timothy Flynn
1216a2f952 RequestServer: Move some cURL utilities to their own file
This will allow more easily using these from other files. This also lets
us hide the Windows.h header necessity in a single location, instead of
needing to remember to include it everywhre we would otherwise include
<curl/curl.h>.
2025-10-28 11:52:51 +01:00
Timothy Flynn
7450da5556 RequestServer: Move Resolver (and related structures) to its own file
In an upcoming commit to handle requests as a state machine, we will
need access to Resolver from outside of ConnectionFromClient..
2025-10-28 11:52:51 +01:00
ayeteadoe
997d6ee75a RequestServer: Support UDP default resolver on Windows 2025-10-28 11:52:51 +01:00
stelar7
d3568d9467 LibWeb/IDB: Handle off-by-one error in IDBIndex::getAll 2025-10-28 11:50:01 +01:00
Zaggy1024
e5d5ff952c LibMedia: Remove an unused debug variable from AudioDataProvider
Fixes the ENABLE_ALL_THE_DEBUG_MACROS build.
2025-10-27 23:03:01 -07:00
Adrian Kiezik
823deacc27 LibWeb: Implement CanvasRenderingContext2D direction property
When direction is 'rtl':
  - textAlign='start' now aligns text to the right
  - textAlign='end' now aligns text to the left

Fixes the FIXME at CanvasRenderingContext2D.cpp:283
2025-10-27 22:03:26 -07:00
Lorenz A
ffcd3a4bb2 LibWeb: Count the width of inline-blocks in InlineNodes only once
An BlockContainer inside an InlineNode is called from the
`for each in inclusive_subtree_of_type`  but is also a fragment
 of that InlineNode. Don't count the the Node twice.
2025-10-27 21:45:33 -07:00
Zaggy1024
93fde59892 LibWeb: Make the value of assignment to media currentTime the rhs value
In cases where a script assigns `x = video.currentTime = y`, we are
expected to have a result of `x === y`, even if the video's duration
is less than y.

According to the spec, this happens because the official playback
position is set to `y` in this case, but since we are following
implementations in making `currentTime` immediately return the position
on the valid media timeline, we have to specifically return the
unchanged value from the setter.

See: https://github.com/whatwg/html/issues/11773
2025-10-27 17:28:49 -07:00
Zaggy1024
9e4c87ab85 LibWeb: Ensure that media elements can seek to the duration
Due to the round trip of Duration -> double -> Duration, seeking to the
end of some media can sometimes result in the seek being resolved close
to the end but not quite there. This is a little bit of a hack to make
that work, but may be necessary depending on how the spec changes with
regard to the value returned by currentTime after a seek begins.
2025-10-27 17:28:49 -07:00
Zaggy1024
cb1719aa81 LibWeb: Don't loop the media element when paused
We should be able to seek to the end of the media without looping if
we're paused.

See: https://github.com/whatwg/html/issues/11774
2025-10-27 17:28:49 -07:00
Zaggy1024
4471e8c0ec LibWeb: Consider playback ended when loop is set after ending playback
This allows playback to restart when playing is requested after the end
of playback was reached while loop was disabled, regardless of whether
loop is then subsequently enabled.

This matches other browsers' implementations, but differs from the spec
in how the ended attribute is handled.

See: https://github.com/whatwg/html/issues/11775
2025-10-27 17:28:49 -07:00
Zaggy1024
3be6b957f8 LibWeb: Add the concept of direction of playback in HTMLMediaElement 2025-10-27 17:28:49 -07:00
Zaggy1024
45727d7a58 LibWeb: Fire the media element ended event inside a task
The spec changed in this regard, and this change ensures that once the
ended attribute is updated only during event loop step 1, ended event
handlers will see the ended attribute set to true.
2025-10-27 17:28:49 -07:00
Zaggy1024
412467cc70 LibWeb: Add a hook in EventLoop to call a task when reaching step 1 2025-10-27 17:28:49 -07:00
Zaggy1024
d9e663fc44 Tests: Add a crash test for setting HTMLMediaElement src repeatedly 2025-10-27 17:28:49 -07:00
Zaggy1024
e81fece123 LibWeb: Abort media element resource selection upon loading a source
This fixes a crash when playing video on The Cutting Room Floor.

Without aborting the resource selection algorithm, two resource
selection algorithms could be running at once, resulting in the
element requesting removal of a track from the PlaybackManager
immediately after it had been replaced with a different instance.
PlaybackManager asserts that removal of a track is valid, so this was
causing a WebContent crash.
2025-10-27 17:28:49 -07:00
Zaggy1024
122f97c68d LibWeb: Update media volume when creating a playback manager 2025-10-27 17:28:49 -07:00
Zaggy1024
7745d9209d LibMedia: Sync AudioMixingSink::set_time onto the stream thread
With the previous setup setting the time directly on the main thread,
the following could occur:

- HTMLMediaElement temporarily pauses playback to begin a seek.
- AudioMixingSink starts an audio task to drain audio and suspend.
- HTMLMediaElement starts PlaybackManager seeking to a new position.
- AudioDataProvider completes the seek to the new position.
- The PlaybackManager tells AudioMixingSink to set the media time,
  which it does so synchronously on the main thread.
- At this point, the time provider corresponds to the new position.
- The pause completes, and a deferred invocation sets media time to
  its old position again.

This would result in the timeline showing the wrong position after a
seek on rare occasions.

Instead, always queue up a drain and suspend when setting the sink's
media time. This ensures that updating the time always occurs after the
pause has completed.

Also, since setting the time is asynchronous now, we need to store the
target time until the seeking drain completes. Otherwise, we still
briefly see the previous playback position after a seek.
2025-10-27 17:28:49 -07:00
Zaggy1024
49f088275e LibWeb: Implement HTMLMediaElement looping 2025-10-27 17:28:49 -07:00
Zaggy1024
bf0219d798 LibMedia: Clamp PlaybackManager::current_time() to the duration
This allows LibWeb to detect the end of playback and pause playback or
loop to the start.
2025-10-27 17:28:49 -07:00
Zaggy1024
16b296c090 LibWeb: Update HTMLMediaElements' playback positions when invisible 2025-10-27 17:28:49 -07:00
Zaggy1024
c75f134eec LibWeb: Disconnect all sinks when forgetting HTMLMediaElement tracks
This prevents a crash when playing videos on Newgrounds.
2025-10-27 17:28:49 -07:00
Zaggy1024
9f44fcbded Everywhere: Remove AudioCodecPlugin and Qt Multimedia
These are no longer needed now that audio is played through
PlaybackManager.
2025-10-27 17:28:49 -07:00
Zaggy1024
d17e7fd921 LibMedia+Tests: Adapt TestVorbisDecode to use AudioDataProvider 2025-10-27 17:28:49 -07:00
Zaggy1024
4cf0a77d38 LibMedia: Export FFmpegDemuxer to allow direct use of data providers
We can use forward declarations of the FFmpeg types within the header
to allow it to be exported without causing errors in using code.
2025-10-27 17:28:49 -07:00
Zaggy1024
fcde0f66c8 LibMedia: Allow FFmpegDemuxer to grab samples from multiple streams
In order to do so, we create a AVFormatContext for each stream we want
to demux.
2025-10-27 17:28:49 -07:00