Implements the cite attribute of `q`, `blockqoute`, `ins` and `del`
elements according to spec by returning a valid URL.
(cherry picked from commit 74645facae366d62ee4c44bd4a96d02df345a5d4)
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)
This seems to have vanished from the spec, but in any case, we still
need it. Without this change we erroneously thought that calculations
that match <percentage> did not match <number-percentage>.
(cherry picked from commit 760943d584587899d2ba0390cad20797001e1b96)
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 a rendering issue on https://prodengi.kz/ that someone on
Discord reported. :^)
(cherry picked from commit 0b775da7c72a85c099f35d8caf2e7b66721a4483)
Always create a new formatting context for <math> elements. Previously
that didn't happen if they only had inline children, e.g. mtable.
This fixes a crash in the WPT MathML test
mathml/crashtests/children-with-negative-block-sizes.html
(cherry picked from commit e7c209820d29cb422668ac0b142d030080aa7767)
Fixes two WPT tests:
document.getElementsByName-namespace-xhtml.xhtml and
document.getElementsByName-namespace.html
(cherry picked from commit 917a2a3c8625b1d78d3f8d597f32a304d5996740)
Previously Selection.extend() used only the relative node order to decide which
direction to extend the selection. This leads to incorrect behaviour if
both the existing and new boundary points are within the same DOM node
and the selection direction is reversed.
This change fixes all the failing subtests in the WPT extend-* test
suites.
(cherry picked from commit 18ade57ae96da05c845582ab03b588c55c1e6633)
The "isCollapsed" attribute on a selection must "return true if and only
if the anchor and focus are the same".
In addition to checking that the anchor and focus belonged to the same
DOM node, we now also check that they refer to the same position within
the node.
With this change Ladybird passes all the subtests in the "isCollapsed"
WPT suite.
https://wpt.live/selection/isCollapsed.html
(cherry picked from commit fadb14d31d0d3127e80121ac695fe839908efaa1)
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)
For example, in the following abbreviated test HTML:
<span>some text</span>
<script>println("whf")</script>
We would have to craft the expectation file to include the "some text"
segment, usually with some leading whitespace. This is a bit annoying,
and makes it difficult to manually craft expectation files.
So instead of comparing the expectation against the entire DOM inner
text, we now send the inner text of just the <pre> element containing
the test output when we invoke `internals.signalTextTestIsDone`.
(cherry picked from commit bf668696de9a68bbcd6adfeaac809a475da015dc;
amended a bit but not as much as one might think -- see PR for details)
The events tested here are decidedly async. We also can't really write
sync tests of the form "test(async () => {})". Nothing will await the
async callback.
(cherry picked from commit c9cbaeb59d6f699b33bf3924688987b3ca917fee)
These tests were mostly async tests written in a manual way. This ports
them to use the standard asyncTest() infrastructure.
This is mostly just to reduce calls to internals.signalTextTestIsDone,
which will have a required parameter in an upcoming test.
(cherry picked from commit 96082d6ae127832eb9b644d2abee892284317b6a)
Attributes have a max value length of 1024. So we theoretically need to
support values in the range -${"9".repeat(1023)} to ${"9".repeat(1024)}.
These obviously do not fit in an i64, so we were previously failing to
parse the attribute.
We will now cap the parsed value to the numeric limits of an i64, after
ensuring that the attribute value is indeed a number.
(cherry picked from commit ba1189cd1c47ab0593e0c3d7eee85e7aafc3462d)
We currently implement the official cookie RFC, which was last updated
in 2011. Unfortunately, web reality conflicts with the RFC. For example,
all of the major browsers allow nameless cookies, which the RFC forbids.
There has since been draft versions of the RFC published to address such
issues. This patch implements the latest draft.
Major differences include:
* Allowing nameless or valueless (but not both) cookies
* Formal cookie length limits
* Formal same-site rules (not fully implemented here)
* More rules around cookie domains
(cherry picked from commit fce003a8f581a49d1c6e6472e33b8250052530db)
This implementation is incomplete in that we do not fully implement the
steps to match the given font against the fonts in the set.
This is used by fonts.google.com to load the fonts used for sample text.
(cherry picked from commit 9bdf2e928c448585a6349bef36d7cb98ccc0607b)
This misses the final, most important part of actually creating a
service worker object and sending the script over to it in a WebWorker
process.
(cherry picked from commit 85541f1e763f2db63a235f57a29026331138a29e)
CSSStyleDeclaration has an indexed property getter, which returns
properties associated with the object in the order they were specified
in.
(cherry picked from commit a94282e0e8dd344bcf94c1d098378bd46151ce47)
The CSSOM spec tells us to potentially add up to three different IDL
attributes to CSSStyleDeclaration for every CSS property we support:
- A camelCased attribute, where a dash indicates the next character
should be uppercase
- A camelCased attribute for every -webkit- prefixed property, with the
first letter always being lowercase
- A dashed-attribute for every property with a dash in it.
Additionally, every attribute must have the CEReactions and
LegacyNullToEmptyString extended attributes specified on it.
Since we specify every property we support with Properties.json, we can
use that file to generate the IDL file and it's implementation.
We import it from the Build directory with the help of multiple import
base paths. Then, we add it to CSSStyleDeclaration via the mixin
functionality and inheriting the generated class in
CSSStyleDeclaration.
(cherry picked from commit aacf9b08ed8c4286c84145b52fa70f399ed0bdff;
amended to fix tiny conflict in libweb_generators.cmake, and to change
the default value of all gap-related properties from 'auto' to 'normal'
since serenity does not yet have LadybirdBrowser/ladybird#2253 and
cherry-picking that has a pretty long dependency tree. It's easy to
update the test once that is cherry-picked)
Without this, it would return "(invalid CSS::PropertyID)" when
requesting item(decl.length).
(cherry picked from commit 5aacb053a3fa0cf0e2a825c63dd3a4ebd916eda4)
It is not treated as the same thing in the specification, or by us in
other places too. This fixes 8 more origin related URL tests on WPT.
(cherry picked from commit 088b659abd123e0462bca7a6a9b534c0d89c668a;
amended to add leading whitespace to expectation due to serenity not
yet having LadybirdBrowser/ladybird#1603)
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)
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.)
This removes a long-standing source of flakiness seen for example in
WPT's /referrer-policy/ tests.
(cherry picked from commit 063cd68bf472061ec35cf9b8970aa6e614632c9b)
This is required by mini Cloudflare invisible challenges, as it will
only run if the readyState is not "loading". If it is "loading", then
it waits for readystatechange to check that it's not "loading" anymore.
Initial about:blank iframes do not go through the full navigation and
thus don't go through HTMLParser::the_end, which sets the ready state
to something other than "loading". Therefore, the challenge would never
run, as readyState would never change.
Seen on https://discord.com/login
(cherry picked from commit f638f84185938c74a47f5691e8d7c5e1d4dca07c)
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)
Otherwise, `margin: var(--foo) var(--bar)` would be wrongly serialized
as `margin: var(--foo)var(--bar)`
(cherry picked from commit 6e68e8f3c9d74893e46ab0514169b950866457b4)
While updating the parser to the latest spec algorithms, this started
parsing incorrectly as a declaration, and we had no tests covering it.
(cherry picked from commit 9241f37823f227ae94461a494c6f7ab4b6cd0e4e)