Implements the cite attribute of `q`, `blockqoute`, `ins` and `del`
elements according to spec by returning a valid URL.
(cherry picked from commit 74645facae366d62ee4c44bd4a96d02df345a5d4)
...Including a couple of steps in
obtain_a_browsing_context_to_use_for_a_navigation_response() which
didn't have FIXMEs.
No apparent changes on WPT.
(cherry picked from commit 310cdc35f05946be15cb16ccc2f32e4f1e43efe3)
The spec does not define activation behavior of ctrl/cmd clicks, so we
have to go a bit ad-hoc here. When an anchor element is clicked with the
cmd (on macOS) or ctrl (on other platforms) modifier pressed, we will
skip activation of that element and pass the event on to the chrome. We
still dispatch the event to allow scripts to cancel the event.
(cherry picked from commit 40b2d24d5585a94f09f521bb0ceb055dcae7b6e9)
(cherry picked from commit 12f177e9e94ca71c619ec1171078e8635debde09;
amended to remove mention of ICU in commit message, and to resolve
a minor conflict in CharacterData.h due to serenity cherry-picking
LadybirdBrowser/ladybird#901 before this change)
Previously, the list was copied when constructing the FormData object,
then the original list was passed to the event, meaning any changes to
the list that happened within the event would not be reflected outside
of it.
(cherry picked from commit ea0e434d1d6b464ab0a56c4b7150950be78ae7d3)
Previously, attempting to parse a floating point number with an integer
part larger than `(2 ^ 31) - 1` would cause the browser to crash. We now
avoid this by converting the integer part of the number to a `double`
rather than an `i32`.
(cherry picked from commit 21a32e4b6dc594c2fe8dd3ee11c829c250a103ad)
The spec says that "isTrusted is a convenience that indicates whether
an event is dispatched by the user agent (as opposed to using
dispatchEvent())"
But when dispatching a pageshow event the flag was incorrectly set
to false.
This fixes https://wpt.fyi/results/html/syntax/parsing/the-end.html
(cherry picked from commit d2fbbabd893d84a6b8b68a8bc8034e4d6dc4da4a)
Removed the custom getter and updated the idl so that the attribute
is Reflected and Enumerated.
(cherry picked from commit 68924827551fc3169c1b9b59c0d7e8bc999a390c)
This fixes WPT html/semantics/forms/resetting-a-form/reset-form.html.
I added a test based on the WPT test, but simpler.
(cherry picked from commit caf74e7ed69c6f64fc2f770d03fe61bc60cdc08b)
Partially reverting a3149c1ce9
Spinning the event loop was causing a crash on:
https://wpt.live/url/percent-encoding.window.html
As it was turning what is meant to be a synchronous operation into an
asynchronous one.
The sequence demonstrated by the reproducing test is as follows:
* A src attribute is changed for the iframe
* process_the_iframe_attributes entered with valid content navigable
* Event loop is spun, allowing the queued iframe removal to execute
* process_the_iframe_attributes continues with null content navigable
* 💥
(cherry picked from commit 30377e6e3500049c5442fac9d242d3b795861116)
Fixes at least one WPT test that was previously timing out:
- html/semantics/document-metadata/the-base-element/base_target_does_not_affect_iframe_src_navigation.html
(cherry picked from commit 0b403d30d765ab8e5db3b7443ebeca7f85c3acf2)
Some callers (namely WebDriver) will need access to the navigable opened
by these steps. But if the noopener parameter is set, the returned proxy
will always be null.
This splits some of the Window open steps into an internal method that
returns the chosen navigable.
(cherry picked from commit 981aaba96cd6ee752d9cf76595731612898fe05c)
Before this change, we transferred the input element's line-height to
both the editable text *and* the placeholder. This caused some strange
doubling of the effective line-height when the editable text was empty,
pushing down the placeholder.
(cherry picked from commit 13ba491924c4fc3831d5a8986673d832a721f545;
amended some slighly different horizontal sizes in the expectations
file. Maybe due to serenity not using harfbuzz for shaping, or due
to not have another earlier change yet. If it's the latter, this will
fix itself when that's brought in.)
There was no need to use FlyString for error messages, and it just
caused a bunch of churn since these strings typically only existed
during the lifetime of the error.
(cherry picked from commit 175f3febb8037a440d4ead7347d3266ee3d345e1;
minorly amended to fix conflict in WebSocket.cpp due to serenity
not having the adapter class removal in LadybirdBrowser/ladybird#1671)
Because of the previous awkward factoring of Origin we had two
implementations of Origin serializing and creation. Move the
implementation of DOMURL::url_origin into URL::origin, and
instead use the implemenation of URL::Origin::serialize for
serialization (replacing URL::serialize_origin).
This happens to fix 8 URL subtests as the two implemenations had
diverged, and URL::serialize_origin was previously missing the spec
changes of: whatwg/url@eee49fd and whatwg/url@fff33c3
(cherry picked from commit 501f92b54eee7bcf7b60621aa4238fcbdc610d99;
amended to add leading whitespace to expectation due to serenity not
yet having LadybirdBrowser/ladybird#1603)
This is also in an effort towards resolving a future circular dependency
between Origin.h and URL.h
(cherry picked from commit 43973f2d0a32aedf4405f246b5f2806f61016384;
amended to fix tiny include conflict in Document.cpp)
While Origin is defined in the HTML spec - this leaves us with quite an
awkward relationship as the URL spec makes use of AO's from what is
defined in the HTML spec.
To simplify this factoring, relocate Origin into LibURL.
(cherry picked from commit dc401f49ea7e861064484e79594e35c3d93000ae;
amended to fix minor conflicts due to serenity not (yet?) having a
LibUnicode/Segmenter.h include in Document.cpp, and due to
BrowsingContext already having LadybirdBrowser/ladybird#2358 in
serenity)
Web specs do not return through javascript percent decoded URL path
components - but we were doing this in a number of places due to the
default behaviour of URL::serialize_path.
Since percent encoded URL paths may not contain valid UTF-8 - this was
resulting in us crashing in these places.
For example - on an HTMLAnchorElement when retrieving the pathname for
the URL of:
http://ladybird.org/foo%C2%91%91
To fix this make the URL class only return the percent encoded
serialized path, matching the URL spec. When the decoded path is
required instead explicitly call URL::percent_decode.
This fixes a crash running WPT URL tests for the anchor element on:
https://wpt.live/url/a-element.html
(cherry picked from commit cc557323326ba55514ef2a8a6e0efd7f09330f06;
amended heavily to call `URL::percent_decode()` on all results of
`url.serialize_path()` in the rest of serenity -- except in
LibGemini, where it looked incorrect, and in LibHTTP, where
LadybirdBrowser/ladybird#983 will add it.)
Without this, a worker can be GC'd in a very simple script such as:
const worker = new Worker("script.js");
worker.onmessage = () => {};
Where script.js attempts to post a message back to the parent window.
When the Worker is GC'd, the IPC connection from the WebContent process
to the WebWorker process is closed. When this occurs, the WebWorker will
exit() from LibIPC, and any message from the worker to its parent does
not have a chance to run.
(cherry picked from commit eeee6ba3f54bc920e7cd493820faab943b59e0bd)
This largely reduces the number of files needed to be compiled when we
change the MessagePort header.
(cherry picked from commit 32a22c49e3e999e681e2d1de1ebabd092a7f9b47)
This removes a long-standing source of flakiness seen for example in
WPT's /referrer-policy/ tests.
(cherry picked from commit 063cd68bf472061ec35cf9b8970aa6e614632c9b)
These don't have to worry about the input not being valid UTF-8 and
so can be infallible (and can even return self if no changes needed.)
We use this instead of Infra::to_ascii_{upper,lower}_case in LibWeb.
(cherry picked from commit 073bcfd3866852a4c4bcca2bd131bd65ae53541f)
This is because toggling the checkbox is committing the value.
(cherry picked from commit 3856dd946b94b61be2ddac80c8cf60278fcc56ab;
amended to add spaces to expected output due to serenity not yet
having LadybirdBrowser/ladybird#1603, and to add a trailing newline
to the test input file)
This is very janky at the moment but it also more correct. :^)
(cherry picked from commit cd0e4a49b8a758aca847ceaf57eec0a62cd7b687;
amended to add a missing include of LibGfx/ImmutableBitmap.h to
SVGImageElement.h that ladybird seems to get transitively somehow)
Before this change we were serializing them in a bogus 8-digit hex color
format that isn't actually recognized by HTML.
This code will need more work when we start supporting color spaces
other than sRGB.
(cherry picked from commit 4590c081c2eb257232463ed660498a02f9bbe7b8;
amended expected output because serenity does not yet have
LadybirdBrowser/ladybird#1603)
The spec expects `postMessage()` to act as if it is invoked
immediately. Since `postMessage()` isn't actually invoked immediately,
keep tasks with source `PostedMessage` in the task queue, so that these
tasks are processed. Fixes a hang when `WorkerGlobalScope.close()` is
called immediately after `postMessage()`.
(cherry picked from commit fd8d350b4756817598ee49a11b9efc3b953dbb00)
The MessagePort one in particular is required by Cloudflare Turnstile,
as the method it takes to run JS in a worker is to `eval` the contents
of `MessageEvent.data`. However, it will only do this if
`MessageEvent.isTrusted` is true, `MessageEvent.origin` is the empty
string and `MessageEvent.source` is `null`.
The Window version is a quick fix whilst in the vicinity, as its
MessageEvent should also be trusted.
(cherry picked from commit 079c28d5e68ad983340c02f3d043acfdf2846d18)
This adapts to the latest HTML spec which fixed the issue we had
reported of:
https://github.com/whatwg/html/commit/316b83
(cherry picked from commit ab309dcc586f15cb7d11d79e7eb916652edf5b60)
The overload resolution is no longer an issue, and we already had this
implemented :^)
(cherry picked from commit 2c5cfbb968113a5630a8cd580bb100852aadeb95)