Commit graph

63902 commits

Author SHA1 Message Date
Shannon Booth
4ee6a305af LibWeb: Simplify populate_session_history_entry_document conditional
(cherry picked from commit bd3ffcdabb42f097bfb008ef1c02cfa8708e7a72)
2024-11-14 17:46:06 -05:00
Shannon Booth
8e6d036dc5 LibWeb: Factor out AO for 'try to scroll to the fragment'
I had made a stab at implementing this to determine whether it could
assist in fixing an issue where scroll_to_the_fragment was not getting
called at the appropriate time. It did not fix that issue, and actually
ended up breaking one of our in tree tests. In the meantime, factor out
this method into a standalone function.

(cherry picked from commit 41f574155df89bb5122646a0978fa8821c35fc16)
2024-11-14 17:46:06 -05:00
Jelle Raaijmakers
f36546d591 LibWeb: Update DOM IDL specs
I noticed some of these were running behind the upstream spec.

(cherry picked from commit d5fd29adb79641830835e2efd9541de08d0ad6fc)
2024-11-14 17:46:06 -05:00
ronak69
5a9524f3cd LibWeb/CSS: Don't serialize empty rules in CSSMediaRule
This is a recent spec change:
https://github.com/w3c/csswg-drafts/pull/10981

(cherry picked from commit 8003d63ff9961623e3e1f2362caabb91cf0156a1)
2024-11-14 17:46:06 -05:00
ronak69
8fbecc096d LibWeb: Insert title as first child on setting title of svg document
Before, the new title element got appended instead of prepended, as
nullptr was passed as the "child" argument to the insert_before()
function.

This change makes two WPT tests pass in:
http://wpt.live/html/dom/documents/dom-tree-accessors/document.title-09.html

(cherry picked from commit 3ff613712132bd3d03f44f27986f7ca5aaea8eb5)
2024-11-14 17:46:06 -05:00
Sebastian-Webster
029cbbf61d LibWebView: Add Startpage search engine
(cherry picked from commit eec2602424d25cf4c83c6a87fa9e348ec6ed115a)
2024-11-14 17:46:06 -05:00
sin-ack
e88ee18e6d LibWeb: Remove redundant DedicatedWorkerGlobalScope prototype setting
Now that the global object correctly sets the property, we don't need
to do it here.

(cherry picked from commit 711faa8280ac4147f68ed778ad67047428329c67)
2024-11-14 17:46:06 -05:00
sin-ack
23e49f2835 BindingsGenerator: Handle global interfaces without named properties
DedicatedWorkerGlobalScope is an object with a Global extended
attribute, but does not define any named property getters. This needs to
be handled by setting the prototype chain to:

    DedicatedWorkerGlobalScope
    ^ DedicatedWorkerGlobalScopePrototype
    ^ WorkerGlobalScopePrototype

(This is different from something like Window, where there is an
intermediate WindowProperties object for named properties.)

Previously, we treated the GlobalMixin object as if it was a simple
prototype object, accidentally setting DedicatedWorkerGlobalScope's
prototype to WorkerGlobalScopePrototype. This caused the expression

    self instanceof DedicatedWorkerGlobalScope

to return false inside workers.

This makes us pass many more of the "/xhr/idlharness.any.worker" WPT
tests than before, rather than failing early.

(cherry picked from commit d5948709cd499ef0e7bfa3c24e8c03befed115fe)
2024-11-14 17:46:06 -05:00
Arhcout
0845de1018 LibWeb: Don't trigger onchange event when setting <select> value
(cherry picked from commit 5d00211a8605b0fab9f330082699f6f089961052)
2024-11-14 17:46:06 -05:00
Timothy Flynn
2740d7d17b WebDriver: Handle script execution results without spinning event loops
We currently spin the platform event loop while awaiting scripts to
complete. This causes WebContent to hang if another component is also
spinning the event loop. The particular example that instigated this
patch was the navigable's navigation loop (which spins until the fetch
process is complete), triggered by a form submission to an iframe.

So instead of spinning, we now return immediately from the script
executors, after setting up listeners for either the script's promise to
be resolved or for a timeout. The HTTP request to WebDriver must finish
synchronously though, so now the WebDriver process spins its event loop
until WebContent signals that the script completed. This should be ok -
the WebDriver process isn't expected to be doing anything else in the
meantime.

Also, as a consequence of these changes, we now actually handle time
outs. We were previously creating the timeout timer, but not starting
it.

(cherry picked from commit c2cf65adac78912883996153fb608dafe389b6e0)
2024-11-14 17:35:38 -05:00
Timothy Flynn
7e1d73b76d LibWeb: Spin the HTML event loop when awaiting a navigable fetch
Spinning the HTML event loop allows microtasks to run (i.e. Promise
completions).

(cherry picked from commit 6f31a19c5f0b7bcae89037ceb65c474b20482ca2)
2024-11-14 17:35:38 -05:00
Tim Ledbetter
2763dd8601 LibWeb/WebDriver: Align execute script methods with the specification
This change updates `ExecuteScript::execute_script()` and
`ExecuteScript::execute_script()` to bring their behavior in line with
each other and the current specification text.

Instances of the variable `timeout` have also been renamed to
`timeout_ms`, for clarity.

(cherry picked from commit 107549dc86eb0a02bb6468ccfa03475114474187)
2024-11-14 17:35:38 -05:00
Tim Ledbetter
3da3bdf8c0 LibWeb: Correctly test if WebDriver ExecuteScript timeout is reached
Previously, the conversion assumed that the supplied timeout was in
seconds rather than milliseconds.

(cherry picked from commit b688b5d9d4cfd8f781dd05d522d9533cd6796aca)
2024-11-14 17:35:38 -05:00
Tim Ledbetter
c4e8b0a9bf WebContent: Actually start WebDriver timeout timers
The timers added previously in #1021 had no effect, as they were never
started.

(cherry picked from commit 5b09430c5efeb839242fb9db30f777cc446957d9)
2024-11-14 17:35:38 -05:00
Tim Ledbetter
fd3261d229 WebContent: Add timeouts to WebDriver window state modification methods
(cherry picked from commit 1b2f35c3affc4b2779c13452c2b1ec38bbf144b9)
2024-11-14 17:35:38 -05:00
Tim Ledbetter
4092531c22 WebContent: Abort WebDriver navigation if session timeout exceeded
(cherry picked from commit fbff0ca6a88ba52ad8a1f7ad89705ef12570af66;
amended to change a
`page_load_timeout_fired || page_load_timeout_fired || ...` that gcc's
-Wlogical-op complainted about to `page_load_timeout_fired || ...`, see
also discussion on LadybirdBrowser/ladybird#1021)
2024-11-14 17:35:38 -05:00
Andrew Kaster
c7d4825b44 LibWeb: Prefix AK::Duration with AK Namespace
(cherry picked from commit b20a1d0fcddb999de372a49d213bec01bda24c10)
2024-11-14 17:35:38 -05:00
Ninad Sachania
d5dfe2bf07 Games/BrickGame: Bind Key_Z to rotate left 2024-11-14 01:39:04 +01:00
Nico Weber
5dbc8f8481 Meta: Add new WebGL source files to GN build as well
LadybirdBrowser/ladybird#2308 updated idl_files.gni,
but not the actual build file.
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
b67c8d138c LibWeb: Add WebGLShaderPrecisionFormat
(cherry picked from commit 3d8ab0e67c707062e4d889598fbd176fa0c6fce8)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
b288bfd994 LibWeb: Add WebGLActiveInfo
(cherry picked from commit d63a979bde54ad93422c2fadb5cf24cbc3339e07)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
59ed552646 LibWeb: Add WebGLUniformLocation
(cherry picked from commit 889e7942fa090a240743d3b53ab2bc5288e064c3)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
1097eaf38b LibWeb: Add WebGLTexture
(cherry picked from commit f2a164365007ad5e06f3ce47702ded55c42fbcb6)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
e41789f5f9 LibWeb: Add WebGLShader
(cherry picked from commit 2b09afb971059f22a0eb82661262954211b694b9)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
e64cf9633d LibWeb: Add WebGLRenderbuffer
(cherry picked from commit d53cb9833b274658c1ec1b6c1813cfb466470bdb)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
8e05ba45d0 LibWeb: Add WebGLProgram
(cherry picked from commit 6b7d5dbec6a9daf1033ee2e8c4c48037ccd35360)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
88ce676d20 LibWeb: Add WebGLFramebuffer
(cherry picked from commit 5d0b206d6ec9c3a5284ee6db7452b21a6cf6c7cd)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
4e9c64c37f LibWeb: Add WebGLBuffer
(cherry picked from commit b21857b26587a1108325ba7d1e7c69986d3ddaa3)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
1e0b742903 LibWeb: Add WebGLObject interface
(cherry picked from commit e6ee7f3e642acd548b3ae96c47f7174ceb98f730)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
4fac3ca69b LibWeb: Add missing RGBA8 constant to WebGLRenderingContext
(cherry picked from commit e8d91f22340217968363498d8ccdedda9e21c2a5)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
e87b17b0e0 LibWeb: Add stubbed Media Source Extensions API
Just the boilerplate :^)

(cherry picked from commit 35043702813117d22e841e1b1d887d1726d4ed2d;
amended to fix conflict in idl_files.gni due to ladybird being worse
than serenity at having that file sorted alphabetically)
2024-11-13 19:32:14 -05:00
Jelle Raaijmakers
15581f8acc LibGfx: Remove unused include from Line
(cherry picked from commit 3e3851983dacee378f787f108a7ced68fa87a013)
2024-11-13 19:32:14 -05:00
Timothy Flynn
ba539d6b09 LibWeb: Guard MediaQueryList event listener removal against null
A recently imported WPT test has a subtest that effectively does the
following:

    const mql = window.matchMedia("");
    mql.removeListener(null);

(cherry picked from commit 3e5476c9e09055104fc64d294da39aa1bfccac09)
2024-11-13 19:32:02 -05:00
Timothy Flynn
0a9c220068 LibWeb: Use GCPtr in MediaQueryList
(cherry picked from commit 213155ad7d2cc32271bebce7fecdb35d1e286f22)
2024-11-13 19:32:02 -05:00
Luke Wilde
c1767b1964 LibWeb: Make iframe insertion steps check the shadow including root
The insertion steps for iframes were following an old version of the
spec, where it was checking if the iframe was "in a document tree",
which doesn't cross shadow root boundaries. The spec has since been
updated to check the shadow including root instead.

This is now needed for Cloudflare Turnstile iframe widgets to appear,
as they are now inserted into a shadow root.

(cherry picked from commit 4dd14d812f73377cb1efa5a8e8a114912a90b5af)
2024-11-13 19:32:02 -05:00
Luke Wilde
dd6ede831d LibWeb: Actually traverse the shadow root of the inclusive descendant
Previously, the inclusive descendant, which is the node that
for_each_shadow_including_inclusive_descendant was called on, would not
have it's shadow root traversed if it had one.

This is because the shadow root traversal was in the `for` loop, which
begins with the node's first child. The fix here is to move the shadow
root traversal outside of the loop, and check if the current node is an
element instead.

(cherry picked from commit 6df4e5f5e75d7d6d439d1365ed7bed4fd2a8a1da)
2024-11-13 19:32:02 -05:00
Shannon Booth
224483b941 LibWeb: Add temp execution context for resolving promise in AudioContext
Fixes a crash seen on twitter.com, namely from the 'resume' function.

(cherry picked from commit 5d7a7a43c40f2413f6936ddd69794f8550172e09)
2024-11-13 19:32:02 -05:00
Jelle Raaijmakers
ec6803eb44 LibWeb: Implement pending promises in BaseAudioContext
Move the pending promises list from AudioContext to BaseAudioContext and
deal with all remaining FIXMEs.

(cherry picked from commit 2df3488840ccf8e8c560bde4826897c2023dbe29)
2024-11-13 19:32:02 -05:00
Ninad Sachania
27b8bb7969 Ports: Add lolcat 2024-11-13 12:21:05 -05:00
Andreas Kling
bff196be31 LibWeb: Avoid unnecessary style recomputation during traversal
While traversing the DOM tree, looking for nodes that need a style
update, we were recomputing style for every node visited along the way,
even nodes that didn't themselves need a style update (but one of their
descendants did).

This avoids a bunch of completely unnecessary style recomputation on
basically every website.

(cherry picked from commit 5431db8c1c9d366d0a27959cfbf0f146bf4be20d)
2024-11-13 10:17:34 -05:00
Shannon Booth
7dc49c9038 LibJS: Align ShadowRealmConstructor closer with latest spec
The current shadow realm constructor implementation was based off a
merge request to the shadow realm proposal for integration into the
web platform. However, this merge request had a bug which we had
applied a workaround for by popping off the execution stack.

Since then, the spec has had an update of:

https://github.com/tc39/proposal-shadowrealm/commit/28b0cc

Which closer aligned the mainline spec to the proposed merge request.

Now, the original shadow realm proposal merge request has been closed
and a new one has been reopened with a much more minimal set of changes
that merely adds extra arguments to HostInitializeShadowRealm, which
this commit aligns with.

(cherry picked from commit 424a0cda936e018a9881f3e5898beb79d2212caa)
2024-11-13 10:17:34 -05:00
Shannon Booth
6f48342e3f LibJS: Update ShadowRealm to not hold an ExecutionContext
Noone needs to use this any more :^)

This is somewhat AD-HOC in the constructor as it is based on an open
shadow realm merge request, but applies the intent of the change without
any change in behaviour.

(cherry picked from commit b927d7f65870c94d0c7ead3f6bdd8e6f6f0ac887)
2024-11-13 10:17:34 -05:00
Shannon Booth
2fedb5a87e LibJS: Use GetShadowRealmContext for PerformShadowRealmEval
(cherry picked from commit 3cb62265ab203d652a3fffab431f842fc46d375c)
2024-11-13 10:17:34 -05:00
Shannon Booth
93732e2ca3 LibJS: Use GetShadowRealmContext for ShadowRealmImportValue
Removing one user of the ExecutionContext slot of ShadowRealm.

(cherry picked from commit 6a55865bf61ba0ad8aebd1b72ea0be82d849600d)
2024-11-13 10:17:34 -05:00
Shannon Booth
b0ac3039f2 LibJS: Implement ShadowRealm AO GetShadowRealmContext
This is a new AO introduced in the spec which allows the
[[ExecutionContext]] slot of the ShadowRealm object to be removed.

(cherry picked from commit 3f24008b31d36c41c3bb841312914019073fac33)
2024-11-13 10:17:34 -05:00
Shannon Booth
5ce612166f LibJS: Update HostEnsureCanCompileStrings arguments to latest spec
(cherry picked from commit c1998f96c29f04cdad822e14867c3a7ffb6cf4b3)
2024-11-13 10:17:34 -05:00
Shannon Booth
10f2c11f3b LibJS: Update CreateDynamicFunction to latest spec
The use of extract_parameter_arguments_and_body() here is to make things
a little less awkward. If we were to exactly follow spec there would be
an awkward handling of the case that no arguments were provided and we
needed to provide an empty string.

To do this, we would need to either:
  - Provide an Optional<Value> for bodyString to CreateDynamicFunction
  - Create a new empty PrimitiveString wrapped in a JS Value.

Either case is somewhat awkward. Instead, just refactor this logic
outside of CreateDynamicFunction and make the caller do it.

Otherwise, this commit prepares for the new definition of
HostEnsureCanCompileStrings.

(cherry picked from commit 6da0ac3aa71c991e18e96d721b1843c417cdab78)
2024-11-13 10:17:34 -05:00
Pavel Shliak
df40a0cf2c LibAudio: Initialize GainNode properly
That helps to pass WPT tests
under /webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html

(cherry picked from commit 4998385c7aeae21939f4ea24bb4f8c6eb477840b)
2024-11-13 10:17:34 -05:00
Pavel Shliak
209df06ab7 LibJS: Add calendar id getter to ZonedDateTimePrototype
(cherry picked from commit ba71cb1ca43738096a1c93ea02904e7eaa4012dd)
2024-11-13 10:17:34 -05:00
Pavel Shliak
404b965b2e LibJS: Add calendar id getter to PlainMonthDayPrototype
(cherry picked from commit 2ad48b64caaed0e1b4bec6819d71a20a2a184bad)
2024-11-13 10:17:34 -05:00