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)
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)
Now that the global object correctly sets the property, we don't need
to do it here.
(cherry picked from commit 711faa8280ac4147f68ed778ad67047428329c67)
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)
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)
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)
Previously, the conversion assumed that the supplied timeout was in
seconds rather than milliseconds.
(cherry picked from commit b688b5d9d4cfd8f781dd05d522d9533cd6796aca)
(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)
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)
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)
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)
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)
Move the pending promises list from AudioContext to BaseAudioContext and
deal with all remaining FIXMEs.
(cherry picked from commit 2df3488840ccf8e8c560bde4826897c2023dbe29)
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)
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)
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)
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)
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)
That helps to pass WPT tests
under /webaudio/the-audio-api/the-gainnode-interface/ctor-gain.html
(cherry picked from commit 4998385c7aeae21939f4ea24bb4f8c6eb477840b)