Commit Graph

60748 Commits

Author SHA1 Message Date
Shannon Booth
5cb6d495bb LibWeb: Implement verification of 'nominal' audio options
The spec doesn't tell us the exact value to use, but a minumum & maximum
range of supported values. Just to be consistent with another browser,
we follow the values that firefox appears to support from testing the
interface on my machine.

This function will be used in the AudioBuffer constructor, but is
defined in the spec as part of BaseAudioContext.
2024-04-25 19:26:19 -04:00
Shannon Booth
46ec3681a4 LibWeb: Verify document is fully ready in AudioContext
This was just a trival FIXME to resolve as I was in the area.
2024-04-25 19:26:19 -04:00
Shannon Booth
9abce21435 LibWeb: Add missing CellAllocator.h include for Buffers.h
My clangd was (rightly) complaining that this include was missing.
2024-04-25 19:26:19 -04:00
Nico Weber
b364a58753 LibGfx/JPEG2000: Read COC marker segments, both in main and tile headers
Not yet used for anything.
2024-04-25 09:00:46 -04:00
Nico Weber
8eb3d436e6 LibGfx/JPEG2000: Extract CodingStyleParameters
This is the data shared between COD and COC marker segments.

No behavior change.
2024-04-25 09:00:46 -04:00
Nico Weber
3735f2cbed LibGfx/JPEG2000: Read COD on tile headers too
I haven't seen this in the wild yet, but it is allowed per spec
and easy to do.
2024-04-25 09:00:46 -04:00
goldenzach
65eb7699f4 LibWeb: Resolve vertical padding of inline elements 2024-04-25 12:45:39 +02:00
Aliaksandr Kalenik
988c8451d4 LibWeb: Skip HTMLLinkElement resource fetching for documents without BC
Fixes crashing after following steps:
1. Open https://github.com/SerenityOS/serenity
2. Click on "Pull requests" tab

The problem was `navigable` null pointer dereferencing in
`decode_favicon()`. But navigable is null because the document was
created by `parseFromString()` DOMParser API.

With this change we skip fetching initiated by HTMLLinkElement if
document does not have a browsing context:
- Favicon is not displayed for such documents so no need to fetch.
- Stylesheets fetching won't affect such document because style or
  layout does not run for them.
2024-04-25 09:31:01 +02:00
Andreas Kling
4c921e17b7 LibWeb: Allocate dataset lazily for HTML/SVG/MathML elements
Most elements never need a dataset object, so we can avoid creating lots
of objects by making them lazy.
2024-04-25 09:30:30 +02:00
Timothy Flynn
1560d6ad62 LibCore: Remove the now-obsolete SingletonProcess helper files 2024-04-24 15:51:58 -06:00
Timothy Flynn
eb990fcecd sql: Use Core::Process facilities to spawn singleton processes 2024-04-24 15:51:58 -06:00
Timothy Flynn
c11019ebc1 Ladybird: Use Core::Process facilities to spawn singleton processes 2024-04-24 15:51:58 -06:00
Timothy Flynn
c723fc9611 LibCore: Support launching a singleton process with an IPC connection
This largely adapts the code from SingletonProcess.cpp to work a bit
closer with Core::Process. Ideally, we'll move the daemonizing feature
into Core::Process::disown() eventually.
2024-04-24 15:51:58 -06:00
Timothy Flynn
8448897f14 LibCore: Implement a move operator for Core::Process
We implement the move constructor already. A future commit will have
code of the form:

    process = move(other_process);

which there is no reason to forbid.
2024-04-24 15:51:58 -06:00
Timothy Flynn
9fb84e4693 Ladybird: Use Core::Process facilities to spawn helper processes
Note that WebContent now also uses launch_generic_server_process()
instead of its own implementation.
2024-04-24 15:51:58 -06:00
Timothy Flynn
9986350e97 LibCore: Support launching a process with an IPC connection
Much of the code here is adapted from Ladybird. But rather than doing a
manual fork, we use Core::Process to spawn the underlying process.
2024-04-24 15:51:58 -06:00
Timothy Flynn
dc52404aec LibCore: Add a Core::Process action to close a file after spawning 2024-04-24 15:51:58 -06:00
Timothy Flynn
fecd08ce64 Everywhere: Remove 'clang-format off' comments that are no longer needed 2024-04-24 16:50:01 -04:00
Timothy Flynn
ec492a1a08 Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-18 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")

There are a couple of weird cases where clang-format now thinks that a
pointer access in an initializer list, e.g. `m_member(ptr->foo)`, is a
lambda return statement, and it puts spaces around the `->`.
2024-04-24 16:50:01 -04:00
Timothy Flynn
823fdb83db Meta: Switch to clang-format-18 as the standard formatter 2024-04-24 16:50:01 -04:00
Timothy Flynn
891c4ac68e CI: Bust the toolchain ccache when the toolchain's major version changes
The build will be entirely clean anyways, so no need to preserve the
previous version's ccache.
2024-04-24 16:49:50 -04:00
Timothy Flynn
4cc8266727 CI: Do not prune the toolchain ccache
Currently, if the prebuilt toolchain cache gets used, we will not try to
build the toolchain. Thus, the toolchain's ccache does not get used, and
is then pruned entirely at the end of the run.

So for now, let's just not prune the toolchain ccache. After a few years
it only reached 0.8 GB in size. And now that we are starting from empty
again, it would likely be a few more years before we reach 0.8 GB again.
2024-04-24 16:49:50 -04:00
Cnidarias
1a1e5aaf54 LibWeb: Add null check for get_client_rects() on non paintable elements 2024-04-24 18:04:28 +02:00
Andreas Kling
c186ab96ac LibWeb: Explicitly ignore PageClient::m_console_clients
This map is managed entirely by manual insertion/removal when a document
is created/destroyed, so we should just ignore it in visit_edges().
2024-04-24 17:04:43 +02:00
Andreas Kling
f60d82eb85 LibWeb: Make HTML::Environment a GC-allocated type
The only subclass was already GC-allocated, so let's hoist the JS::Cell
inheritance up one level. This ends up simplifying a bit of rather
dubious looking code where we were previously slicing ESOs.
2024-04-24 17:04:43 +02:00
Bastiaan van der Plaat
7fa45c5fdf LibWeb: Add map element areas property 2024-04-24 15:23:45 +02:00
Bastiaan van der Plaat
3e507102ea LibWeb: Add datalist element options property 2024-04-24 15:23:45 +02:00
Timothy Flynn
90fcfca6f6 CI: Configure ccache before modifying its contents (if any)
If there is a cache miss while downloading the ccache from GitHub/Azure,
the .ccache directory won't exist when we try to update the modification
time of its contents. Configure the ccache size first, which will create
the .ccache directory if it doesn't exist.
2024-04-24 09:16:41 -04:00
Aliaksandr Kalenik
1072d9f15d LibJS: Save min and max block addresses in CellAllocator
This allows to skip iterating through all allocated blocks in
`find_min_and_max_block_addresses()`.

With this change `collect_garbage()` in profiles of Discord goes down
from 17% to 8%.
2024-04-24 11:42:15 +02:00
Aliaksandr Kalenik
55154b6c68 LibWeb: Use SafeFunction for completion steps in "populate SHE"
...to visit GC-allocated objects captured by this callback.
2024-04-24 10:22:29 +02:00
Aliaksandr Kalenik
64ad536dbb LibWeb: Create HeapFunction for after_document_populated
...to make it visited by SafeFunction callback of deferred_invoke().

Fixes use-after-free ASAN error that happens if you try to reload the
page.
2024-04-24 10:22:29 +02:00
ronak69
b25d220a2c headless-browser: Call platform_init() for path of resources folder
For `AK_OS_SERENITY`, the root path of the resources folder is "/res";
but otherwise it should be the `s_serenity_resource_root` variable set
in `platform_init()`.

However, a path provided on the command line, will override the default
path in both of those cases.

This change also makes sure that `RequestServer` can find the
certificates file `serenity/Build/lagom/share/Lagom/ladybird/cacert.pem`
2024-04-24 10:21:20 +02:00
Dan Klishch
49e09507d7 LibELF: Perform weak relocations in much more straight-forward manner
There is no need to defer unresolved weak relocations until stage 3 --
it is not like we will magically find new symbols in the same objects.
2024-04-23 23:26:00 -06:00
Andrew Kaster
7b06417ccf CI: Test using Clang for ASAN+UBSAN on Linux, add nightly GCC job
Clang builds of ASAN+UBSAN on Linux take significantly less time on the
Azure CI runners. Measured times were 82 minutes for Clang 18 and
112 minutes for GCC 13, with no cache.

To keep our coverage of Ladybird builds + testing with GCC, add a
nightly job to run through the full test cycle on GCC 13.
2024-04-23 21:16:53 -06:00
Tim Schumacher
5f088f3233 Meta: Trim the CI ccache down to files used in the current build 2024-04-23 22:00:07 -04:00
kleines Filmröllchen
e74b34b69e LibC: Fix extended floating point software rounding
Contrary to IEEE formats, x86's 80-bit extended floats need the topmost
mantissa bit to be 1 or else a special kind of NaN is produced. We fix
this by reinserting the special bit if necessary.
2024-04-23 19:18:09 -06:00
kleines Filmröllchen
0c1ad05f50 LibC: Add rounding specializations for RISC-V
Whenever the floating-point values are in integer range, we can use the
various FCVT functions with static rounding mode to perform fast
rounding. I took this opportunity to clean up the architecture
differentiation for these functions, which allows us to use the software
rounding implementation for all extreme and unimplemented cases,
including AArch64.

Also adds more round & trunc tests.
2024-04-23 19:18:09 -06:00
kleines Filmröllchen
334f5e319c LibC: Prevent undefined shift in internal_to_integer
New tests will hit a dead bit count of 64, leading to an undefined
shift.
2024-04-23 19:18:09 -06:00
kleines Filmröllchen
8443d0a74d AK: Use common ComponentType integer type for float bitfields
This allows us to easily use an appropriate integer type when performing
float bitfield operations.

This change also adds a comment about the technically-incorrect 80-bit
extended float mantissa field.
2024-04-23 19:18:09 -06:00
kleines Filmröllchen
997828c31a LibC: Add some fenv tests
Co-Authored-By: Dan Klishch <danilklishch@gmail.com>
2024-04-23 19:18:09 -06:00
kleines Filmröllchen
24af4f1882 LibC: Start on fenv support for RISC-V
Co-Authored-By: Sönke Holz <sholz8530@gmail.com>
2024-04-23 19:18:09 -06:00
Dan Klishch
a4a8dd29ba LibC: Read correct FP register in fegetround on x86-64 :^) 2024-04-23 19:18:09 -06:00
Andrew Kaster
751ddae7a2 DevContainer: Recommend clang-18, and bump feature version 2024-04-23 15:37:07 -06:00
Andrew Kaster
c5cd1ad737 CI: Use macOS 14 Apple Silicon runner to create js package for esvu 2024-04-23 15:37:07 -06:00
Andrew Kaster
0555650387 CI: Use macOS 13 x86_64 runner in Azure DevOps
Sadly the Apple Silicon runners GitHub Actions has now are not yet
available in ADO. However, we can still bump the version to Ventura.
2024-04-23 15:37:07 -06:00
Andrew Kaster
2e385e4c12 CI: Bump Lagom CI builds to gcc-13 and clang-18
This includes Lagom Tools for Serenity builds, and the Lagom builds on
Azure.
2024-04-23 15:37:07 -06:00
Andrew Kaster
913cffe928 AK: Add workaround for faulty Sanitizer warning on gcc 13+ in Atomic
gcc can't seem to figure out that the address of a member variable of
AK::Atomic<u32> in AtomicRefCounted cannot be null when fetch_sub-ing.
Add a bogus condition to convince the compiler that it can't be null.
2024-04-23 15:37:07 -06:00
Andrew Kaster
1c3f11a5a6 Userland: Remove remaining callers of synchronous ImageDecoder API
Most of these now just await the image decoding, equivalent (ish) to
the old behavior. A more async-aware refactor should happen some time
in the future.
2024-04-23 12:32:04 -06:00
Andrew Kaster
651e78fedb LibWeb: Convert callers of ImageCodecPlugin to the async API
The HTMLLinkElement caller is a bit hairy, so we shove an await() in
there temporarily. This is sure to cause fun times for anyone debugging
task/microtask execution order.
2024-04-23 12:32:04 -06:00
Andrew Kaster
39dfb659cf LibWeb+WebContent: Convert ImageCodecPlugin to use the promise-based API 2024-04-23 12:32:04 -06:00