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)
Unfortunately the added test (which passes locally) is skipped as it is
based off other Worker tests which are also skipped due to being flakey
in CI.
(cherry picked from commit 755b63132b72cb25bd358415bf2fdf2be3c14c47)
Now we can register jobs and they will be executed on the event loop
"later". This doesn't feel like the right place to execute them, but
the spec needs some updates in this regard anyway.
(cherry picked from commit 29416befe640eae7bf44b72e3f4ad42a1e397701)
Instead of asking "do you have an entry not in this Vector", let's ask
"do you have an entry not in this HashTable".
(cherry picked from commit 861d46be3e69aeb1ca4a9e75029b4ce653bbcf47)
The spec didn't match how other browsers behave, and we dutifully did
what the spec said. A spec bug has been filed, so let's fix this locally
for now with a FIXME.
(cherry picked from commit e3408c4a7f2fe2ce2435d34e816e9b5b7e58f4af)
This is mostly the fun boilerplate. Actually creating the Job queue
to do the heavy lifting is next.
(cherry picked from commit c77d9a2732b9325079bca713e4c97d75a0f6a54d)
This matches the text of the spec a little more closely in many cases
and is also more efficient than serializing the URL path.
(cherry picked from commit ffe070d7f9164ff51644f8d912b580a0b291e26a)
Looking at the spec it doesn't seem like there's a chance for a service
worker client to be an environment but not an environment settings
object. In the case that that changes in the implementation, we can
move it.
(cherry picked from commit 237bcbff360d5000ab45da2ca63f196064ab5210)
The code previously ensured that JS/CSS tokens did not share values with
the HTML tokens, but still let them share values with each other. The
numbers chosen (1000 and 2000) are somewhat arbitrary, but give us
plenty of room to avoid overlaps.
(cherry picked from commit 07f0d9209a49fa349ce3763dd7ab8835b78edf85)
This will be used by the inspector, for showing style sheet contents.
Identifying a specific style sheet is a bit tricky. Depending on where
it came from, a style sheet may have a URL, it might be associated with
a DOM element, both, or neither. This varied information is wrapped in
a new StyleSheetIdentifier struct.
(cherry picked from commit 51a426cc0562d12a6e8f7d1d1a38f9ecac77072a)
The spec text had changed for the value of `<link>`'s location, so I've
updated that.
(cherry picked from commit 4e18fce3a586651894844c7ef0a06c774ce9eb2c)
I originally believed that this could never receive a null URL and the
spec was inaccurate, but it seems like it can indeed.
I don't have a distilled test, but this makes logging in with GitHub
work on https://v0.dev/
(cherry picked from commit 1a4b0ded1f802fdcc3ef9b919b5749b086471fc2;
amended to also cherry-pick LadybirdBrowser/ladybird#2358)
When we check whether navigationParams is null, we should check if it is
`NullWithError`, since `NullWithError` is equivalent to `Empty`, but is
used for error messages.
(cherry picked from commit 219cb04865fc02bfc05d39f048dd2a778714b7e1)
Now that the global object correctly sets the property, we don't need
to do it here.
(cherry picked from commit 711faa8280ac4147f68ed778ad67047428329c67)
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)
This would previously crash because it depended on a specific order for
evaluating function arguments, which is undefined.
(cherry picked from commit 27b1d94e04386fd46c2c9148b9555c841595e2d3)