Let's make SystemServer simpler by not involving it with the basic
system initialization sequence.
That initialization sequence can be done in another program that
theoretically can be put in another filesystem.
Co-authored-by: Tim Schumacher <timschumi@gmx.de>
If the user only wants to get the byte count of a set of files, then for
each file we can simply seek it to get the byte count instead of
iterating over all the bytes.
Both Element's and ShadowRoot's setHTMLUnsafe, and Document's static
parseHTMLUnsafe methods are implemented.
(cherry picked from commit ce8d3d17c4f2fcca8fac0ff4a832c8f50a011fc7)
Dialog elements now correctly establish a close watcher when
shown modally.
This means modal dialogs now correctly close with an escape key press.
(cherry picked from commit d86a6e1bec858a35935ba6839c154ba2482d33e6)
No other browser allows opening the select element dropdown with the
select.click() function.
This change stops this happening in Ladybird.
(cherry picked from commit 564e546ff0bd78cc7ba770b53377457bf1ef88d6)
Similarly to OpenBSD nc, an option to just connect without transmitting
any actual data is added.
However, we don't allow UDP-mode when testing a remote service, as it
will always succeed and has no technical meaning for the user if they're
not able to view the traffic on the remote machine.
Adds the showPicker() function for select elements.
This doesn't do the check for "being rendered" which is in the spec.
(cherry picked from commit 5098ed6b1f881659dbdab10c74a0e17b362ce7a8)
This implements most of the CloseWatcher API from the html spec.
AbortSignal support is unimplemented.
Integration with dialogs and popovers is also unimplemented.
(cherry picked from commit b216046234560df531e1a32269e5dfa18f8f240c,
manually amended to replace a single `UIEvents::KeyCode::Key_Escape`
with `KeyCode::Key_Escape` in EventHandler.cpp since we don't have
the second commit of https://github.com/LadybirdBrowser/ladybird/pull/86)
Multiple APIs have moved from the DOM Parsing and Serialization spec to
HTML.
Updates spec URLs and comments.
Delete InnerHTML file:
- Make parse_fragment a member of Element, matching serialize_fragment
on Node.
- Move inner_html_setter inline into Element and ShadowRoot as per the
spec.
Add FIXME to Range.idl for Trusted Types createContextualFragment
(cherry picked from commit 9171c3518358cd2d146ffbd7582e4c1247a1daa7)
Previously, no event was fired on middle click. This change also allows
the UI to open a link in a new tab on middle click.
(cherry picked from commit 31d7fa244232c2a2239dbf6017ba9e3dd191ec2e)
This simulates click of the middle mouse button, which is necessary for
testing whether the `auxevent` fires correctly.
(cherry picked from commit 728fca1b1ffd8b472bc8524e5e8ec8443de011a5)
...and shadow tree with TextNode for "value" attribute is created.
This means InlineFormattingContext is used, and button's text now
respects CSS text-decoration properties and unicode-ranges.
(cherry picked from commit 8feaecd5c8d02a2fdb989a9a9671e008d1c3a7de)
Apple Clang doesn't like this, rather than waiting for their version of
random-clang-commit-to-call-a-release to catch up with llvm trunk, just
work around the issue.
Fixes#186.
(cherry picked from commit 8c9d3b30cf62016ffb03e425f1e7e3f2461262bf)
This fixes https://html5test.com/ as previously an exception was being
thrown after trying to access this attribute which would then result in
a popup about the test failing (and none of the test results being
shown).
(cherry picked from commit e0bbbc729b6aad04ceff5f67c3e2868b65970047,
manually amended with the output of `git clang-format master`)
Now that EasingStyleValue is a lot nicer to use, there isn't much reason
to keep TimingFunction around.
(cherry picked from commit 7950992fc21e2428a7f32954bbe893a2b2d58cf7,
manually amended with the output of `git clang-format master`)
The values aren't that complex, so it doesn't make much sense to have a
dedicated generator for them. Parsing them manually also allows us to
have much more control over the produced values, so as a result of this
change, EasingStyleValue becomes much more ergonomic.
(cherry picked from commit 667e313731f06fabf2a3f75893c3e8f15a4172be,
manually amended with the output of `git clang-format master`)
This fixes an issue where entering EXAMPLE.COM into the URL bar in the
browser would fail to load as expected.
(cherry picked from commit 1a4b042664f8fddbfa70f009c5873b1f8575bf0b)
Previously, part of the procedure we used to sanitize URLs entered via
the command line would check the host against the public suffix
database. This led to some valid, but not publicly accessible URLs
being treated as invalid.
(cherry picked from commit e9f34c7bd1e72da9a57a721d4ad501e8208cc986)
The Encoding specification maps ISO-8859-1 to windows-1252 and expects
the windows-1252 translation table to be used, which differs from
ISO-8859-1 for 0x80-0x9F.
Other contexts expect to get the actual ISO-8859-1 encoding, with 1-to-1
mapping to U+0000-U+00FF, when requesting it.
`decoder_for_exact_name` is introduced, which skips the mapping from
aliases to the encoding name done by `get_standardized_encoding`.
(cherry picked from commit 6b2c4599017f512279cb26c0d3c48aa5a9453007)
They are now blocked on pages which:
- Don't have an opaque origin (should be only user-initiated or about:)
- Aren't other file: pages
- Aren't other resource: pages
(cherry picked from commit 1f3285eb0410ff5c902e148932205d9e4b7fbd9b)
Implements enough of HTMLImageElement::decode for it to not break
websites and actually load an image :)
(cherry picked from commit 862fc91b2cf9bee9b7f180cdf930c6c99b5dd053)
Let's log which property we're trying to look up, since that's the most
interesting part!
(cherry picked from commit f7a83e57554c7a98cda165ea1fa18356a6ee54d9)
To make this straightforward, CSSKeyframesRule now uses a CSSRuleList
for internal storage.
(cherry picked from commit 7f2c833a39e150c7372299dcfe4d2d5590ae779f)
This readonly attribute returns the containing CSS rule, or null (in the
case of element inline style).
(cherry picked from commit a12d28fd3053638ce6f4215bed2d8d45cda86375)
The data segment offset should be checked _before_ checking if the
contents of the segment are non-existent.
(cherry picked from commit 78c56d80f90f913e4cbc14c865af308c6af9aeae)
Previously, navigating to or from `about:newtab` caused a crash due to
inadvertent null dereferences when checking whether a request or
response to a request should be blocked as mixed content.
(cherry picked from commit 572ebe00eacd5aaeecc17207c75c6bf2327a3897)
If the Document's navigable has been destroyed since we started this
timer, or it's no longer the active document of its navigable, we
shouldn't navigate to it.
(cherry picked from commit 7b67fa706fd2dabfda3c72a752ac70d8c95bb060;
amended commit message to say "LibWeb:" instead of "DOM:")
This implements a stub ElementInternals object which implements the
shadowRoot getter only.
Also implement attachInternals function.
(cherry picked from commit a65f1ecc375fa02deeab5d0e7ab4702972ffa72e)
This change solves a crash where it was possible that the
"Color Masking" could try to access pixel coordinates that where beyond
the boundaries of the image.
Methods and attributes marked with [FIXME] are now implemented as
direct properties with the value `undefined` and are marked with the
[[Unimplemented]] attribute. This allows accesses to these properties
to be reported, while having no other side-effects.
This fixes an issue where [FIXME] methods broke feature detection on
some sites.
(cherry picked from commit 2f5cf8ac204a58dc2a6f722dd95015c6c2fb7a78)
Properties marked with the [[Unimplemented]] attribute behave as normal
but invoke the `VM::on_unimplemented_property_access callback` when
they are accessed.
(cherry picked from commit 88d425f32b3b49d5dfa8d86e6e4e2c263cd450d4)
If a flex item has a preferred aspect ratio and the flex basis is not
definite, we were falling back to using stretch-fit for the main size,
since that appeared to match other browsers.
However, we missed the case where we actually have a definite cross size
through which the preferred aspect ratio can be naturally resolved.
(cherry picked from commit db1faef786dbd1722bbe6a1f4a5616f3069bdb6a)
This was made redundant in GH-12971 (SerenityOS), and removing it drops
a FIXME :^)
See:
- https://github.com/SerenityOS/serenity/pull/12971
(cherry picked from commit be08abbf8a0a62ae46275c3133f711c27b2efa02)
This stuff has moved from a mixin defined by the DOM Parsing spec, over
to the HTML spec, where they are now defined as partial interfaces for
Element and ShadowRoot.
There's also some new functionality that we don't implement yet, so
patch marks them as FIXME properties.
(cherry picked from commit 0c47b3ff971437c4bd3923134d26ad086b5f6a75)
And let the old shadow_root(), which was only supposed to be used by
bindings, be called shadow_root_for_bindings() instead.
This makes it much easier to read DOM code, and we don't have to worry
about when to use shadow_root_internal() or why.
(cherry picked from commit f4bdf562127c12a7af18029777a88d4260af82d3)
We now honor the shadowrootmode attribute on template elements while
parsing, and instantiate a shadow tree as required by the spec.
(cherry picked from commit 9eb4b91168145def5677cd41057d34ecf369372b)
The bulk of this function is moved to a new "attach a shadow root"
helper, designed to be used both from here and the HTML parser.
(cherry picked from commit 043ad0eb7644a529c1ffbd4de9a4b89771808c84,
and amended to make `is_valid_shadow_host_name()` static.
The expectation with these messages is that no other code is allowed to
run while we're waiting for the response to arrive.
Not meeting this requirement did not degrade any (observable)
functionality, however.
These were made invalid with P1787, and Clang (19) trunk started warning
on them with https://github.com/llvm/llvm-project/pull/80801.
(cherry picked from commit 397774d42272fff8dbc6d8d53616d79667d6608a)
The default implementation of die() causes the client process to simply
exit cleanly. This prevents any tests from recognizing that something
went wrong, as the process exits with a code of 0. With this patch, we
still just exit when the connection dies, but with a fatal signal. In
the future, we will want to launch a new RequestServer process and
re-establish client connections.
(cherry picked from commit d1ec32e28feee10c2c36f4cd0d496b8a95d375f8)
These can use an EnvironmentCoordinate for caching, just like normal
binding lookups. Saves a bunch of time for repeated typeof checks.
(cherry picked from commit 60a05ef414f804fe0c44d20fe13c795800826368)
This is actually safe everywhere but in the topmost program scope.
For web compatibility reasons, we have to flush all top-level bindings
to the environment, in case a subsequent separate <script> program
comes looking for them.
(cherry picked from commit 9d21d88374cf440ddf381e02a597a59ad329ed62)
Instead of displaying locals as "locN", we now show them as "name~N".
This makes it a lot easier to follow bytecode dumps, especially in
longer functions.
Note that we keep displaying the local index, to avoid confusion in case
there are multiple separate locals with the same name in one executable.
(cherry picked from commit 0aa8cb7dac60c88eac3bb7674e3fe575cf1da60b)
When resuming execution of a suspended function, we must not overwrite
any cached `this` value with something from the ExecutionContext.
This was causing an empty JS::Value to leak into the VM when resuming
an async arrow function, since the "this mode" for such functions is
lexical and thus ExecutionContext will have an empty `this`.
It became a problem due to the bytecode optimization where we allow
ourselves to assume that `this` remains cached after we've executed a
ResolveThisBinding in this (or the first) basic block of the executable.
Fixes https://github.com/LadybirdBrowser/ladybird/issues/138
(cherry picked from commit a91bb72dabe54849657720e36e19a3d3b737055f)
Instead, let's create a new class called AvailablePortDatabase that will
handle updating (from the Internet, by using our repository) of the list
and instantiating an object that could be used for querying.
This allows RS to start connections in parallel without actively waiting
for any possible handshakes.
Doing so gives us a nearly-3x speedup on the average connection latency.
Previously this just yielded the time slice, which blocked the event
loop until the other side read some data from the socket.
This "fixed" impl is still equally bad, but at least it doesn't block
the event loop.
These were showing up on profiles as quite hot (>5%), we can avoid all
the unnecessary assertions by doing them once in advance and using
pointers for the rest of the function.
This makes AES-GCM about 6% faster.
These options supplements the original threshold option, because it's
now possible to specify a threshold and add either minimum/maximum size
for additional filtering.
It's also possible to not use the old threshold option (that Tim
Schumacher told me it was inherited from coreutils) and only specify the
2 new options to create a filtering.
This reverts commit 59cb7994c6.
This change caused a bug where getImageData returned the image in
BGRA8888 format instead of RGBA8888.
(cherry picked from commit d2f9ba7db1d8dd1dd611e6a3f40b9125b5aa054d)
The big improvement included in this commit is stack height mismatch
validation. There are other minor improvements included (related to the
validation algorithm). The method of supporting stack polymorphism has
changed to be more like the spec, which was necessary for confidently
handling stack height mismatches.
See:
https://webassembly.github.io/spec/core/appendix/algorithm.html
(cherry picked from commit 9b58271f8b6de2dbfff416780a54e0322f9c6799)
Previously, the validator had a lot of extraneous information related to
frames. Now, there's just one stack with all the necessary information
derived from it.
(cherry picked from commit ad54b69de9df6ccd44178cbe49779e313f95f273)
Previously, `memory.fill` filled memory with 4-byte values, even though
`memory.fill` should fill with just one byte. Also fixes some other
issues with some of the bulk memory instructions, like `memory.init`.
(cherry picked from commit d8ee2e343df25d12637e08d54908b4fd86a22dc3)
We don't have asynchronous TCP socket implementation, so its usefulness
is a bit limited currently but we can still test it using memory
streams. Additionally, it serves as a temporary {show,test}case for the
asynchronous streams machinery.
With Ladybird now being its own repository, there's little reason
to keep the Ladybird Android port in the SerenityOS repository.
(The Qt port is useful to be able to test changes to LibWeb in lagom
so it'll stay around. Similar for the AppKit port, since getting
Qt on macOS is a bit annoying. But if the AppKit port is too much
pain to keep working, we should toss that too.
Eventually, the lagom browser ports should move out from Ladybird/
to Meta/Lagom/Contrib, but for now it might make sense to leave them
where they are to keep cherry-picks from ladybird easier.)
Updating these steps enables the writable side of a TransformStream to
raise the cancel callback when it's aborted.
(cherry picked from commit 6d7885e25036bf08e31f2ad7a13db31767deabaf)
This adds internal slots [[cancelAlgorithm]] and [[finishPromise]] to
TransformStreamDefaultController.
(cherry picked from commit ff5be1fd363c4cb9ba510679b1ee65a0c0b10bc2)
No longer just for response headers! The same type is obviously useful
and ergonomic when making requests as well.
(cherry picked from commit 260c5c50ad19f19d0d4c30984e512f56c055ecff)
Updated various SerenityOS components to make it build.
Before we had HTTP::HeaderMap (which preserves multiple headers with the
same name), we collected multiple "Set-Cookie" headers and bundled them
together as a JSON array.
This was a huge hack, and now we can stop doing that, since LibWeb gets
access to the full set of headers now.
(cherry picked from commit 5ac093885922246529a467054888e598f8832450)
Instead of using a HashMap<ByteString, ByteString, CaseInsensitive...>
everywhere, we now encapsulate this in a class.
Even better, the new class also allows keeping track of multiple headers
with the same name! This will make it possible for HTTP responses to
actually retain all their headers on the perilous journey from
RequestServer to LibWeb.
(cherry picked from commit e636851481eabdf00953573a5eb459ee52feeacc)
Updated various SerenityOS components to make it build.
Fetch: Make sure we iterate over HeaderMap's headers()
This fixes a build failure when built with CMake option
'-DENABLE_ALL_THE_DEBUG_MACROS=ON'.
(cherry picked from commit c51d01bea712d75f9b2cd700be942935044e49b4)
This supports opacity via the standard method of painting stacking
context to a new bitmap, then blitting it back when popping the stacking
context.
One extra complication is we have to ensure clipping is flushed between
any change of the target bitmap. But other than that is all standard.
This adds two paths for clipping. If the clip rect is known to be
rectangular (and axis-aligned), then normal/fast painter clipping is
used. Otherwise, a temporary buffer is made for 'expensive' clipping
(i.e. clipping by an arbitrary quadrilateral). All draw commands are
then redirected to the temporary buffer until the clipping needs to be
flushed. Clipping is flushed when the clip rect or target bitmap
changes. Flushing expensive clipping requires applying a clip mask to
the temporary buffer, and then blitting it to the target bitmap.
Note: If the bounds of a draw command are known to be within the current
clip 'expensive' clipping can be elided.
In future, it may be possible to avoid some of this masking by applying
path-clipping algorithms (but that's fairly tricky, and normally
requires stronger guarantees about paths than we currently have).
This AO can be used instead of CreateReadableStream in cases where we
need to set up a newly allocated ReadableStream before initialization of
said ReadableStream, i.e. ReadableStream is captured by lambdas in an
uninitialized state.
(cherry picked from commit ce521a196dc3a50b5a7e35a09917e435b78da1d4)