Commit graph

61953 commits

Author SHA1 Message Date
Tim Ledbetter 166130e12d LibWeb: Avoid null dereference when performing mixed content checks
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)
2024-06-26 20:03:57 +02:00
Andrew Kaster 3d467182bc LibWeb: Check for navigable destruction in declarative refresh timer
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:")
2024-06-26 20:03:34 +02:00
Luke Warlow 39a8974840 LibWeb: Implement stub for ElementInternals
This implements a stub ElementInternals object which implements the
shadowRoot getter only.

Also implement attachInternals function.

(cherry picked from commit a65f1ecc375fa02deeab5d0e7ab4702972ffa72e)
2024-06-26 20:02:46 +02:00
Torstennator 490d61d694 PixelPaint: Fix broken "Color Masking" selection
This change solves a problem where the color selection via mouse click
on the color wheel was computing a wrong hue angle.
2024-06-26 20:02:27 +02:00
Torstennator bb0bfb7944 PixelPaint: Fix Color Masking crash
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.
2024-06-26 20:02:27 +02:00
Andreas Kling ff49762eb4 LibWebSocket: Use HTTP::HeaderMap in WebSocket code
(cherry picked from commit 0d22e0703f4d668fab78b6e4960dfdc2b607369d)
2024-06-26 18:50:27 +02:00
Tim Ledbetter 36630bf859 LibIDL+LibWeb: Mark [FIXME] interfaces as [[Unimplemented]]
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)
2024-06-26 16:34:37 +02:00
Tim Ledbetter c98bcd0a10 LibJS: Add the [[Unimplemented]] attribute
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)
2024-06-26 16:34:37 +02:00
Andreas Kling f72805398b LibWeb: Add the bare minimum to render SVGAElement (<a>)
(cherry picked from commit 85a4cfc59bc901e860ba60c51ad1fc9c0cf4e669)
2024-06-26 14:13:40 +02:00
Andreas Kling 19e4b138af LibWeb: Treat width: {min,max,fit}-content as auto if ratio unresolvable
This appears to match other engines.

(cherry picked from commit ae906ca4974da309c362e61ce7b6b393b8c4aed1)
2024-06-26 14:13:40 +02:00
Andreas Kling 97edca4e4e LibWeb: Fix overeager fallback to stretch-fit width for some flex items
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)
2024-06-26 14:13:40 +02:00
Andreas Kling 47d7a3648e LibWeb: Allow flex-basis: {min,max,fit}-content
(cherry picked from commit 9c02ace89785cbc185553dc2711f79c4ad1bf389)
2024-06-26 14:13:40 +02:00
Jamie Mansfield ef7d593463 LibWeb: Implement IDBRequest.onerror
(cherry picked from commit 68d84755f4b745351d3d494759d59ba6719b8ad8)
2024-06-26 14:13:20 +02:00
Jamie Mansfield 6d268be6fc LibWeb: Implement IDBRequest.onsuccess
(cherry picked from commit 5ebc09c83b5ffd75341f8ddca9db3a49f587ed8d)
2024-06-26 14:13:20 +02:00
Jamie Mansfield 2f0b9c6dab LibWeb: Implement IDBOpenDBRequest.onupgradeneeded
(cherry picked from commit fe3962a64d1ab019b36965ecc60fe495adfd9295)
2024-06-26 14:13:20 +02:00
Jamie Mansfield aec46809fe LibWeb: Implement IDBOpenDBRequest.onblocked
(cherry picked from commit 30db7fb323c6041367155e646270e2a58f4233ea)
2024-06-26 14:13:20 +02:00
Jamie Mansfield 214797a69a LibWeb: Implement HTMLStyleElement.disabled
(cherry picked from commit 1114bbf2f155aeaa8d6b368a4eb567469c5d4fe3)
2024-06-26 14:13:20 +02:00
Jamie Mansfield 33262421a2 LibWeb: Remove is_media_feature_name function
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)
2024-06-26 14:13:20 +02:00
Andreas Kling f1dcf567e4 Tests: Add a basic test for Declarative Shadow DOM
(cherry picked from commit 7ce350b8c069c13540c50631413b2150bab967d4)
2024-06-26 08:48:11 +02:00
Andreas Kling 83d0599d1c LibWeb: Add Element.getHTML() and ShadowRoot.getHTML()
(cherry picked from commit fb9f3f10f3090cc2822d2c681bd7350dda17830e)
2024-06-26 08:48:11 +02:00
Andreas Kling e4feb43e86 LibWeb: Update innerHTML & co IDL definition to match spec
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)
2024-06-26 08:48:11 +02:00
Andreas Kling c8206fa070 LibWeb: Rename Element::shadow_root_internal() to shadow_root()
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)
2024-06-26 08:48:11 +02:00
Andreas Kling 1c5f0e8daf LibWeb: Update DOM cloning algorithm for declarative shadow DOM
(cherry picked from commit c7d9c1c0b21ad54894984dd73c775e225f82af09)
2024-06-26 08:48:11 +02:00
Andreas Kling 6217ebe33c LibWeb: Add HTMLTemplateElement IDL attrs for declarative shadow DOM
(cherry picked from commit a0e111220913ec1bf8d51dde37174120781b0a5f)
2024-06-26 08:48:11 +02:00
Andreas Kling 020764b204 LibWeb: Add ShadowRoot.clonable and ShadowRoot.serializable
(cherry picked from commit 8e68215d333963eeb63cccde171dba6ea77651d7)
2024-06-26 08:48:11 +02:00
Andreas Kling 88d9dc148c LibWeb: Update HTML fragment serialization for declarative shadow DOM
(cherry picked from commit e62db9c1181f5af49242656d3e065ceb0db800b9)
2024-06-26 08:48:11 +02:00
Andreas Kling a5189537e9 LibWeb: Parse declarative shadow DOM template elements
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)
2024-06-26 08:48:11 +02:00
Andreas Kling 34a4b28b89 LibWeb: Refactor Element.attachShadow() after spec changes
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.
2024-06-26 08:48:11 +02:00
Andreas Kling 3a2260b28b LibWeb: Add "allow declarative shadow roots" flag to Document
(cherry picked from commit f3070118b1fabda4a35f283a3bcf8086e32a25a9)
2024-06-26 08:48:11 +02:00
Sönke Holz facca92780 Kernel/Storage: Dump storage devices to the framebuffer console as well
This is helps bringing up bare metal devices without having to use the
serial console.
2024-06-26 08:47:00 +02:00
FujiBookPro 728f42f8f5 LibAudio: Replace DeprecatedFlyString with FlyString 2024-06-25 18:32:45 -06:00
Ali Mohammad Pur 3b05c81070 LibIPC: Allow sync messages to completely block the event loop
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.
2024-06-25 18:30:03 -06:00
Idan Horowitz 3aa1bd520b Kernel: Support re-mapping MMIOVMObject-backed regions
This is required for example when write combine is enabled on a region
after the initial mapping.
2024-06-25 17:46:37 +02:00
Daniel Bertalan 8d2a8dbb8b Everywhere: Write dtors for types with incomplete members out-of-line
These are rejected by Clang (19) trunk as a result of
https://github.com/llvm/llvm-project/pull/77753.

(cherry picked from commit bf1f631f257e90e91b0b45a6454d731b4b98914c)
2024-06-25 17:42:49 +02:00
Daniel Bertalan d1f1a6eef0 Everywhere: Remove usages of template keyword with no parameter list
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)
2024-06-25 17:42:49 +02:00
Timothy Flynn 46ce6decfe LibProtocol: Exit fatally if the connection to RequestServer disappears
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)
2024-06-25 17:42:49 +02:00
Nico Weber 7e2c8693b1 LibJS: Initialize fields of on-stack buf structure
We pass all fields of `buf` to `add_possible_value()`, and at least
on Linux `setjmp()` does not initialize all fields.

Fixes #24560.
2024-06-25 17:40:17 +02:00
Liav A. 393c886c24 Utilities: Introduce the sizefmt utility
This utility takes a human-readable size and converts it into a raw
integer that can be used on commandline utilities.
2024-06-25 09:24:55 +02:00
Liav A. b91c625f8f AK: Introduce declerations for base10 size suffixes
Also, re-organize the base2 size suffixes to not use KiB repeatedly.
2024-06-25 09:24:55 +02:00
Nico Weber 22d737f370 Meta: Add a warning suppression used in the cmake build to the gn build
8263e0a619 added `-Wno-coroutine-missing-unhandled-exception` to the
cmake build, and the coroutine code does not build without it.

Unbreaks building e.g. `js` with GN.
2024-06-24 20:44:26 +02:00
Andreas Kling 93253e3701 LibJS/Bytecode: Give TypeofBinding instructions a lookup cache
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)
2024-06-24 16:38:47 +02:00
Andreas Kling 3a7da923e6 LibJS/Bytecode: Rename TypeofVariable => TypeofBinding
(cherry picked from commit 4302e073463c403f8d7ab09c42e7644089fc33a2)
2024-06-24 16:38:47 +02:00
Andreas Kling cd7a151aef LibJS: Allow let and const to create locals in global code
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)
2024-06-24 16:38:47 +02:00
Andreas Kling 776e5d38cd LibJS/Bytecode: Display local variable names in bytecode dumps
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)
2024-06-24 16:38:47 +02:00
Andreas Kling 63d8a1821e LibJS: Don't overwrite cached this value on async/generator reentry
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)
2024-06-24 16:38:47 +02:00
Tim Ledbetter 0b1adf784f SystemMonitor: Add an action to manually refresh process statistics 2024-06-23 21:20:37 +01:00
Tim Ledbetter 4091d7fc05 SystemMonitor: Add an action to pause updates 2024-06-23 21:20:37 +01:00
Liav A. 5cb1d2a63e Utilities/pkg: Move ports database handling from AvailablePort{.h,.cpp}
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.
2024-06-23 00:59:54 +02:00
Liav A. 1e13d758a2 Utilities/pkg: Move ports database handling from InstalledPort{.h,.cpp}
Instead, let's create a new class called InstalledPortDatabase that will
handle reading, and adding new entries as needed to such database.
2024-06-23 00:59:54 +02:00
Liav A. b201a91e72 Utilities/pkg: Rename ports_database => default_ports_database_path 2024-06-23 00:59:54 +02:00