Commit graph

2670 commits

Author SHA1 Message Date
Jelle Raaijmakers f619b61b00 Lagom: Link aconv with LibFileSystem 2023-06-22 22:27:03 +02:00
kleines Filmröllchen 0d65e5f518 Meta: Add aconv as a Lagom tool 2023-06-22 21:45:54 +02:00
Andreas Kling 6537ed8fff LibJS/Bytecode: Simplify Bytecode::Interpreter lifetime model
The JS::VM now owns the one Bytecode::Interpreter. We no longer have
multiple bytecode interpreters, and there is no concept of a "current"
bytecode interpreter.

If you ask for VM::bytecode_interpreter_if_exists(), it will return null
if we're not running the program in "bytecode enabled" mode.

If you ask for VM::bytecode_interpreter(), it will return a bytecode
interpreter in all modes. This is used for situations where even the AST
interpreter switches to bytecode mode (generators, etc.)
2023-06-22 21:16:17 +02:00
Andreas Kling 6150960671 Tests: Remove test-bytecode-js
This was meant to be a temporary unit testuntil we could run test-js
in bytecode mode. This has been possible for a long time now, so let's
remove the unnecessary extra program.
2023-06-22 21:16:17 +02:00
Daniel Bertalan 3ee908df27 Meta: Always use the default host compiler for the toolchain on macOS
GCC's build fails in `libisl`'s configure step if `CC` is set to
Homebrew Clang with the message "Link Time Optimisation is not
supported". This is likely due to the fact that it tries to use ranlib
from Xcode, which is not compatible with the newer LLVM version's
bitcode format.

The toolchain build runs after `pick_host_compiler` is called, which
selects Homebrew Clang if the installed Xcode version is too old. We
need to unset `CC` and `CXX` for the toolchain build to sidestep the
issue.
2023-06-21 06:49:54 -04:00
Timothy Flynn 421aa8da1e Meta: Document that clang-15 is required, and update the compiler checks
We require clang-15 for consteval.
2023-06-21 06:49:47 -04:00
Lucas CHOLLET e5685078c1 Meta: Add a gdb pretty-printer for Optional 2023-06-21 06:15:35 +02:00
Timothy Flynn 0fd35b4dd8 Meta: Ignore local includes of .moc files
These are generated by Qt and added to the include path automatically by
CMake.
2023-06-21 06:14:15 +02:00
Cameron Youell 0a0ba4cbc5 Meta: Ignore empty directories in lint-ports
Git doesn't track empty directories, so we can just ignore them
2023-06-19 23:13:36 +02:00
Cameron Youell bc75fa878e Meta: Use Python to parse a port's package.sh in lint-ports
This reduced the runtime of `lint-ports` from 72s down to 0.5s on
my computer (a reduction of ~99.2%)! While it may not be as
accurate as running `package.sh showproperty` it makes using
`precommit` while editing ports much nicer!
2023-06-19 23:13:36 +02:00
implicitfield d4f5e6eb81 Fuzzers: Update the path to fuzzer binaries
This was overlooked in 71b184a, which broke the oss-fuzz configuration.
2023-06-19 07:40:17 -04:00
Ali Mohammad Pur 2e2e535abb Meta: Build LibCpp for Lagom 2023-06-18 20:30:21 +02:00
Tim Ledbetter 586b47cede Kernel: Put loopback adapter debug spam behind a flag
This significantly increases loopback adapter speed in normal use.
2023-06-18 08:50:33 +01:00
Sam Atkins acaf2368ad CodeGenerators: Port GenerateCSSValueID to new SourceGenerator API 2023-06-17 17:48:06 +01:00
Sam Atkins acb600496b CodeGenerators: Port GenerateCSSTransformFunctions to new SourceGen API 2023-06-17 17:48:06 +01:00
Sam Atkins d197b4b051 CodeGenerators: Port GenerateCSSPropertyID to new SourceGenerator API 2023-06-17 17:48:06 +01:00
Sam Atkins e7dd5e5b05 CodeGenerators: Port GenerateCSSMediaFeatureID to new SourceGen API 2023-06-17 17:48:06 +01:00
Sam Atkins 17473e3d5e CodeGenerators: Port GenerateCSSEnums to new SourceGenerator API 2023-06-17 17:48:06 +01:00
Sam Atkins 8e53e5afc4 AK: Propagate errors from SourceGenerator::fork() 2023-06-17 17:48:06 +01:00
Sam Atkins 540cc42618 CodeGenerators: Convert GeneratorUtil to String
I may have got a little carried away propagating some of the errors. :^)
2023-06-17 17:48:06 +01:00
Andreas Kling d063f35afd LibJS/Bytecode: Leave GlobalDeclarationInstantiation in C++
Don't try to implement this AO in bytecode. Instead, the bytecode
Interpreter class now has a run() API with the same inputs as the AST
interpreter. It sets up the necessary environments etc, including
invoking the GlobalDeclarationInstantiation AO.
2023-06-16 08:40:45 +02:00
Sam Atkins 5cdcd135ab LibWeb: Add parsing for CSS <paint> values
This gets rid of a couple of FIXMEs in Properties.json :^)
2023-06-16 07:03:57 +02:00
Timothy Flynn 6520a9a849 LibWeb: Support TrackEvent instances with an AudioTrack track type 2023-06-14 17:54:40 +02:00
Aliaksandr Kalenik edf11b3809 Meta: Exclude cloned WPT repo from linting by check-markdown.sh 2023-06-14 06:45:04 +02:00
Aliaksandr Kalenik 0677270a3e Meta: Add WPT in Azure CI 2023-06-14 06:45:04 +02:00
Andreas Kling f7dc2742a9 CI: Don't run brew update on macOS CI 2023-06-13 17:25:39 +02:00
Andreas Kling 3d67f75bef CI: Disable ASAN's use-after-return check
This has apparently started defaulting to "on" at some point, which
breaks our conservative stack scan in LibJS.
2023-06-13 13:15:34 +02:00
Timothy Flynn a34e369252 Ladybird+LibWeb+WebContent: Create a platform plugin for playing audio
This creates (and installs upon WebContent startup) a platform plugin to
play audio data.

On Serenity, we use AudioServer to play audio over IPC. Unfortunately,
AudioServer is currently coupled with Serenity's audio devices, and thus
cannot be used in Ladybird on Lagom. Instead, we use a Qt audio device
to play the audio, which requires the Qt multimedia package.

While we use Qt to play the audio, note that we can still use LibAudio
to decode the audio data and retrieve samples - we simply send Qt the
raw PCM signals.
2023-06-13 06:14:01 +02:00
Timothy Flynn 936ec94f81 AK+LibAudio+AudioServer: Silence very noisy debug statements by default
These are spammed quite heavily on the debug console, especially at the
end of audio playback.
2023-06-13 06:14:01 +02:00
Jelle Raaijmakers 5ff80b60cf Meta: Rename BuildIt.sh to BuildGNU.sh
Bring it in line with `Toolchain/BuildClang.sh`.
2023-06-12 16:22:55 -07:00
Andreas Kling a6c6c24428 Lagom: Allow opting into linking with mold 2023-06-10 17:31:41 -07:00
Ali Mohammad Pur 47248a3511 LibWasm: Keep track of created directory fds in path_create_directory 2023-06-10 07:18:02 +02:00
Zaggy1024 873b0e9470 LibGfx/LibVideo: Read batches of multiple bytes in VPX BooleanDecoder
This does a few things:

- The decoder uses a 32- or 64-bit integer as a reservoir of the data
  being decoded, rather than one single byte as it was previously.
- `read_bool()` only refills the reservoir (value) when the size drops
  below one byte. Previously, it would read out a bit-sized range from
  the data to completely refill the 8-bit value, doing much more work
  than necessary for each individual read.
- VP9-specific code for reading the marker bit was moved to its own
  function in Context.h.
- A debug flag `VPX_DEBUG` was added to optionally enable checking of
  the final bits in a VPX ranged arithmetic decode and ensure that it
  contains all zeroes. These zeroes are a bitstream requirement for
  VP9, and are also present for all our lossy WebP test inputs
  currently. This can be useful to test whether all the data present in
  the range has been consumed.

A lot of the size of this diff comes from the removal of error handling
from all the range decoder reads in LibVideo/VP9 and LibGfx/WebP (VP8),
since it is now checked only at the end of the range.

In a benchmark decoding `Tests/LibGfx/test-inputs/4.webp`, decode times
are improved by about 22.8%, reducing average runtime from 35.5ms±1.1ms
down to 27.4±1.1ms.

This should cause no behavioral changes.
2023-06-10 07:17:12 +02:00
Sam Atkins 5e3da93f1a LibWeb: Add RatioStyleValue and parsing 2023-06-09 20:37:51 +02:00
implicitfield 71b184accf Meta+Lagom: Enable CMAKE_BUILD_WITH_INSTALL_RPATH
On macOS, CMake incorrectly tries to add and/or remove rpaths from files
that it has already processed when it performs installation. Setting the
rpaths during the build process ensures that they are only set once, and
as a bonus, makes installation slightly more performant.

Fixes #10055.
2023-06-08 17:59:53 +02:00
Jelle Raaijmakers 2e3bff7ab1 Meta: Re-add boot drive to aarch64 run configuration
This broke in c2e24a2fa1 where the boot
drive was removed from `SERENITY_MACHINE`. We now add the boot drive to
the common Qemu arguments, so it gets included in the aarch64 run
configuration as well.
2023-06-08 14:43:14 +02:00
Timothy Flynn cb912f0e1a LibEDID: Ignore duplicate PNP IDs
The PNP IDs data file was recently updated with an accidental duplicate
entry (HONOR Device Co., Ltd.). Rather than breaking everyone's build,
let's just ignore duplicates.
2023-06-08 13:03:14 +02:00
Andreas Kling 7f90b0cab7 LibWeb: Don't override prototype on generated iterator prototypes
Generated iterator prototypes already have the IteratorPrototype as
their prototype, but we were incorrectly hijacking them and rerouting
to ObjectPrototype.

Regressed in cfe663435e.
2023-06-08 10:05:56 +02:00
Ben Wiederhake 4a359b5a42 Meta: Check that local includes can be resolved
If a local include does not point to a file in the repository, it should
be a system include instead. This is now checked on every commit.

While this does introduce significant overhead in terms of percentage,
I think that an additional 10ms on huge commits (or less on smaller
commits) are acceptable:

hyperfine -w1 './Meta/check-style.py AK/*.h AK/*.cpp' # Before
Benchmark 1: ./Meta/check-style.py AK/*.h AK/*.cpp
  Time (mean ± σ):      20.3 ms ±   0.4 ms    [User: 17.1 ms, System: 3.
5 ms]
  Range (min … max):    19.5 ms …  21.6 ms    128 runs

hyperfine -w1 './Meta/check-style.py AK/*.h AK/*.cpp' # After
Benchmark 1: ./Meta/check-style.py AK/*.h AK/*.cpp
  Time (mean ± σ):      32.3 ms ±   0.4 ms    [User: 27.9 ms, System: 4.
4 ms]
  Range (min … max):    31.4 ms …  34.9 ms    91 runs
2023-06-06 23:19:50 +02:00
Ben Wiederhake 6a351376aa Everywhere: Only use local includes where appropriate
If a local include does not point to a file in the repository, it should
be a system include instead.
2023-06-06 23:19:50 +02:00
Andreas Kling 941092e3ad LibWeb: Make CSS/Properties.json "logical-aliases-for" an array
This allows us to specify all aliases properties instead of just one.
2023-06-06 21:02:04 +02:00
Jelle Raaijmakers c2e24a2fa1 Meta: Use SERENITY_BOOT_DRIVE for aarch64 as well 2023-06-06 06:44:05 -07:00
Jelle Raaijmakers 210e90dab8 Meta: Enable NVME by default
This results in significant performance improvements in both sequential
and random disk reading and writing.
2023-06-06 06:44:05 -07:00
Sam Atkins 2d7308cb88 LibWeb: Support infinite range for CSS properties
This makes `[-∞,∞]` generate valid code, instead of `return ;`
2023-06-02 20:04:23 +02:00
Sam Atkins 51f75d7071 LibWeb: Generate bounds-checking functions for CSS basic types 2023-06-02 17:46:35 +02:00
Fabian Dellwing 33815d550b Meta: Update cacert.pem 2023-05-30 13:05:19 +02:00
Ali Mohammad Pur 0e3fb39a0a LibWeb: Make 'optional BufferSource' IDL arguments actually optional
Previously this was compiled to require an object despite the IDL file
specifying 'optional'.
This commit makes IDLGenerator respect this modifier, and fixes the only
affected instance.
2023-05-30 12:50:13 +02:00
Ali Mohammad Pur e90752cc21 LibWeb: Add preliminary support for CSS animations
This partially implements CSS-Animations-1 (though there are references
to CSS-Animations-2).
Current limitations:
- Multi-selector keyframes are not supported.
- Most animation properties are ignored.
- Timing functions are not applied.
- Non-absolute values are not interpolated unless the target is also of
  the same non-absolute type (e.g. 10% -> 25%, but not 10% -> 20px).
- The JavaScript interface is left as an exercise for the next poor soul
  looking at this code.

With those said, this commit implements:
- Interpolation for most common types
- Proper keyframe resolution (including the synthetic from-keyframe
  containing the initial state)
- Properly driven animations, and proper style invalidation

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-05-29 05:35:41 +02:00
Ali Mohammad Pur 279924242d LibWeb: Add CSS CompositeStyleValue
This represents the value of properties assigned via their shorthands,
and is expanded when computing actual property values.
2023-05-29 05:35:41 +02:00
Andreas Kling ad6027433d headless-browser: Print a diff when a test failure occurs
This will make it a lot easier to understand what went wrong, especially
when the failure occurs on CI but not at home.

And of course, use LibDiff to generate the diff! :^)
2023-05-28 22:03:57 +02:00
Karthik Karanth 72507c318a LibWeb: Add logical-alias-for in Properties.json
This allows for succint definitions of logical properties, by allowing
them to inherit initial values, valid identifiers, etc from another
property
2023-05-27 16:02:33 +02:00
Matthew Olsson f63d027b0b Meta: Fix unresolvable reference to WebIDL::OperationReturnsPromise 2023-05-27 13:55:14 +02:00
Ben Wiederhake 64a2a63df6 LibCore: Drop TestLibCoreIODevice
It does not make sense to test known-working code that is deprecated and
in the process of being removed. Also, this test becomes too cumbersome
to write without using read_all or line iteration in some form, and
migrating the test is just silly.
2023-05-27 07:16:01 +02:00
Sam Atkins f6fae315e3 LibWeb: Add CustomIdentStyleValue, along with parsing for it
This corresponds to the `<custom-ident>` type in CSS grammar.
2023-05-25 15:31:20 +01:00
Sam Atkins 6b8f484114 LibWeb: Stop generating now-unused property_accepts_value() function 2023-05-25 06:36:10 +02:00
Sam Atkins 465ecf37c2 LibWeb: Make property_id_from_string() return Optional 2023-05-25 06:36:10 +02:00
Sam Atkins 03613dc14d LibWeb: Make value_id_from_string() return Optional 2023-05-25 06:36:10 +02:00
Sam Atkins 9b61f79eae LibWeb: Generate property_accepts_[identifier/type]() functions
These will be used to parse StyleValues more intelligently.
2023-05-25 06:36:10 +02:00
kleines Filmröllchen 82c681e44b LibTimeZone+Userland: Change timezone functions to use UnixDateTime
This incurs a whole host of changes in, among others, JavaScript Intl
and Date.
2023-05-24 23:18:07 +02:00
kleines Filmröllchen 213025f210 AK: Rename Time to Duration
That's what this class really is; in fact that's what the first line of
the comment says it is.

This commit does not rename the main files, since those will contain
other time-related classes in a little bit.
2023-05-24 23:18:07 +02:00
implicitfield b6af5eaa72 Fuzzers: Unbreak FuzzHttpRequest
Previously, the exit condition was inverted, causing the fuzzer to
try to read the value of an error.
2023-05-24 16:25:13 +02:00
Daniel Bertalan 81b6723b29 Meta: Add GCC 13 and Clang 16 to compiler autodetection 2023-05-24 01:20:02 -06:00
Daniel Bertalan 4202bb597b Meta+Documentation: Require Xcode 14.3 or Clang 14 for the host compiler
There have been multiple reports of Xcode 14.0 (based on upstream LLVM
14) segfaulting when compiling `LibCore/Process.cpp`. Let's require
Xcode 14.3, which is a known good version based on LLVM 15.

Note that Xcode 14.3 requires macOS Ventura, so users of Monterey or
older are expected to get Homebrew Clang instead.

Homebrew Clang 13 also suffers from the same crash. Although I have not
tested on Linux, the backtrace points to the middle-end, so x86_64 is
also likely to be affected. LLVM 14 was released 14 months ago, so it's
not an unreasonable requirement.
2023-05-24 01:20:02 -06:00
Tim Schumacher 0f2b6345c6 test-fuzz: Add all the missing fuzzers 2023-05-23 06:11:33 +02:00
Tim Schumacher 9690b4011b Lagom: Extract the list of fuzzing targets to a separate file 2023-05-23 06:11:33 +02:00
Luke Wilde a5936864d9 LibWeb: Stub AudioContext constructor
This is enough to make Discord not throw up "Well this is awkward" on
login.
2023-05-22 06:07:05 +02:00
Caoimhe fd4f00ee91 AK: Add SPICE_AGENT_DEBUG flag 2023-05-21 18:45:53 +02:00
Andreas Kling cfe663435e LibWeb+LibJS: Don't lazily construct web prototypes in cell constructors
It's not safe to allocate from the GC heap while in the constructor of a
GC heap cell. (Because if this ends up triggering a collection, we may
end up trying to call through an uninitialized vtable).

This was already done safely in the initialize() virtual in much of
LibJS and LibWeb. This patch moves the logic for prototypes, mixins,
and CSSStyleDeclaration as well.

Fixes a long-standing GC crash that was pretty easy to reproduce by
refreshing https://vercel.com/
2023-05-21 14:23:58 +02:00
Ben Wiederhake 943ecaede6 LibIPC: Remove redundant IPC::Dictionary type
We already have and use HashMap<DeprecatedString, DeprecatedString>
nearly everywhere, which is essentially equivalent.
2023-05-21 07:53:45 +02:00
Ben Wiederhake 6055eed5a5 xml: Prefer LibFileSystem over DeprecatedFile 2023-05-21 07:50:52 +02:00
Ben Wiederhake f43f83512e Meta: Also run markdown-check on markdown files in each Port subdir 2023-05-21 07:50:09 +02:00
Ben Wiederhake 2a051738ca Base: Move user nona from group 200 into existing group users
It seems that group 200 never existed, and group 100=users always did:
90bab5ea71
2023-05-20 14:40:24 +02:00
Ben Wiederhake 3be7d393b6 IPCCompiler: Nicer error message for invalid template spelling 2023-05-19 23:45:05 +02:00
Tim Schumacher e2ec8f6584 Fuzzers: Add a fuzzer for roundtrip LZMA compression/decompression 2023-05-19 23:40:33 +02:00
Ben Wiederhake 5cfa883b9f LibUnicode: Explicitly mark HashMap copy 2023-05-19 22:33:57 +02:00
Ben Wiederhake 3cc98a32cf LibLocale: Avoid unnecessary HashMap copy 2023-05-19 22:33:57 +02:00
kleines Filmröllchen b73b4d7533 Meta: Build abench on Lagom
This makes it possible to test audio decoding without much I/O overhead.
2023-05-18 07:05:25 -07:00
kleines Filmröllchen 79e76ae64c Meta/ShellCompletions: Use standard Serenity comment style 2023-05-17 12:55:15 +02:00
kleines Filmröllchen e01941b41c Meta/ShellCompletions: Complete binaries for run lagom
This completion only works if you have lagom already built in some
capacity, since it scans the build directory tree for binaries, removing
known false positives. However, that is both more accurate than asking
ninja for the targets and filtering those, and it also makes it
independent of the build system used.
2023-05-17 12:55:15 +02:00
kleines Filmröllchen 97c95eca88 Meta/ShellCompletions: Mention $SERENITY_ARCH in target completions 2023-05-17 12:55:15 +02:00
kleines Filmröllchen 418f1f82e7 Meta/ShellCompletions: Add toolchain completion
This is very convenient for anyone like me who regularly runs the Clang
toolchain. The toolchain is not completed for Lagom and the
toolchain-independent help command.
2023-05-17 12:55:15 +02:00
kleines Filmröllchen ef7afd8331 Meta/ShellCompletions: Complete command list
The command list was missing the help command, and the command order
was different from the help output.
2023-05-17 12:55:15 +02:00
Daniel Bertalan 0cbcdb227f Meta: Make SERENITY_RUN=ci work with AArch64
This in turn enables `./Meta/serenity.sh test aarch64` and the CI
scripts to work with the AArch64 port.

As the RPi doesn't have a debugcon-like device, we create two serial
devices. The system console, UART0 is redirected to `debug.log`, while
UART1 is made available to the userspace and is used as the stdout for
the test runner script.

We are not yet able to run the full test suite, as the kernel panics due
to some unimplemented features.

Note that Qemu `master` or our patched Qemu build is required for
`SystemServer` to recognize the `system_mode=self-test` parameter.
2023-05-17 01:32:43 -06:00
Tim Schumacher df071d8a76 LibCompress: Add a lot of debug logging to LZMA 2023-05-17 09:08:53 +02:00
Tim Schumacher 7ab0de9190 Meta: Only enable the SPICE server when using the SPICE display
Newer versions of QEMU prevent the user from running a GL-rendered
display while a SPICE display is active due to incompatibilities.

Since there is no way to disable QEMUs (apparently implicit) SPICE
display, make sure that we only enable SPICE support if the user
requested running with SPICE specifically. In this case, QEMU picks the
default SPICE client instead of rendering a display using whatever our
default on that platform would be.
2023-05-17 08:53:57 +02:00
Karol Kosek 5035378b03 Meta: Copy GML source files to serenity install
We already install C++ source files to allow debugging applications
in HackStudio.

Installing GML files can make editing application widgets a bit faster
and easier, as you no longer need to copy files to the system. :^)
2023-05-16 12:57:34 +01:00
Ben Wiederhake 173f872cda Meta: Remove unused debug flags, add missing GENERATE_DEBUG
Commands that were helpful while investigating this:
```
grep -P '^set' Meta/CMake/all_the_debug_macros.cmake \
  | sed -Ee 's,set\((.+) ON\)$,\1,' > macros.lst
for i in $(cat macros.lst); do
  echo -n "$i "; git grep -Pn '\b'"$i"'\b' | wc -l
done | tee matches.lst
sort -k2 -n matches.lst
```
2023-05-14 16:01:57 -06:00
Ben Wiederhake c56481e73f Meta: Make *.in files accessible to QtCreator 2023-05-14 16:01:57 -06:00
MacDue 7f3b98093e Meta: Enable DWARF 5 debug information
For our use case DWARF 5 seems to work fine now (see previous commit)
2023-05-14 09:21:08 +02:00
Fabian Dellwing 639aee037f Userland+Meta: Add new helper program for network settings
This little program allows us to take the NetworkSettings app away
from being an elevated GUI app.

It receives a JsonObject on STDIN and writes it to the global
Network configuration file.

If the write was successfull it will apply the changes.
2023-05-13 17:59:37 -06:00
Luke Wilde d088619560 LibWeb: Capture realm in dictionary to C++ conversion
Some types use the realm when converting to C++, such as unions.
2023-05-13 16:31:10 +02:00
Ben Wiederhake da394abe04 LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr
This prevents callers from accidentally discarding the result of
initialize(), which was the root cause of this OSS Fuzz bug:

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55896&q=label%3AProj-serenity&sort=summary
2023-05-12 09:40:24 +01:00
Lucas CHOLLET 8c34959b53 AK: Add the Input word to input-only buffered streams
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-09 11:18:46 +02:00
Andreas Kling 15211cd753 Userland: Show "Ladybird" instead of "Browser" in titles, menus, etc
While the binary is still called "Browser" for now, let's make it clear
that we're converging on a single name for this application.
2023-05-09 06:12:09 +02:00
Kenneth Myhra 36c892ae14 Meta: Add get_number_of_processing_units() to shell_include.sh
This adds the method get_number_of_processing_units() which returns the
number of processing units the system has available.
2023-05-07 14:29:25 +02:00
Sam Atkins f4d8a24fe4 LibWeb: Propagate errors from parse_css_value and property_initial_value 2023-05-06 08:07:28 +02:00
Andreas Kling 4b5cbe7931 Ladybird: Use vector icons in the browser toolbar
We now load SVG icons (via the Qt resource system) and render them into
a QIcon (with normal and disabled variants) using system colors.
We also re-render them if the system color theme changes.

This instantly makes Ladybird look less foreign on my Linux box.

I drew the icons myself, and they could definitely be more optimized,
but this was my first time using Inkscape. :^)
2023-05-05 16:58:08 +02:00
Daniel Bertalan 00b4976f2c Everywhere: Make Lagom build with GCC 13
GCC 13 was released on 2023-04-26. This commit fixes Lagom build errors
when using an updated host toolchain:
- Adds a workaround for a bug in constraint handling, which made LibJS
  fail to compile: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109683
- Silences the new `-Wdangling-reference` diagnostic globally. It
  produces multiple false positives with no clear way to silence them
  without `#pragmas`.
- Silences `-Wself-move` in `RefPtr` tests as GCC 13 adds this
  previously Clang-exclusive warning.
2023-05-02 07:03:57 -04:00
Matthew Olsson 48d92eecac Lagom: Enforce GC-allocated fields are visited in LibJSGCVerifier 2023-04-30 06:04:33 +02:00
Matthew Olsson 98ed74087f Lagom: Enforce uniform calls to Base::visit_edges in LibJSGCVerifier
This ensures that all visit_edges implementations include a call to
Base::visit_edges. In particular, this gives three nice benefits:

  - The call can't be forgotten (the main benefit, of course).
  - All of the calls look the same. In other words, always use "Base"
    instead of the actual concrete class.
  - Ensure the object has a call to JS_CELL or JS_OBJECT in the
    definition. Otherwise, Base will not be defined and the call will
    not compile.
2023-04-30 06:04:33 +02:00
Tim Schumacher 9ab598af49 Revert "Kernel/x86: Bake the Prekernel and the Kernel into one image"
Some hardware/software configurations crash KVM as soon as we try to
start Serenity. The exact cause is currently unknown, so just fully
revert it for now.

This reverts commit 897c4e5145.
2023-04-28 23:24:19 +02:00
MacDue a5fa5e55ef LibWeb: Allow specifying a URL for an SVG fill
This does not do anything yet, but will allow for gradients later!
2023-04-28 09:42:28 +02:00
Liav A 897c4e5145 Kernel/x86: Bake the Prekernel and the Kernel into one image
The new baked image is a Prekernel and a Kernel baked together now, so
essentially we no longer need to pass the Prekernel as -kernel and the
actual  kernel image as -initrd to QEMU, leaving the option to pass an
actual initrd or initramfs module later on with multiboot.
2023-04-28 09:23:30 +02:00
Ali Mohammad Pur 7e6341587b AK+Everywhere: Disallow Error::from_string_view(FooString)
That pattern seems to show up a lot in code written by people that
aren't intimately familiar with the lifetime model of Error and Strings.
This commit makes the compiler detect it and present a more helpful
diagnostic than "garbage string at runtime".
2023-04-28 05:55:20 +02:00
Matthew Olsson b57b3c54cc LibWeb: Add ReadableStreamBYOBReader to ReadableStreamReader type 2023-04-27 07:57:53 +02:00
Lucas CHOLLET c50b072852 IPCMagicLinter: Port to Core::File 2023-04-27 07:26:32 +02:00
Lucas CHOLLET b35a6b206b IPCMagicLinter: Use LibMain 2023-04-27 07:26:32 +02:00
Ali Mohammad Pur 7e4e9fdb8f LibWasm: Start implementing WASI
This commit starts adding support for WASI, along with the framework to
implement all the functions (though only a couple are currently
implemented).
2023-04-26 03:47:15 +03:30
Kenneth Myhra 9ef3704ce8 Meta: Use common method exit_if_running_as_root() in serenity.sh
This replaces the inline check for running as root with the common
method exit_if_running_as_root().
2023-04-25 01:53:42 -06:00
Kenneth Myhra b4a0fee03d Meta: Add exit_if_running_as_root() to shell_include.sh
This adds the method exit_if_running_as_root() which checks if the
script is executed under root, and if that's the case exits the script.
2023-04-25 01:53:42 -06:00
Zaggy1024 ba5bf412e5 LibThreading: Create WorkerThread class run a single task concurrently
This class can be used to run a task in another thread, and allows the
caller to wait for the task to complete to retrieve any error that may
have occurred.

Currently, it doesn't support functions returning a value on success,
but with some template magic that should be possible. :^)
2023-04-23 23:14:30 +02:00
Aliaksandr Kalenik 8cf0cc4d0a Meta: Add coreutils in macos Azure setup
coreutils include timeout tool that is going to be used in layout
tests script.
2023-04-21 11:00:21 +01:00
Luke Wilde 1b6492d0fb LibWeb: Return typed array and ArrayBuffer for BufferSource in IDL union
Previous this ignored typed arrays and ArrayBuffer, hitting the
fallback JS -> C++ conversion case, typically stringifying them.
2023-04-21 07:59:50 +02:00
Nico Weber 8f988b7bae Meta: Move more common flags to common_compile_options.cmake
For the most part no behavior change, except that we now pass
-Wno-implicit-const-int-float-conversion and -Wno-literal-suffix
only to clang and gcc each in both lagom and serenity builds,
while we previously passed them to both in lagom builds (and
passed them to one each in serenity builds). The former is
a clang flag, the latter a gcc flag, but since we also use
-Wno-unknown-warning-option it doesn't really matter.
2023-04-18 10:05:49 +02:00
Matthew Olsson c40109628d LibWeb: Properly reject abrupt completion in clean_up_on_return 2023-04-17 10:27:40 +02:00
Nico Weber 4aaefeb1d5 Meta: Move some flags to common_compile_options.cmake
No behavior change.
2023-04-17 00:52:21 +02:00
Tim Schumacher f7ac121ac4 Meta: Allow overriding the calculated disk image inode count 2023-04-15 19:41:08 -07:00
Tim Schumacher e887989c23 Meta: Add missing quotation marks for INODE_COUNT and INODE_SIZE 2023-04-15 19:41:08 -07:00
Linus Groh aff1ec6014 LibJS: Port iterator_step() to GCPtr 2023-04-15 16:23:03 +02:00
Tim Schumacher dcd462a050 Lagom: Add an option for standalone fuzzers to BuildFuzzers.sh
This builds simple fuzzing binaries without any oss-fuzz specific
configuration and without any LibFuzzer instrumentation.
2023-04-14 16:08:00 +01:00
Linus Groh b33b0d60e6 LibJS: Port Value::get_method() to GCPtr 2023-04-14 09:59:29 +02:00
Linus Groh f345f72b55 LibJS: Port Value::to_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Timothy Flynn f80c05424e LibLocale: Update to CLDR version 43.0.0
https://cldr.unicode.org/index/downloads/cldr-43
2023-04-13 18:22:04 +02:00
Timothy Flynn 0b69e9f974 LibLocale: Prepare locale data generator for breaking changes in CLDR 43
In CLDR 42 and earlier, we were able to assume all cldr-localename files
existed for every locale. They now do not exist for locales that don't
provide any localized data. Namely, this is the "und" locale (which is
an alias for the root locale, i.e. the locale we fall back to when a
user provides an unknown locale).

Further, we were previously able to assume that each currencies.json in
cldr-numbers contained all currencies. This file now excludes currencies
whose localized names are the same as the currency key. Therefore, we
now preprocess currencies.json to discover all currencies ahead of time,
much like we already do for languages.json.
2023-04-13 18:22:04 +02:00
Linus Groh 2555d7a36a LibJS: Make well-known symbol getters return NonnullGCPtr
None of these are ever null after the VM has been initialized, as proved
by virtually every caller immediately dereferencing the raw pointer.
2023-04-13 14:29:42 +02:00
Linus Groh b84f8fb55b LibJS: Make intrinsics getters return NonnullGCPtr
Some of these are allocated upon initialization of the intrinsics, and
some lazily, but in neither case the getters actually return a nullptr.

This saves us a whole bunch of pointer dereferences (as NonnullGCPtr has
an `operator T&()`), and also has the interesting side effect of forcing
us to explicitly use the FunctionObject& overload of call(), as passing
a NonnullGCPtr is ambigous - it could implicitly be turned into a Value
_or_ a FunctionObject& (so we have to dereference manually).
2023-04-13 14:29:42 +02:00
Tim Schumacher ad60a0b522 Fuzzers: Stop loading audio frames once the end is reached
Previously, the condition was reversed, so we would stop immediately on
a file that has at least one working chunk, and we would infinitely loop
on a file with no chunks.
2023-04-12 14:03:20 -04:00
Coderdreams 38bdf4d159 Meta: Do not require Tmux for lagom gdb 2023-04-11 07:16:25 -04:00
Daniel Bertalan 5ca1bd55a0 Toolchain: Move GDB build to a separate script
Target GDB is only used for debugging the kernel, which is not relevant
to most people. Starting with 924758c6f8, GDB would always be built
as part of the toolchain if the user didn't have it installed. This is
unnecessary.

This commit adds a separate script for building GDB, which the user
needs to explicitly invoke. A message is added to Meta/debug-kernel.sh
which alerts the user to this fact.
2023-04-11 06:44:13 -04:00
Cameron Youell 1c54c8a01c ConfigureComponents: Use FileSystem instead of DeprecatedFile 2023-04-09 20:58:54 -06:00
Ben Wiederhake 560133a0c6 Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
Tim Schumacher 83701ec54b Meta+Toolchain: Redirect GDB error output to stdout before grepping 2023-04-09 16:51:11 +02:00
Tim Schumacher 022a55e825 Meta: Add a missing dash to the GDB detection code 2023-04-09 16:51:11 +02:00
Liav A 9f217222b7 Meta: Run the QEMU ISA-PC machine with a 64-bit capable CPU
When we had 32 bit support in the OS kernel and userland, the very bare
minimum CPU we supported was Pentium 3, but now the CPU is just required
to support x86-64 long mode to be supported, so the exact model is not
very important.

I chose the QEMU64 virtual CPU model, because the whole concept of the
QEMU ISA-PC machine is that it checks how the kernel handles arbitrarily
old hardware setup.
2023-04-09 10:25:20 +02:00
Nico Weber a34b300393 Fuzzers: Add a WebP fuzzer 2023-04-08 18:58:14 +02:00
Timothy Flynn 44cf92616e LibTimeZone: Update to TZDB version 2023c
https://mm.icann.org/pipermail/tz-announce/2023-March/000079.html
2023-04-07 20:52:01 +02:00
Timothy Flynn 3f1badf9b2 LibWeb: Implement VideoTrack and VideoTrackList
This implements the IDL for these types and some event handling around
them.
2023-04-07 16:02:22 +02:00
Matthew Olsson bdab61ad93 LibWeb: Add the WritableStreamDefaultWriter interface 2023-04-06 22:54:58 +02:00
Luke Wilde 6ebdb9f824 LibWeb: Implement the HTMLConstructor extended attribute 2023-04-06 11:36:56 +02:00
Luke Wilde e3c3cc9e19 LibWeb: Implement the CEReactions extended attribute 2023-04-06 11:36:56 +02:00
Luke Wilde 686e3a0d94 LibWeb: Support returning a callback function in IDL 2023-04-06 11:36:56 +02:00
stelar7 d527edf0ab LibTLS: Change Certificate parsing to use ErrorOr
Loads of changes that are tightly connected... :/
* Change lambdas to static functions
* Add spec docs to those functions
* Keep the current scope around as a parameter
* Add wrapping classes for some Certificate members
* Parse ec and ecdsa data from certificates
2023-04-06 09:57:31 +03:30
Daniel Bertalan 924758c6f8 Toolchain+Meta: Support kernel debugging with host AArch64 GDB
Previously, we would unconditionally build GDB from source for the
AArch64 toolchain. This commit makes it possible to use the system's
`gdb` binary if it supports the architecture, or `aarch64-elf-gdb` if
such a package is installed.

An `aarch64-elf-gdb` package will be available through Homebrew once
this PR is merged: https://github.com/Homebrew/homebrew-core/pull/127323
2023-04-03 19:56:09 -06:00
MacDue de4ab4f69e Meta: Lazily initialize initial property values
This solves the longhands must be initialized before shorthands
problem by just initializing the value when it is first requested.

This will be needed for background-position-x/y which is a longhand
of a longhand, which otherwise breaks the longhands before shorthands
rule.
2023-04-03 07:10:33 +02:00
Andrew Kaster 875c3d109f Meta: Check if SERENITY_USE_SDCARD is set before checking its value
This avoids a bash complaint for the new option
2023-04-02 13:07:31 -06:00
Marco Cutecchia f7608ba269 Meta: Add SERENITY_USE_SDCARD to boot from an SD card 2023-04-02 12:43:17 -06:00
Idan Horowitz 8da31764b9 Meta: Enable asm-view symbol demangling in the gdb kernel debug script
This makes sure that symbol names are demangled in the assembly view.
2023-04-02 20:05:17 +03:00
Idan Horowitz b8437a03e7 Meta: Update AArch64 kernel base address in the gdb kernel debug script
The correct value for now is 0, since the AArch64 linker script uses
a hard-coded memory layout, so the offset is already automatically
applied.
2023-04-02 20:05:17 +03:00
Matthew Olsson 36ca1386e8 LibWeb: Add ReadableStream.locked/cancel()/getReader() 2023-04-01 23:43:07 +01:00
Matthew Olsson f99d6e177f IDLGenerators: Support nullable double values 2023-04-01 23:43:07 +01:00
Tim Schumacher afa158bf99 Lagom: Add targets for lzcat, xzcat and tar 2023-03-30 14:39:31 +02:00
Timothy Flynn a944eed013 CI: Bump clang used by the Fuzzer build to clang-15
This is required for an upcoming use of a constexpr function.
2023-03-29 07:19:14 +02:00
Andrew Kaster 1c01856021 Meta: Diable Wshorten-64-to-32 explicitly to silence Xcode defaults
Xcode will set this by default when creating a new project unless we
set an xcode property to disable it. Instead of doing that, disable
it globally.
2023-03-28 09:18:50 +01:00
Cameron Youell 0471ec0567 Toolchain: Update binutils to version 2.40 2023-03-27 16:13:48 +01:00
Aliaksandr Kalenik 9220cdc285 LibHTTP+WebDriver+WebServer: Return error from HTTP request parser 2023-03-26 17:56:17 +02:00
Timothy Flynn 04b51e39d6 LibTimeZone: Update to TZDB version 2023b
https://mm.icann.org/pipermail/tz-announce/2023-March/000078.html
2023-03-26 15:43:40 +01:00
Nico Weber ee6843a13c Meta: Add "gunzip" and "gzip" to lagom build
This makes it easy to compare the performance of Serenity's
deflate implementation to the host system implementation.

On my M1 Max MBP:

    % time gunzip -c \
        /Users/thakis/Downloads/trace_bug.json.gz > /dev/null

takes between 0.064s and 0.082s.

    % time Build/lagom/gunzip -c \
        /Users/thakis/Downloads/trace_bug.json.gz > /dev/null

on the other hand takes 4 seconds.

(That .gz file is a 5.8M file -- the largest .gz file that happend to be
in my Downloads folder.)
2023-03-25 21:42:50 +00:00
Jelle Raaijmakers e18c87c60c Meta: Make audio hardware configurable through environment variable
The new environment variable `SERENITY_AUDIO_HARDWARE` accepts the
values `ac97` and `intelhda` (default).
2023-03-25 21:27:03 +01:00
Jelle Raaijmakers dd0a25de4d Meta: Use more aptly named variable for PC speaker configuration 2023-03-25 21:27:03 +01:00
Jelle Raaijmakers dd8fa73da1 Kernel: Add support for Intel HDA
This is an implementation that tries to follow the spec as closely as
possible, and works with Qemu's Intel HDA and some bare metal HDA
controllers out there. Compiling with `INTEL_HDA_DEBUG=on` will provide
a lot of detailed information that could help us getting this to work
on more bare metal controllers as well :^)

Output format is limited to `i16` samples for now.
2023-03-25 21:27:03 +01:00
Sam Atkins 4b711932cc LibWeb: Split PercentageStyleValue out of StyleValue.{h,cpp} 2023-03-25 16:56:04 +00:00
Marco Cutecchia f3363c1088 Meta: Run aarch64 with the disk image in the SD card slot
Co-authored-by: Timon Kruiper <timonkruiper@gmail.com>
Co-authored-by: Ollrogge <nils-ollrogge@outlook.de>
2023-03-25 16:50:36 +00:00
Luke Wilde cbe0901706 LibWeb: Implement performance.mark and performance.clearMarks 2023-03-23 21:00:43 +00:00
Luke Wilde 31b507afbf LibWeb: Introduce Performance Timeline and its Performance functions 2023-03-23 21:00:43 +00:00
Luke Wilde cb1deebc8f LibWeb: Implement the [Default] object toJSON() operation 2023-03-23 21:00:43 +00:00
Srikavin Ramkumar daf421846c LibWeb: Return TypeError for [HTMLConstructor] IDL constructors
This matches the spec since there can be no matching custom element
definition if we don't support custom elements yet.
2023-03-23 13:37:40 +01:00
Lucas CHOLLET 496b7ffb2b LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
Cameron Youell 1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Simon Wanner 63ca149be5 LibWeb: Make [PutForwards] work together with [ImplementedAs] 2023-03-20 20:37:40 -04:00
Tim Schumacher 123e9fa5d0 Lagom: Add a fuzzer for LZMA decompression 2023-03-20 12:15:38 +02:00
Tim Schumacher fb0fd85e97 Meta: Don't install CA certificates during a on-Serenity build
`SERENITYOS` is also set when compiling Lagom on SerenityOS, so we can't
just check it and expect `CMAKE_STAGING_PREFIX` to be set.

Instead, check `CMAKE_STAGING_PREFIX` directly and use that as an
indicator for whether we can install a file there.
2023-03-20 09:33:30 +01:00
Andrew Kaster 5b5a76eadd CI: Add "set -e" to Azure DevOps scripts
Without setting this explicitly in every script, failing script lines in
multiline scripts will not fail the job themselves.
2023-03-19 14:31:10 -06:00
Andrew Kaster 958f9e960d Fuzzers: Use correct type name in FuzzilliJs fuzzer 2023-03-19 14:31:10 -06:00
kleines Filmröllchen 3e2e94bd01 Meta: Specify a working directory for the FLAC spec test on Lagom
The serenity_test function cannot set this up as it has no purpose on
Serenity itself.
2023-03-19 14:15:35 +00:00
kleines Filmröllchen 904a4dd314 Meta: Use extract_tar_path for WASM spec test generation 2023-03-19 14:15:35 +00:00
kleines Filmröllchen d3d93ef1df Meta: Refactor FLAC spec test extraction with extract_tar_path 2023-03-19 14:15:35 +00:00
kleines Filmröllchen a6dd992ad3 Meta: Add a tar extraction CMake wrapper
This is a copy of the zip wrapper adopted for tar archives.
2023-03-19 14:15:35 +00:00
Liav A c66f7f2e7c Meta: Use non-VGA VirtIO GPU variants when running on macOS
It appears that QEMU on macOS doesn't have the VirtIO GPU variants that
support VGA functionality. Those variants are not especially important
to us, because we don't use any kind of VGA functionality in our kernel
anyway.

Therefore, for macOS, we could decide to use virtio-gpu-gl-pci and
virtio-gpu-pci devices instead.
2023-03-19 00:19:06 +00:00
Timothy Flynn 1b260ab1f8 Meta: Move global VM creation to fuzzer "global" structure
Turns out LLVMFuzzerTestOneInput may be called more than once per
process.
2023-03-19 00:15:05 +00:00
Andrew Kaster cabc99e953 Fuzzers: Skip trying to parse invalid UTF-8 in LibJS Fuzzers
Invalid UTF-8 crashes JS::Script::Parse.
2023-03-18 15:56:18 +01:00
Timothy Flynn 5d7a85bc37 Meta: Ensure the main thread VM is created before use in the CSS fuzzer 2023-03-17 16:48:43 +00:00
Timothy Flynn 13dfadba79 LibJS: Propagate errors from VM creation 2023-03-17 16:39:08 +00:00
Luke Wilde 782cdaeccf LibWeb: Give generated constructor functions a name
Required by code that brand checks native constructors.

For example, Wistia brand checks XMLHttpRequest by doing:
```
XMLHttpRequest.prototype.constructor.toString()
```

It then checks if it matches either one of:
```
function XMLHttpRequest() { [native code] }
```
```
[object XMLHttpRequestConstructor]
```

If neither matches, it disables HLS playback and prints:
"The XMLHttpRequest constructor has been tampered with. Because this
affects CORS/Range XHR requests, HLS playback has been disabled.
To enable HLS playback and other important features, please remove code
that changes the definition of window.XMLHttpRequest."

We hit this path due to not giving generated constructors a name, as
we would provide `function () { [native code] }`.
2023-03-17 16:37:21 +00:00
Andreas Kling d38a3ca9eb LibGfx/OpenType: Add some initial support for GPOS glyph positioning
This patch parses enough of GPOS tables to be able to support the
kerning information embedded in Inter.

Since that specific font only applies positioning offsets to the first
glyph in each pair, I was able to get away with not changing our API.
Once we start adding support for more sophisticated positioning, we'll
need to be able to communicate more than a simple "kerning offset" to
the clients of this code.
2023-03-17 09:36:20 +01:00
Timothy Flynn 2cd7159694 LibWeb: Add a custom extended attribute for namespace-level GC visitors
Currently, the WebAssemblyObject implements a visitor to keep its static
objects alive. This custom attribute will be used to hook the generated
namespace object's visitor to one that we define in non-generated code.
2023-03-16 19:39:17 +00:00
Timothy Flynn aa06dd7f21 LibWeb: More fully implement the LegacyNamespace IDL extended attribute
Interfaces with a LegacyNamespace extended attribute should have their
constructors defined on the namespace identified by the LegacyNamespace
attribute value.
2023-03-16 19:39:17 +00:00
Timothy Flynn a277e645d3 LibWeb: Add LibJS includes to generated IDL namespace files
These will be needed by any namespace having a BufferSource parameter,
such as WebAssembly.

Similar to 49e6cb7c3d.
2023-03-16 19:39:17 +00:00
Fabian Dellwing b07654c3c1 Meta: Download cacert.pem at build time 2023-03-16 18:54:20 +03:30
Timothy Flynn 2cfcbccdb5 LibWeb: Port WebAssembly.Table to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn ca96f8e364 LibWeb: Port WebAssembly.Memory to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn de32c44762 LibWeb: Port WebAssembly.Instance to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn fb1f15774f LibWeb: Port WebAssembly.Module to IDL 2023-03-16 13:54:16 +01:00
Timothy Flynn 5c97ffb94f LibWeb: Define WebAssembly namespace and import it in web bindings
This will contain concrete definitions of WebAssembly objects used by
generated WebAssembly IDL.
2023-03-16 13:54:16 +01:00
Timothy Flynn af119d92cb LibIDL+LibWeb: Begin supporting the LegacyNamespace extended attribute
This is used by WebAssembly IDL files. For now, we mostly use this for
error messages and cache keys (to ensure compatibility with existing
code as WebAssembly is ported to IDL).
2023-03-16 13:54:16 +01:00
Timothy Flynn 3a11f65451 LibWeb: Add crude support for dereferencing JavaScript built-ins in IDL
This works similarly to the is_platform_object() helper, in that we do
not know that a type like ArrayBuffer needs to be qualified with JS::.
2023-03-16 13:54:16 +01:00
Timothy Flynn 0d921720b4 LibWeb: Support generating optional object IDL parameters
These are used by WebAssembly IDL.
2023-03-16 13:54:16 +01:00
Timothy Flynn 49e6cb7c3d LibWeb: Add LibJS includes to generated IDL constructor files
These will be needed by any constructor having a BufferSource parameter,
such as WebAssembly.Module.
2023-03-16 13:54:16 +01:00
Andrew Kaster 49b07cda12 CI: Bump Android NDK version used in CI to 25.2.9519653
The previous version is no longer able to compile Lagom

Clang version 14.0.1 in NDK 24.0.8215888 crashes trying to build
Core::Process
2023-03-15 20:36:22 -06:00
Sam Atkins b18c1c7291 LibUnicode: Remove now-unused dir-iterator helper functions 2023-03-15 12:49:33 -04:00
Sam Atkins 414cafa7f8 LibLocale: Migrate code generators to Directory::for_each_entry() 2023-03-15 12:49:33 -04:00
Sam Atkins 8a8ad81aa1 LibUnicode: Migrate GenerateEmojiData to Directory::for_each_entry() 2023-03-15 12:49:33 -04:00
Sam Atkins 8672b380f6 LibUnicode: Read emoji file title from LexicalPath directly
... rather than taking the whole file name, and then manually trimming
the extension off.
2023-03-15 12:49:33 -04:00
Timothy Flynn 020c2b59c4 LibWeb: Support generating IDL namespaces
These are similar to prototypes and constructors in that they will now
be lazily instantiated when they are first requested.
2023-03-15 12:48:25 -04:00
Matthew Olsson 0c7eac8d9a Lagom: Remove debug line in LibJSGCVerifier 2023-03-15 08:48:49 +01:00
Matthew Olsson 7c0c1c8f49 LibJS+LibWeb: Wrap raw JS::Cell*/& fields in GCPtr/NonnullGCPtr 2023-03-15 08:48:49 +01:00
gustrb 5141c86587 AK: Rename CaseInsensitiveStringViewTraits to reflect intent
Now it is called `CaseInsensitiveASCIIStringViewTraits`, so we can be
more specific about what data structure does it operate onto. ;)
2023-03-14 21:34:32 +00:00
Timothy Flynn 9c569e8a0f LibWeb: Implement the [PutForwards] IDL extended attribute
For example, consider the attribute:

    interface Element {
        [PutForwards=value] readonly attribute DOMTokenList classList;
    }

When `classList` is set, we should instead set the attribute `value` on
the `classList` attribute of the Element interface.
2023-03-14 16:30:19 -04:00
Timothy Flynn e6dc3c291e LibWeb: Prevent variadic arguments from reserving heaps of memory
Don't try to reserve capacity for a variadic arguments list unless we
actually have enough arguments to fill it with anything. Otherwise we
may overflow to an extremely large size if, e.g., the argument count
is 0 and the start of the variadic arguments is index 1.
2023-03-14 16:41:35 +00:00
Timothy Flynn 6c5e79ce3a LibWeb: Begin adding support for Function IDL types in unions
For example, setTimeout/setInterval use a TimerHandler, which is a union
of (DOMString or Function).
2023-03-14 09:07:40 -04:00
Timothy Flynn 50717ce404 LibWeb: Support variadic "any..." parameters in IDL
For example, this is used by setTimeout/setInterval.
2023-03-14 09:07:40 -04:00
kleines Filmröllchen 0563048949 file: Read more metadata from audio files
We can always read the basic format information (sample rate, bit depth,
etc.), but we will also print artist, album, and title if available in
the metadata.
2023-03-13 12:35:17 -04:00
Daniel Bertalan b668000e44 Meta+Documentation: Allow cross-debugging x86_64 Serenity on M1 Macs
While there is no native GDB on Apple Silicon, a cross-debugger that
supports x86-64 does exist.
2023-03-13 17:02:56 +01:00
Tim Schumacher 8032724574 CodeGenerators: Ensure that we always print the entire generated output 2023-03-13 15:16:20 +00:00
Tim Schumacher a3f73e7d85 AK: Rename Stream::read_entire_buffer to Stream::read_until_filled
No functional changes.
2023-03-13 15:16:20 +00:00
Tim Schumacher d5871f5717 AK: Rename Stream::{read,write} to Stream::{read_some,write_some}
Similar to POSIX read, the basic read and write functions of AK::Stream
do not have a lower limit of how much data they read or write (apart
from "none at all").

Rename the functions to "read some [data]" and "write some [data]" (with
"data" being omitted, since everything here is reading and writing data)
to make them sufficiently distinct from the functions that ensure to
use the entire buffer (which should be the go-to function for most
usages).

No functional changes, just a lot of new FIXMEs.
2023-03-13 15:16:20 +00:00
kleines Filmröllchen 264cc76ab4 LibAudio: Move audio stream buffering into the loader
Before, some loader plugins implemented their own buffering (FLAC&MP3),
some didn't require any (WAV), and some didn't buffer at all (QOA). This
meant that in practice, while you could load arbitrary amounts of
samples from some loader plugins, you couldn't do that with some others.
Also, it was ill-defined how many samples you would actually get back
from a get_more_samples call.

This commit fixes that by introducing a layer of abstraction between the
loader and its plugins (because that's the whole point of having the
extra class!). The plugins now only implement a load_chunks() function,
which is much simpler to implement and allows plugins to play fast and
loose with what they actually return. Basically, they can return many
chunks of samples, where one chunk is simply a convenient block of
samples to load. In fact, some loaders such as FLAC and QOA have
separate internal functions for loading exactly one chunk. The loaders
*should* load as many chunks as necessary for the sample count to be
reached or surpassed (the latter simplifies loading loops in the
implementations, since you don't need to know how large your next chunk
is going to be; a problem for e.g. FLAC). If a plugin has no problems
returning data of arbitrary size (currently WAV), it can return a single
chunk that exactly (or roughly) matches the requested sample count. If a
plugin is at the stream end, it can also return less samples than was
requested! The loader can handle all of these cases and may call into
load_chunk multiple times. If the plugin returns an empty chunk list (or
only empty chunks; again, they can play fast and loose), the loader
takes that as a stream end signal. Otherwise, the loader will always
return exactly as many samples as the user requested. Buffering is
handled by the loader, allowing any underlying plugin to deal with any
weird sample count requirement the user throws at it (looking at you,
SoundPlayer!).

This (not accidentally!) makes QOA work in SoundPlayer.
2023-03-13 13:25:42 +01:00
Timothy Flynn 11fe34ce0f headless-browser: Re-implement headless-browser using an OOPWV
headless-browser currently uses its own PageClient to load web pages
in-process. Due to this, it also needs to set up a whole bunch of other
objects needed to run LibWeb, e.g. image decoders, request servers, etc.

This changes headless-browser to instead implement a WebView to launch
WebContent out-of-process. This implementation is almost entirely empty,
but can be filled in as-needed. For example, we may want to print
JavaScript console messages.
2023-03-13 07:21:00 +00:00
Nico Weber b10ec6743f Userland: Add an image utility
At the moment, all it can do is read all image formats that LibGfx can
read and save to any image format that LibGfx can write (currently bmp,
png, qoi).

Currently, it drops all image metadata (including color profiles).

Over time, this could learn tricks like keeping color profiles,
converting an image to a different color profile, cropping out a part of
an image, and so on.
2023-03-12 12:17:26 +00:00
Nico Weber 3cff36b7ab Meta+CMake: Remove "image" ninja target in favor of "qemu-image"
"image" was an alias for "qemu-image".

I want to add an `image` userland utility, which clashes with that
shortname.

So remove the existing "image" target. It was just an alias for
"qemu-image".

If you use serenity.sh to build, nothing changes. This only affects you
if you run ninja manually -- you now have to say `ninja qemu-image` to
build the disk image.
2023-03-12 01:48:56 +00:00
Pankaj Raghav a1f2f08764 Meta: Use the correct boot device addressing mode for NVMe devices
Commit: 2c84466ad8 ("Kernel/Storage: Introduce new boot device
addressing modes") changed the way we pass the boot device parameter.

That commit missed updating boot parameter in the run.sh script for NVMe
boot devices.
2023-03-11 13:15:00 +00:00
Andrew Kaster b996e15d9d CI: Remove stale dependence on Toolchain.yml from nightly job
We removed this file in 0a7d0362ea but
forgot to update the nightly job.
2023-03-11 05:36:14 -07:00
Andreas Kling af8d5207f6 Meta: Don't check for newlines at EOF in Tests/LibWeb/Layout/ 2023-03-11 13:05:35 +01:00
Andrew Kaster 3d33217d60 Ladybird+CI: Move layout_test.sh test runner from CI yml into CMake
We should be able to run this locally, as long as ENABLE_LAGOM_LADYBIRD
is true, or if building ladybird from the ladybird source directory.

This removes a special case from the Lagom CI yml file.
2023-03-10 23:01:55 +00:00
Andreas Kling a504ac3e2a Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
kleines Filmröllchen 0f7a5006d1 Meta/Lagom: Add a fuzzer for QOA 2023-03-10 04:07:14 -07:00
Andrew Kaster 8f8e04677d Documentation: Reorganize Lagom README and update fuzzer documentation
Add some prose to the introduction of Lagom about how we use it. Also,
move the section on including Lagom in other projects above the fuzzer
documentation.

Remove the explicit cmake commands from the Fuzzer documentation, as the
script should be the source of truth.
2023-03-10 03:48:41 -07:00
Linus Groh f068ddb79f LibIMAP: Propagate OOM errors from decode_quoted_printable() 2023-03-09 14:47:45 +00:00
Kenneth Myhra 680e970597 LibWeb: Move generated #include statement for iterators out of loop
When an IDL file has #imports and the IDL interface exposes an iterator,
the bindings generator would generate #include statements missing the
class name of the iterator in the form 'LibWeb/{namespace}/Iterator'.

This change only generates the iterator #include statement for the top
interface that is the iterator.
2023-03-08 18:57:36 +00:00
Linus Groh 129ab02470 LibWeb/HTML: Port Window.structuredClone() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh 7de9179a6d LibWeb/HTML: Port Window.performance to IDL 2023-03-07 23:33:34 +00:00
Linus Groh 95ce5735ce LibWeb/HTML: Port Window.event to IDL 2023-03-07 23:33:34 +00:00
Linus Groh e13f89c9eb LibWeb: Generate setter for [Replaceable] IDL attributes
The code is directly stolen from the REPLACEABLE_PROPERTY_SETTER() macro
which will hopefully be removed soon.
2023-03-07 23:33:34 +00:00
Linus Groh 3316d247bf LibWeb: Support interfaces with the [Global] extended attribute
These are treated differently as the interface members are placed on the
object itself, not its prototype.
As the object itself still needs to be hand-written code, and we can no
longer fully hide the gnarly generated code in the prototype object,
these now generate a 'mixin' class that is added to the actual object
through inheritance.

https://webidl.spec.whatwg.org/#Global
2023-03-07 23:33:34 +00:00
Linus Groh de83f5422d LibWeb: Generate Window{Constructor,Prototype} from IDL
The Window object is massive, so let's do the conversion to IDL step
by step. First up: getting rid of the manual constructor and prototype
definitions, which can be generated from an empty `interface Window`.
2023-03-07 23:33:34 +00:00
Luke Wilde f7ff1fd985 LibWeb: Remove CSS::Parser::ParsingContext's default constructor
This relied on pulling the current realm from the main thread VM, which
requires an execution context to be on the VM's stack. This heavily
relied on the dummy execution context that is always on the stack, for
example, when parsing the UA style sheets where no JavaScript is
running.
2023-03-07 11:51:12 +00:00
Andreas Kling 8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Matthew Olsson b33b950e45 Lagom: Add a tool to verify correctness of the LibJS GC
This is implemented as a Clang frontend tool, and currently does two
things:
  - Ensure for all fields wrapped in {Nonnull,}GCPtr<T>, T inherits from
    JS::Cell
  - Ensure for all fields not wrapped in {Nonnull,}GCPtr, that the type
    does not inherit from JS::Cell (otherwise it should be wrapped in a
    Ptr class).

In the future, this tool could be extended further. For example, we may
consider validating all implementations of Cell::visit_impl.
2023-03-06 13:05:43 +00:00
Sam Atkins 774f328783 LibCore+Everywhere: Return an Error from DirIterator::error()
This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
2023-03-05 20:23:42 +01:00
Timothy Flynn ca2b030336 LibUnicode: Use binary search for lookups into the generated emoji data
This sorts the array of generated emoji data by code point (first by
code point length, then by code point value). This lets us use a binary
search to find emoji data, rather than the current linear search.

In a profile of scrolling around /home/anon/Documents/emoji.txt, this
reduces the runtime of Gfx::Emoji::emoji_for_code_points from 69.03% to
28.42%. Within that, Unicode::find_emoji_for_code_points reduces from
28.42% to just 1.95%.
2023-03-05 16:44:20 +01:00
Linus Groh 2bc54ae56a LibWeb: Remove unused SourceGenerator mappings 2023-03-05 15:37:33 +00:00
Linus Groh 65b1229dae LibWeb: Don't use C++ name for error messages in generated bindings 2023-03-05 15:37:33 +00:00
Linus Groh a430d78843 LibWeb: Use 'Base::initialize()' in generated bindings 2023-03-05 15:37:33 +00:00
nipos d6fd97e8fb Meta: Link to libnsl and libsocket on Solaris in Lagom CMakeLists 2023-03-04 21:34:54 -07:00
Andrew Kaster 9fb781d7db Base+Meta: Remove invalid symlinks from Base for more and env
These symlinks' only purpose was to be copied into the rootfs along with
the rest of Base. Instead of storing symlinks to files that either
don't exist in the Base directory, or point to an absolute path outside
of the serenity folder, move these symlinks into the
build-root-filesystem.sh script.
2023-03-04 15:18:57 +01:00
Sam Atkins 3d8cc2257f LibCMake: Introduce a CMake lexer 2023-03-04 05:43:43 -07:00
Timothy Flynn 03f32bdf86 LibUnicode: Validate that all emoji images in /res/emoji actually exist
This will raise a compile error if an emoji image was neglected to be
added to e.g. emoji-serenity.txt, or if the code points are not correct.
2023-03-03 17:09:58 +00:00
Linus Groh f561940e54 LibWeb: Fix duplicate enum-to-string conversion in generated code
This regressed in e3a9ed0.
2023-03-03 09:25:34 +00:00
Kenneth Myhra c0559e8a10 LibWeb: Handle optional return values for getters returning new String 2023-03-01 22:44:20 +00:00
Kenneth Myhra 98705ecf71 LibWeb: Add new String support for parameters with empty string defaults
This adds new string support for parameters with an optional default
value of empty string ("").
2023-03-01 22:44:20 +00:00
Timothy Flynn fd1fbad1d2 LibGfx+LibUnicode: Support specifying the path to search for emoji
Similar to the FontDatabase, this will be needed for Ladybird to find
emoji images. We now generate just the file name of emoji image in
LibUnicode, and look for that file in the specified path (defaulting to
/res/emoji) at runtime.
2023-03-01 14:54:16 +00:00
Linus Groh 51c3967516 Everywhere: Use '_{short_,}string' literals more
This mostly updates code what was written before but merged after these
were added.
2023-02-28 15:15:36 +00:00
Sam Atkins c06f4ac6f5 AK+Everywhere: Make GenericLexer::ignore_until() stop before the value
`consume_until(foo)` stops before foo, and so does
`ignore_until(Predicate)`, so let's make the other `ignore_until()`
overloads consistent with that so they're less confusing.
2023-02-28 12:55:10 +00:00
Ali Mohammad Pur db886fe18b Userland+AK: Stop using getopt() for ArgsParser
This commit moves the implementation of getopt into AK, and converts its
API to understand and use StringView instead of char*.
Everything else is caught in the crossfire of making
Option::accept_value() take a StringView instead of a char const*.

With this, we must now pass a Span<StringView> to ArgsParser::parse(),
applications using LibMain are unaffected, but anything not using that
or taking its own argc/argv has to construct a Vector<StringView> for
this method.
2023-02-28 15:52:24 +03:30
Luke Wilde e3a9ed0c26 LibWeb: Make [UseNewAKString] work for enums and stringifiers 2023-02-27 20:55:09 +01:00
kleines Filmröllchen bd1cecb991 Meta: Lower QEMU DirectSound driver timer period to 2ms
10ms (the default) is ridiculous and causes all kinds of glitches if we
actually want to have a low-latency queue.
<https://gitlab.com/qemu-project/qemu/-/issues/1076#note_996636777>
suggests 2ms (and no lower than 1ms). This improves audio glitch
resistance at our current 512 sample buffer size, but going lower is
still not possible.
2023-02-26 22:27:42 +01:00
Andrew Kaster ce500ed170 Lagom: Look for clang the same way serenity.sh does in BuildFuzzers.sh
Also note that Xcode does not ship libfuzzer and is not usable for
a fuzzer build.
2023-02-26 08:11:08 +00:00
Ali Mohammad Pur 6b50f23242 LibWasm+LibWeb: Sneak a JS::Completion into Wasm::Result
Imported functions in Wasm may throw JS exceptions, and we need to
preserve these exceptions so we can pass them to the calling JS code.

This also adds a `assert_wasm_result()` API to Result for cases where
only Wasm traps or values are expected (e.g. internal uses) to avoid
making LibWasm (pointlessly) handle JS exceptions that will never show
up in reality.
2023-02-26 10:54:23 +03:30
Kenneth Myhra 2facb0e8ed BindingsGenerator: Use JS::Value::to_string() when new String
Make sure to use JS::Value::to_string() when the IDL interface is marked
with the extended attribute UseNewAKString.
2023-02-26 00:27:22 +01:00
Kenneth Myhra 99f094905e BindingsGenerator: Conditionally check dictionary member is string
This adds the condition member.type->is_string() to the if statement, so
that we now conditionally check the dictionary member is a new string
and associated with an optional constructor parameter.
2023-02-26 00:27:22 +01:00
Linus Groh 09d40bfbb2 Everywhere: Use _{short_,}string to create Strings from literals 2023-02-25 20:51:49 +01:00
kleines Filmröllchen 956450df00 Meta: Document how to manipulate CMake caches for the fuzzing build 2023-02-25 19:39:04 +01:00
kleines Filmröllchen 5ec5c68ed4 Meta: Allow disabling LibWeb fuzzers
The LibWeb fuzzer build is really slow, so for local builds it is useful
to disable it when you're not interested in running that fuzzer.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2023-02-25 19:39:04 +01:00
Nico Weber 41980675f2 Lagom: Build file in lagom builds 2023-02-25 15:00:23 +01:00
Nico Weber b07e9d4c8a Lagom: Build LibELF on arm64
This seems to build fine now on Arm Macs.
2023-02-25 15:00:23 +01:00
MacDue 727218ff4a LibTimeZone: Propagate try_append() errors while building timezone data 2023-02-24 22:18:25 +01:00
MacDue 01fa3bb788 LibUnicode: Propagate try_append() errors when building emoji data 2023-02-24 22:18:25 +01:00
Timothy Flynn 8c38d46c1a LibUnicode: Generate the path to emoji images alongside emoji data
This will provide for quicker emoji lookups, rather than having to
discover and allocate these paths at runtime before we find out if they
even exist.
2023-02-24 19:48:47 +01:00
Nico Weber f7e152d049 LibGfx: Add scaffolding for a webp decoder
At the moment, this processes the RIFF chunk structure and extracts
the ICCP chunk, so that `icc` can now print ICC profiles embedded
in webp files. (And are image files really more than containers
of icc profiles?)

It doesn't even decode image dimensions yet.

The lossy format is a VP8 video frame. Once we get to that, we
might want to move all the image decoders into a new LibImageDecoders
that depends on both LibGfx and LibVideo. (Other newer image formats
like heic and av1f also use video frames for image data.)
2023-02-24 19:44:20 +01:00
Andrew Kaster 35b07048ef CI: Make sure to brew update in macOS Azure setup
This picks up any upstream brew changes that haven't been pulled into
the default Azure VMs. For example, the ffmpeg dependency of qt is
currently broken in the 8 day old brew commit they are using.
2023-02-24 02:39:26 -07:00
Andrew Kaster 1b24fa5829 CI+Lagom: Use the same options for running test-wasm in ctest and CI
Make sure that we set SERENITY_SOURCE_DIR in ctest, and make sure to
pass the test root to the CI job.

More overhaul of test-js 'test root' finding is needed however.
2023-02-24 00:02:25 -07:00
Kenneth Myhra 836cb73d29 BindingsGenerator: Release value setting members of dictionary
When a constructor has an optional dictionary as argument, and those
members are of type new string, make sure that we release_value()
setting the dictionary members.
2023-02-23 15:48:38 +00:00
Kenneth Myhra 98ef76b144 BindingsGenerator: Pass optional values as 'sv' to String::from_utf8()
Pass optional values as StringView to String::from_utf8(), otherwise
this would not compile.
2023-02-23 15:48:38 +00:00
Kenneth Myhra 511ce240f2 BindingsGenerator: Allow stringifier to return DOMException if needed 2023-02-23 15:48:38 +00:00
MacDue 56d8e36698 Lagom: Include AccessibilityTreeModel in LibWebView
This will be needed for the accessibility inspector in Ladybird.
2023-02-22 22:00:40 +00:00
Kenneth Myhra e776171d8f LibWeb: Allow prototype.{entries keys,value} to propagate errors
This allows the prototype.{entries keys,value} native functions
generated by the BindingsGenerator to propagate errors if needed.
2023-02-22 09:55:33 +01:00
Kenneth Myhra 3689d58c64 LibWeb: Allow EventListener/NodeFilter path to propagate errors
This allows the EventListener/NodeFilter path of the BindingsGenerator
to propagate errors if needed.
2023-02-22 09:55:33 +01:00
Andreas Kling f11899f885 LibWeb+LibIDL: Fix (or paper over) various const-correctness issues
There's definitely stuff to iterate on here, but this takes care of
making the libraries compile with stricter RP and NNRP.
2023-02-21 00:54:04 +01:00
nipos f700d553ab LibCore: Add support for NetBSD in anon_create 2023-02-20 18:46:51 +01:00
Sam Atkins 2db168acc1 LibTextCodec+Everywhere: Port Decoders to new Strings 2023-02-19 17:15:47 +01:00
Sam Atkins f2a9426885 LibTextCodec+Everywhere: Return Optional<Decoder&> from decoder_for() 2023-02-19 17:15:47 +01:00
Sam Atkins f0b72b819e LibWeb: Make property/media-feature name matching ASCII case-insensitive
https://www.w3.org/TR/css-conditional-3/#dom-css-supports specifically
asks for this when calling `CSS::property_id_from_string()`, but in
general, CSS property and media-feature names can only contain ASCII.
2023-02-19 00:46:47 +01:00
Lucas CHOLLET 856d0202f2 LibGfx: Rename JPGLoader to JPEGLoader
The patch also contains modifications on several classes, functions or
files that are related to the `JPGLoader`.

Renaming include:
 - JPGLoader{.h, .cpp}
 - JPGImageDecoderPlugin
 - JPGLoadingContext
 - JPG_DEBUG
 - decode_jpg
 - FuzzJPGLoader.cpp
 - Few string literals or texts
2023-02-18 23:56:24 +01:00
Luke Wilde 3275d659bf LibWeb: Convert FormData to String and Vector storage
This makes use of the new [UseNewAKString] extended attribute. Using
Vector storage will make it easier to make this interface into an IDL
iterable. It seems the reason it didn't use Vector originally was due
to awkward DeprecatedString -> String conversions.
2023-02-18 01:23:36 +01:00
Luke Wilde c0f22065ab LibWeb: Add an extended attribute that makes interfaces use AK::String
Adding the [UseNewAKString] extended attribute to an interface will
cause all IDL string types to use String instead of DeprecatedString.
This is done on an per interface level instead of per type/parameter
because:

- It's much simpler to implement, as the generators can already access
  the interface's extended attributes. Doing it per type/parameter
  would mean parsing and piping extended attributes for each type that
  doesn't already take extended attributes, such as unions.

- Allows more incremental adoption of AK::String. For example, adding
  [UseNewAKString] to BodyInit would require refactoring Request,
  Response and XMLHttpRequest to AK::String in one swoop. Doing it on
  the interface allows you to convert just XHR and its dependencies at
  once, for example.

- Simple string return types (i.e. not parameterised or not in a union)
  already accept any of the string types JS::PrimitiveString::create
  accepts. For example, you can add [UseNewAKString] to DOMStringMap to
  convert Element attributes to AK::String and still return AK::String
  from get_attribute, without adding [UseNewAKString] to Element.

- Adding [UseNewAKString] to one function typically means adding it to
  a bunch of other functions, if not the rest of them. For example,
  adding [UseNewAKString] to the parameters FormData.append would
  either mean converting AK::String to AK::DeprecatedString or storing
  the AK::String as-is, making the other functions of FormData have to
  convert back from AK::String or also support AK::String.
2023-02-18 01:23:36 +01:00
Timothy Flynn 88814acbd3 LibJS+Everywhere: Convert JS::Error to String
This includes an Error::create overload to create an Error from a UTF-8
StringView. If creating a String from that view fails, the factory will
return an OOM InternalError instead. VM::throw_completion can also make
use of this overload via its perfect forwarding.
2023-02-17 09:14:23 -05:00
Timothy Flynn 527edb55ad LibWeb: Convert usages of Value::TDSWOSE to Value::TSWOSE 2023-02-16 14:32:22 +01:00
Timothy Flynn b245300ba1 LibJS+Everywhere: Deprecate Value::to_string_without_side_effects 2023-02-16 14:32:22 +01:00
Timon Kruiper dfc6555fec CMake: Add -mstrict-align flag to compile options for aarch64 build
The aarch64 processor is set up to trap on unaligned memory accesses, so
to enforce that the compiler correctly generates aligned accesses, the
-mstrict-align flag is needed. We also need the -Wno-cast-align as there
are some files in AK that don't build without the flag.
2023-02-15 22:53:19 +01:00
Sam Atkins d6075ef5b5 LibTextCodec+Everywhere: Make TextCodec::decoder_for() take a StringView
We don't need a full String/DeprecatedString inside this function, so we
might as well not force users to create one.
2023-02-15 12:48:26 -05:00
Ali Mohammad Pur 617d112780 Meta: Add a Shell --posix parser fuzzer 2023-02-13 23:00:15 +03:30
Ali Mohammad Pur 2a276c86d4 Shell: Start implementing a POSIX-compliant parser
The parser is still very much a work-in-progress, but it can currently
parse most of the basic bits, the only *completely* unimplemented things
in the parser are:
- heredocs (io_here)
- alias expansion
- arithmetic expansion

There are a whole suite of bugs, and syntax highlighting is unreliable
at best.
For now, this is not attached anywhere, a future commit will enable it
for /bin/sh or a `Shell --posix` invocation.
2023-02-13 23:00:15 +03:30
Tim Schumacher 43f98ac6e1 Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
Tim Schumacher 874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher 606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Kenneth Myhra d5b5b94a35 LibWeb: Introduce the FormData interface from the XHR specification 2023-02-12 00:18:09 +00:00
networkException 143f28b735 CI: Add script to post mastodon toots for commits on master
This patch adds the toot-commits script (mirroring tweet-commits),
posting new commits on the master branch to
https://serenityos.social/@commits.
2023-02-10 13:54:07 +00:00
Timothy Flynn 604d5f5bca AK+Everywhere: Do not implicitly copy variables in TRY macros
For example, consider cases where we want to propagate errors only in
specific instances:

    auto result = read_data(); // something like ErrorOr<ByteBuffer>
    if (result.is_error() && result.error().code() != EINTR)
        continue;
    auto bytes = TRY(result);

The TRY invocation will currently copy the byte buffer when the
expression (in this case, just a local variable) is stored into
_temporary_result.

This patch binds the expression to a reference to prevent such copies.
In less trival invocations (such as TRY(some_function()), this will
incur only temporary lifetime extensions, i.e. no functional change.
2023-02-10 09:08:52 +00:00
Timothy Flynn c3abb1396c LibJS+LibWeb: Convert string view PrimitiveString instances to String
First, this adds an overload of PrimitiveString::create for StringView.
This overload will throw an OOM completion if creating a String fails.
This is not only a bit more convenient, but it also ensures at compile
time that all PrimitiveString::create(string_view) invocations will be
handled as String and OOM-aware.

Next, this wraps all invocations to PrimitiveString::create(string_view)
with MUST_OR_THROW_OOM.

A small PrimitiveString::create(DeprecatedFlyString) overload also had
to be added to disambiguate between the StringView and DeprecatedString
overloads.
2023-02-09 17:13:33 +00:00
Timothy Flynn 49474d8718 Revert "Meta: Automatically select best apt mirror"
This reverts commit b0606d90f0.

This seems to prevent libegl-mesa0 from being installed (which for some
reason isn't failing the Azure jobs - the failure seen later is that
ccache is not installed).
2023-02-09 14:57:27 +00:00
MacDue 63b11030f0 Everywhere: Use ReadonlySpan<T> instead of Span<T const> 2023-02-08 19:15:45 +00:00
Timothy Flynn 8670526f2a LibJS+LibLocale: Propagate OOM from CLDR RelativeTime Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn 340434ce09 LibLocale: Propagate OOM from CLDR DateTime Vector and String operations 2023-02-08 18:32:37 +00:00
Timothy Flynn 89da8de4ca LibJS+LibLocale: Propagate OOM from CLDR NumberFormat Vector operations 2023-02-08 18:32:37 +00:00
Timon Kruiper a9f7267cbd Meta: Allow creating disk image without installing kernel into it
This change allows for creating smaller disk images, which is useful for
creating a disk image that will be put into ram.
2023-02-08 18:19:48 +00:00
Tim Schumacher 220fbcaa7e AK: Remove the fallible constructor from FixedMemoryStream 2023-02-08 17:44:32 +00:00
MacDue b0606d90f0 Meta: Automatically select best apt mirror
This is an attempt to avoid issues with the azure ubuntu apt mirror
by using apt-spy2 to select the best mirror before installing
dependencies.
2023-02-07 13:22:17 +00:00
Karol Kosek bc587b89d8 CMake: Don't require to install glapi.h to system
This failed when a current build configuration hadn't got any program
depending on LibGL.
2023-02-04 15:53:07 -07:00
Karol Kosek 22a99e39d8 Lagom/ConfigureComponents: Run cmake command last
Previously the tool was removing the Root directory after configuring
cmake which was breaking the build, as some cmake rules put some
necessary files there.

Moving the cmake command to be the last one makes it regenerate those
files automatically. :^)
2023-02-04 15:53:07 -07:00
MacDue 0c313c586b Meta: Register CanvasPattern as a platform object 2023-02-03 20:36:21 +01:00
Tim Schumacher ef7f343e95 CMake: Set DWARF version before the debug information level
Setting the DWARF version after having selected which level of debug
information to generate apparently undoes some settings again.

Doing the reverse apparently keeps both the version and the debug level
setting, resulting in a significantly smaller disk image size.
2023-02-02 16:31:09 +01:00
Andrew Kaster 8f70e365f0 Meta+CI: Disable Ladybird for fuzzer, compiler explorer and Android
And move it after the declaration of headless-browser, since WebDriver
depends on headless-browser.
2023-02-02 05:35:44 -07:00
Timothy Flynn 38b0b32bb4 Meta: Set LD_LIBRARY_PATH to Build/lagom for Lagom test targets
Some tests, such as those under LibGL, try to load shared libraries at
runtime which are stored in Build/lagom. Because all tests' working
directory is that of their CMakeLists.txt file, they fail to find those
shared libraries at runtime.

Set LD_LIBRARY_PATH to Build/lagom so the tests may find the shared
libraries. This fixes, for example, both of these commands:

    ./Meta/serenity.sh test lagom TestAPI
    ./Meta/serenity.sh run lagom TestAPI
2023-02-01 12:28:02 -05:00
Timothy Flynn 1bbd889f67 Meta: Set the Lagom test working directory for run-lagom-target
When we call add_test() from each test's CMakeLists.txt, we specify the
working directory to be that of the CMakeList.txt file itself. Create a
property to store that directory and reference it when run-lagom-target
is invoked by serenity.sh.

Note that for non-test Lagom targets which do not set this property, the
working directory will be Build/lagom (because the property will be the
empty string, which CMake resolves relative to the current build path).
2023-02-01 12:28:02 -05:00
Nico Weber 0a97206a25 Meta: Derust fuzzer build docs
The document wasn't updated in 9c2211f246.
2023-02-01 14:44:58 +00:00
Timothy Flynn 9f9b8e7273 CI: Move running LibWeb layout tests to Azure
The current config on GitHub Actions does not use ccache, so it takes
quite a while to build. Instead, let's just run these tests on Azure
where we already build Ladybird and have ccache enabled. This also lets
us sanitize LibWeb on both Linux and macOS.

The script changes here are to A) handle differences between Azure and
GitHub Actions and B) to support running on macOS.
2023-02-01 14:04:44 +00:00
Nico Weber 9bb469f324 Meta: Build and run Tests/LibGfx in lagom builds
They can be run using

    Meta/serenity.sh test lagom TestFontHandling

which will build _all_ test binaries and then run TestFontHandling.

There's also

    Meta/serenity.sh run lagom TestFontHandling

which will build just TestFontHandling and run it, but currently
in a way that it doesn't pass.

Finally, manually doing

    Meta/serenity.sh build lagom TestFontHandling

followed by

    (cd Tests/LibGfx; ../../Build/lagom/Tests/LibGfx/TestFontHandling)

will build and then run just that one test in a way that makes the test
pass.
2023-02-01 08:56:56 -05:00
Tim Schumacher 093cf428a3 AK: Move memory streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher 8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Timothy Flynn b75b7f0c0d LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate
Callers that are already in a fallible context will now TRY to allocate
cells. Callers in infallible contexts get a FIXME.
2023-01-29 00:02:45 +00:00
Timothy Flynn 2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
2023-01-29 00:02:45 +00:00
Linus Groh ee0297d9ec LibAudio: Remove try_ prefix from fallible LoaderPlugin methods 2023-01-28 22:41:36 +01:00
Nico Weber 721b280849 LibGfx: Move ICCProfile.{h,cpp} to ICC/Profile.{h,cpp} 2023-01-28 00:27:07 +00:00
Linus Groh 6e7459322d AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
2023-01-27 20:38:49 +00:00
Timothy Flynn 5e29e04122 LibJS+LibLocale: Propagate errors from find_regional_values_for_locale
This had quite the footprint.
2023-01-27 18:00:17 +00:00
Timothy Flynn b2097f4059 LibJS+LibLocale: Port Intl.DateTimeFormat to String 2023-01-27 18:00:17 +00:00
Timothy Flynn ad8183beb4 Meta: Support running ladybird with arguments from serenity.sh
You may now, for example, run:

    ./Meta/serenity.sh run lagom ladybird https://serenityos.org
2023-01-27 08:14:24 -05:00
Timothy Flynn 9743445e44 Meta: Allow running Lagom tests with "serenity.sh run lagom <target>"
After 5ac57f9, we could no longer run "serenity.sh run lagom TestString"
because the TestString binary now lives in a subdirectory under
Build/lagom. Thus the existing method of running "$BUILD_DIR/TestString"
could not work.

This adds a "run-lagom-target" custom target to Lagom, to run a command
and pass arguments to that invocation. It turns out there really isn't a
"pretty" way of doing this with CMake or Ninja. But we can pass these as
environment variables for CMake to interpret. We just must be careful to
massage arguments into a CMake list.
2023-01-27 08:14:24 -05:00
Sam Atkins ad9b2043dd CodeGenerators: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-26 09:57:14 -05:00
Tim Schumacher 982ebbc304 LibWasm: Port the parser to Core::Stream 2023-01-25 17:10:05 +03:30
Timon Kruiper 3a802e365c Meta: Unify installing GCC dependencies in disk image
This makes sure that the aarch64 disk image also contains the correct
dynamic shared objects, specifically libgcc_s.so.1, as that one is a
dynamic dependency of every aarch64 executable.

To unify the x86_64 and aarch64 code paths, this commit just installs
everything from the compilers lib directory into the disk image lib
directory. This also happens for the Clang toolchain. This copies a few
extra files related to libsupc++ and libstdc++, increasing the size of
the disk image by 1.6MB. However, we were already copying libstdc++.a
manually anyway.
2023-01-25 14:28:53 +01:00
MacDue 2be4142138 Meta: Register CanvasGradient as a platform object 2023-01-22 18:15:52 +01:00
Timothy Flynn 20536897e4 LibJS+LibLocale: Port remaining locale APIs to String 2023-01-22 01:03:13 +00:00
Timothy Flynn f1de4f8872 Everywhere: Convert known short-strings to the infallible String factory
For now, this is limited to strings that are 3 bytes or less. We can use
7 bytes on 64-bit platforms, but we do not yet assume 64-bit for Lagom
hosts (e.g. wasm).
2023-01-20 14:24:12 -05:00
Liav A 57e19a7e56 LibGfx: Re-structure the whole initialization pattern for image decoders
When trying to figure out the correct implementation, we now have a very
strong distinction on plugins that are well suited for sniffing, and
plugins that need a MIME type to be chosen.

Instead of having multiple calls to non-static virtual sniff methods for
each Image decoding plugin, we have 2 static methods for each
implementation:
1. The sniff method, which in contrast to the old method, gets a
    ReadonlyBytes parameter and ensures we can figure out the result
    with zero heap allocations for most implementations.
2. The create method, which just creates a new instance so we don't
    expose the constructor to everyone anymore.

In addition to that, we have a new virtual method called initialize,
which has a per-implementation initialization pattern to actually ensure
each implementation can construct a decoder object, and then have a
correct context being applied to it for the actual decoding.
2023-01-20 15:13:31 +00:00
Timothy Flynn ca62aeb6bd LibLocale+LibJS: Port locale parsing and processing to String
In order to prevent this commit from having to refactor almost all of
Intl, the goal here is to update the internal parsing/canonicalization
of locales within LibLocale only. Call sites which are already equiped
to handle String and OOM errors do so, however.
2023-01-19 20:57:30 +00:00
Sam Atkins 5ac57f9d41 Meta: Use existing test-sources lists for Lagom instead of globbing
...mostly.

This creates and uses an override for the `serenity_test()` function, so
that Lagom can make use of the existing `Tests/LibFoo/CMakeLists.txt`
files instead of having to GLOB for test source files and manually copy
any data files.

Some GLOBs remain but this is most of them.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2023-01-19 11:50:10 +00:00
Sam Atkins 71af0c296f Meta/Lagom: Make sure that libraries are always linked as PRIVATE 2023-01-19 11:50:10 +00:00
Timothy Flynn 0dce7b72f9 LibCore: Implement FileWatcher for macOS
The macOS FileWatcher depends on macOS dispatch queues, which run on a
different thread than the Core::EventLoop. This implementation handles
filesystem events on its dispatch queue, then forwards the event back to
the main Core::EventLoop for notifying the FileWatcher owner.
2023-01-19 11:29:48 +00:00
Linus Groh afc055c088 LibWeb: Convert the Location object to IDL
This includes:

- Moving it from Bindings/ to HTML/
- Renaming it from LocationObject to Location
- Removing the manual definitions of the constructor and prototype
- Removing special handling of the Location interface from the bindings
  generator
- Converting the JS_DEFINE_NATIVE_FUNCTIONs to regular functions
  returning DeprecatedString instead of PrimitiveString
- Adding missing (no-op) setters for the various attributes, which are
  expected to exist by the bindings generator
2023-01-18 17:36:39 -05:00
Timothy Flynn 8f2589b3b0 LibUnicode: Parse and generate case folding code point data
Case folding rules have a similar mapping style as special casing rules,
where one code point may map to zero or more case folding rules. These
will be used for case-insensitive string comparisons. To see how case
folding can differ from other casing rules, consider "ß" (U+00DF):

    >>> "ß".lower()
    'ß'

    >>> "ß".upper()
    'SS'

    >>> "ß".title()
    'Ss'

    >>> "ß".casefold()
    'ss'
2023-01-18 14:43:40 +00:00
Timothy Flynn 9226cf7272 LibUnicode: Rename a special casing variable name in the UCD generator
This name will soon be a bit ambiguous with a similar case folding
variable name.
2023-01-18 14:43:40 +00:00
Timothy Flynn 8d9fb898d7 LibUnicode: Update out-of-date spec links
And remove links that aren't adding much value but will often get out of
date (i.e. links to UCD files, which are already all listed in
unicode_data.cmake).
2023-01-18 14:43:40 +00:00
Timothy Flynn 5a1ac851aa FuzzilliJs: Print the result of JS::Value::to_string using AK::outln
JS::Value::to_string now returns a String, which does not have a null-
terminated characters() accessor.
2023-01-18 12:52:25 +00:00
Timothy Flynn 8ca528217c LibCore: Implement FileWatcher for Linux
This implements FileWatcher using inotify filesystem events. Serenity's
InodeWatcher is remarkably similar to inotify, so this is almost an
identical implementation.

The existing TestLibCoreFileWatcher test is added to Lagom (currently
just for Linux).

This does not implement BlockingFileWatcher as that is currently not
used anywhere but on Serenity.
2023-01-18 06:46:12 -05:00
Nico Weber cbb6f8de65 Lagom/Fuzzers: Add fuzzer for ICCProfile 2023-01-17 22:25:33 -05:00
Sam Atkins 1dd6b7f5b7 AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-17 19:52:52 -05:00
Timothy Flynn b562348d31 LibUnicode: Generate simple case folding mappings for titlecase
Note we already generate the special case foldings for titlecase.
2023-01-16 18:33:44 -05:00
Tim Schumacher 3ed9627f4e LibIPC: Decode messages using Core::Stream internally 2023-01-15 23:06:31 -05:00
Liav A b2626d3bc1 Lagom/Fuzzers: Add fuzzer for the TGALoader code 2023-01-15 12:43:03 +01:00
Timothy Flynn afeb7273cc LibJS+Everywhere: Rename Value::to_string to to_deprecated_string 2023-01-15 01:00:20 +00:00
Andrew Kaster f5d253dcfa Everywhere: Fully qualify IsLvalueReference in TRY() macros
If USING_AK_GLOBALLY is not defined, the name IsLvalueReference might
not be available in the global namespace. Follow the pattern established
in LibTest to fully qualify AK types in macros to avoid this problem.
2023-01-15 00:56:31 +00:00
Ben Wiederhake 23d111a459 LibWeb: Implement value_id_from_string by hash lookup
The old approach was basically a linear scan, which is slower than a
hash map for the currently 303 elements, as evidenced by the new
benchmark in TestCSSIDSpeed.

Before: Completed benchmark 'value_id_from_string' in 3238ms
After: Completed benchmark 'value_id_from_string' in 193ms
2023-01-14 15:43:27 -07:00
Ben Wiederhake 0687a75eaa LibWeb: Run tests in lagom if ENABLE_LAGOM_LIBWEB is set 2023-01-14 15:43:27 -07:00
Timothy Flynn afc0e461e1 AK+Everywhere: Disallow returning a reference from a fallible expression
This will silently make a copy. Rather than masking this behavior, let's
explicitly disallow it.
2023-01-13 18:50:47 -05:00
Linus Groh 5411adca22 LibWebView+Ladybird: Begin de-duplicate WebView implementations
This starts moving code equally shared between the OOPWV and Ladybird
WebContentView implementations to WebView::ViewImplementation, beginning
with the client state.
2023-01-12 23:39:36 +01:00
MacDue 1cf45ee930 Utilities: Add ttfdisasm for disassembling OpenType instructions
This utility when given a .tff font provides options for disassembling:

 - The 'fpgm' table, this a program that's run once when the font is
   loaded. It's used to define instructions and functions used by used
   by other programs.

 - The 'prep' table, this is a general program that's run when ever
   the font size (or other properties) changes.

 - And the programs associated with any individual glyph.

The disassembly is printed in a format that matches the examples from:
https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions

I'm mainly adding this because I think it's neat to be able to look
at these things, and think it'll be helpful for debugging an
interpreter.

With this you can see that all of the LiberationSerif-XXX.tff fonts in
Serenity have these programs ready to go.
2023-01-12 11:27:57 +01:00
Timothy Flynn 491edaffc7 LibWeb: Ensure legacy constructors are defined on the global object
This regressed in 6e93d89ee3.
2023-01-10 17:55:23 +00:00
Timothy Flynn 6e93d89ee3 LibWeb: Generate exposed Window/Worker interfaces as lazy objects
We now lazily create these instances on-demand rather than all at once
when a Window/Worker object is created.
2023-01-10 16:08:14 +01:00
Timothy Flynn 7bd8fd000f LibWeb: Generate dedicated methods to create Web constructors/prototypes
Currently, for each exposed interface, we generate one massive function
to create every Web constructor and prototype. In an effort to lazily
create these instead, this first step is to extract the creation of each
of these into its own method.

First, this generates a forwarding header for all IDL types. This is to
allow callers to remain unchanged without forcing them to include the
(very heavy) generated IDL headers. This header is included by LibWeb's
forwarding header.

Next, this defines a base template method on Web::Bindings::Intrinsics
to create a prototype/constructor pair. Specializations of this template
are now generated in a new .cpp file, IntrinsicDefinitions.cpp. The base
Intrinsics class is updated to use this new method, and will continue to
cache the result.

Last, some WebAssembly classes are updated to use this new mechanism.
They were using some ad hoc cache keys that are now in line with the
generated specializations.

That one massive function is still used to invoke these specializations,
so they are not lazy as of this commit.
2023-01-10 16:08:14 +01:00
Timothy Flynn 6fcc1c7426 AK+LibUnicode: Provide Unicode-aware String case transformations
Since AK can't refer to LibUnicode directly, the strategy here is that
if you need case transformations, you can link LibUnicode and receive
them. If you try to use either of these methods without linking it, then
you'll of course get a linker error (note we don't do any fallbacks to
e.g. ASCII case transformations). If you don't need these methods, you
don't have to link LibUnicode.
2023-01-09 19:23:46 -07:00
Timothy Flynn 12f6793223 LibUnicode: Move Unicode-aware case transformations to a helper file
These will be needed by AK::String as well, so move them to a helper
file where they can be re-used.
2023-01-09 19:23:46 -07:00
martinfalisse ce0f41b9fb LibWeb+WebContent: Use new String class in CSS::StyleValue
Converts uses of DeprecatedString to String in StyleValue, and patches
surrounding files that depend on these functions.
2023-01-09 11:09:31 +01:00
Liav A c876412b1b Kernel: Remove the NE2000 PCI network adapter driver
Nobody tests this network card as the person who added it, Jean-Baptiste
Boric (known as boricj) is not an active contributor in the project now.
After a discussion with him on the Discord server, we agreed it's for
the best to remove the driver, as for two reasons:
- The original author (boricj) agreed to do this, stating that he will
  not be able to test the driver anymore after his Athlon XP machine is
  no longer supported after the removal of the i686 port.
- It was agreed that the NE2000 network card family is far from the
  ideal hardware we would want to support, similarly to the RTL8139 that
  got removed recently for almost the same reason.
2023-01-08 21:51:59 +01:00
kleines Filmröllchen e430667923 Meta/build-manpages-website: Use absolute paths for all links
Previously, we had some broken cross-manpage links on the website after
the introduction of subsections. This is fixed by simply always using an
absolute path (leading '/') for links, making all images, icons and page
links work in all subsections.

Unfortunately, this change means that navigating the website build while
opening the files in the browser directly will no longer work. However,
a local static server such as `python -m http.server 8080` in the
output/ directory will work just fine for testing.
2023-01-08 13:35:29 +01:00
kleines Filmröllchen 76e601d758 Meta/build-manpages-website: Copy all manpage PNGs
This will allow using images in manpages elsewhere in the future without
adjusting the PNG copying command.

rsync unfortunately cannot place all files into the root folder when
receiving a list of files via --files-from=-.
2023-01-08 13:35:29 +01:00
implicitfield 28c99e7a1f LibArchive+Utilities: Stop using DeprecatedString
This also slightly improves error propagation in tar, unzip and zip.
2023-01-08 09:54:08 +00:00
Liav A 5c97c6d874 Kernel: Remove the RTL8139 PCI network adapter driver
Nobody tests this network card, and the driver has bugs (see the issue
https://github.com/SerenityOS/serenity/issues/10198 for more details),
so it's almost certain that this happened due to code being rotting when
there's simply no testing of it.

Essentially this has been determined to be dead-code so this is the most
important reason to drop this code. Another good reason to do so is
because the RTL8139 only supports Fast Ethernet connections (10/100
Megabits per second), and is considered obsolete even for bare metal
setups.
2023-01-07 11:37:57 -07:00
Ben Wiederhake 3281050359 Everywhere: Remove "LibC/" includes, add lint-rule against it 2023-01-07 10:01:37 -07:00
MacDue b0ac88cf89 Meta/Lagom: Link Threads::Threads
This is required for me to be able to build both Serenity and
Ladybird from the same repo. Without this the two builds seem to
stomp on each other, then fail to link.
2023-01-06 08:04:23 -07:00
Lucas CHOLLET 4e164c9de7 Meta: Pass Core::Stream::OpenMode by value in the IPCCompiler 2023-01-06 14:52:29 +00:00
Luke Wilde a6716e694d CI: Automatically apply pull request labels for generic PR actions
Generic PR actions include opening a PR, submit review comments, adding
new commits, etc. This prevents the reviewer and PR submitter from
having to manually bounce the labels back and forth in the general
case. The reviewer also may not have permission to set labels, meaning
the reviewer won't be able to update the labels accordingly themselves.

This does not handle more subjective labels such as pr-is-blocked and
pr-unclear. Unfortunately, there does not seem to be a GitHub Actions
trigger for when a PR has merge conflicts, so the pr-has-conflicts
label cannot be automatically applied.

Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
2023-01-06 15:25:30 +01:00
kleines Filmröllchen 8fb7c32ec3 Meta: Create nested manpage section indices for the website
This is probably committing some sed crimes, but it looks very nice!
2023-01-05 15:03:52 +01:00
kleines Filmröllchen 20f44e095d Meta: Use parallel rsync for file coyping for online manpages
The main point is to bring this in line with all the other file copying,
which is always done via rsync.

On my machine this leads to very little speedup, but I'm also on WSL, so
🤷

Timings:
Before:
  Time (abs ≡): 20.440 s [User: 133.928 s, System: 12.290 s]
After:
  Time (abs ≡): 20.346 s [User: 135.534 s, System: 11.207 s]
2023-01-05 15:03:52 +01:00
kleines Filmröllchen a205efd900 Meta: Generate manpages for website in parallel
pandoc is a single-threaded and pretty slow application, so we can run
it in the background and "synchronize" before generating section
indices.

Timing results:
Before:
  Time (abs ≡):        59.833 s [User: 49.541 s, System: 6.943 s]
After:
  Time (abs ≡):        20.440 s [User: 133.928 s, System: 12.290 s]

(both generated with hyperfine -p "rm -r output || true" -r 1
	Meta/build-manpages-website.sh )
2023-01-05 15:03:52 +01:00
kleines Filmröllchen a196fafd0f Meta: Print progress during the website manpage build
This especially helps when building locally.
2023-01-05 15:03:52 +01:00
kleines Filmröllchen 3affa922e3 Meta: Make the manpage website build work with manpage subsection
For now, we create simple but complete indices and actually generate the
HTML for the manpages in subsections. For these purposes, switch to
using "find" as a file finding tool everywhere, instead of the very
limited globs from before.
2023-01-05 15:03:52 +01:00
kleines Filmröllchen 69e5645955 Meta: Remove duplicate manpage section generation for the website 2023-01-05 15:03:52 +01:00
Timothy Flynn 8b7b03b369 IPCCompiler+LibIPC: Propagate IPC encoder errors
This propagates errors from user-defined encoders up to IPC::Connection.
There, we currently just log the error, as we aren't in a position to
propagate it further (i.e. we are inside a deferred invocation).
2023-01-04 11:49:15 +01:00
Tim Schumacher 77ea609cd3 Lagom: Fix up a missed usage of Compress::Zlib in the fuzzers 2023-01-03 23:26:45 +01:00
Ben Wiederhake 6fd478b6ce Everywhere: Remove unused includes of AK/Format.h
These instances were detected by searching for files that include
AK/Format.h, but don't match the regex:

\\b(CheckedFormatString|critical_dmesgln|dbgln|dbgln_if|dmesgln|FormatBu
ilder|__FormatIfSupported|FormatIfSupported|FormatParser|FormatString|Fo
rmattable|Formatter|__format_value|HasFormatter|max_format_arguments|out
|outln|set_debug_enabled|StandardFormatter|TypeErasedFormatParams|TypeEr
asedParameter|VariadicFormatParams|v_critical_dmesgln|vdbgln|vdmesgln|vf
ormat|vout|warn|warnln|warnln_if)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use any formatting functions.

Observe that this revealed that Userland/Libraries/LibC/signal.cpp is
missing an include.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake 8a331d4fa0 Everywhere: Move AK/Debug.h include to using files or remove 2023-01-02 20:27:20 -05:00
Timothy Flynn 0a7d0362ea CI: Remove extraneous toolchain job from Azure CI
This was useful when building both i686 and x86_64 SerenityOS targets as
we could use a single toolchain build for both targets. But now all this
extra job does is create the opportunity for the toolchain to need to be
built twice (i.e. if the pipelines are backed up and the toolchain cache
is busted between these jobs while the x86_64 step is waiting for a VM).
2022-12-28 15:26:12 -05:00
Liav A fb0dee5a54 Meta: Force compilation with DWARF revision 4
We currently don't support DWARF revision 5 and LLVM/Clang might create
such debug info into our binaries in x86_64, which will lead to a crash
in CrashReporter that is unable to parse that information correctly.
2022-12-28 11:53:41 +01:00
Liav A 55f17fff36 Meta: Remove i686 target 2022-12-28 11:53:41 +01:00
Nico Weber 7f52f45e9d LibGfx: Start adding a utility for handling ICC color profiles
For now, this dumps file version and device class.

https://github.com/saucecontrol/compact-icc-profiles has good
test inputs.
2022-12-27 07:44:37 -07:00
Timothy Flynn 9b483625e6 LibIPC+Everywhere: Change IPC decoders to construct values in-place
Currently, the generated IPC decoders will default-construct the type to
be decoded, then pass that value by reference to the concrete decoder.
This, of course, requires that the type is default-constructible. This
was an issue for decoding Variants, which had to require the first type
in the Variant list is Empty, to ensure it is default constructible.

Further, this made it possible for values to become uninitialized in
user-defined decoders.

This patch makes the decoder interface such that the concrete decoders
themselves contruct the decoded type upon return from the decoder. To do
so, the default decoders in IPC::Decoder had to be moved to the IPC
namespace scope, as these decoders are now specializations instead of
overloaded methods (C++ requires specializations to be in a namespace
scope).
2022-12-26 09:36:16 +01:00
Timothy Flynn 765c5b416f IPCCompiler+LibIPC: Generate message decoders with better TRY semantics
Instead of a bunch of manual error checking and returning a null OwnPtr,
we can propagate the errors up and return NonnullOwnPtr on success.
2022-12-26 09:36:16 +01:00
Timothy Flynn dc77ec733f IPCCompiler: Fix build when GENERATE_DEBUG is enabled
1. We don't need to escape the quotes in the dbgln() statements because
   these are raw strings.
2. The dbgln() statements must end with a semicolon.
2022-12-26 09:36:16 +01:00
Andrew Kaster 4ae2a54f3d CI: Bump macOS Azure runners to macos-12 tag 2022-12-25 07:58:58 -07:00
Andrew Kaster e8c2f67d47 Meta: Enable starting ladybird from serenity.sh
This solution feels really hacky and should be refined later.
2022-12-25 07:58:58 -07:00
Andrew Kaster 03edff1f39 CI: Enable ladybird builds in Lagom CI 2022-12-25 07:58:58 -07:00
Andrew Kaster 0384513779 Lagom: Add option to build Ladybird as part of a Lagom build
This means that Ladybird can be built with either Meta/Lagom or Ladybird
as the top-level source directory. This setup is a bit awkward, but will
preserve the packaging story for Ladybird until we come up with a more
permanent solution.
2022-12-25 07:58:58 -07:00
Timothy Flynn 2334b4cebd Meta: Move UCD/CLDR/TZDB downloaded artifacts to Build/caches
They currently reside under Build/<arch>, meaning that they would be
redownloaded for each architecture/toolchain build combo. Move them to a
location that can be re-used for all builds.
2022-12-24 09:46:28 -05:00
Tim Schumacher 1c630316ec CMake: Fall back to the Web Archive when downloading files 2022-12-21 09:13:50 +00:00
Andreas Kling f982400063 LibGfx: Rename TTF/TrueType to OpenType
OpenType is the backwards-compatible successor to TrueType, and the
format we're actually parsing in LibGfx. So let's call it that.
2022-12-21 08:44:22 +01:00
Timothy Flynn ed84a6f6ee LibUnicode: Use www.unicode.org domain to download emoji-test.txt
The non-www domain does not appear to be available now. We use the www
domain for UCD.zip already.

Co-authored-by: Stephan Unverwerth <s.unverwerth@serenityos.org>
2022-12-20 12:09:16 -05:00
Sam Atkins 3507679659 Lagom: Remove test apps
These are no longer useful or necessary now that a lot of different
applications run on Lagom.
2022-12-20 12:09:01 -05:00
Nico Weber c6f81b5b83 Meta: Tweak shell_include.sh
* `chmod -x` as it's for sourcing, not for executing
* Remove run line, for the same reason
* Rename it from .shell_include.sh to shell_include.sh, since e.g.
  `rg` doesn't search in hidden files by default

No behavior change.
2022-12-20 09:23:32 -05:00
Andrew Kaster c0542ed40b Meta+test262-runner: Check for signature of __assert_fail in CMake
Rather than trying to assume the only two C libraries on Linux are musl
and glibc, this solution fixes musl builds by explicitly checking for
the one C library function we are overwriting.

That being said, we should find another solution to retrieving this
error information from crashing tests. Possibly just overriding the
SIGABRT handler would work. The full solution might require checking
stderr as well as stdout in the test driver though.
2022-12-20 11:04:05 +01:00
Jelle Raaijmakers 2da1c1c10e LibGL: Generate the API wrappers
We now generate all LibGL API wrappers from a single API method
definition list stored in `GLAPI.json`. Since a significant portion of
the OpenGL API methods are relatively consistent variants, we take
advantage of this to generate a lot of these variants at once.

The autogenerated methods check for the non-nullness of the current
`GLContext`, and only perform an action if a `GLContext` is present.
This prevents a crash in ports like GLTron, who assume you can still
call the OpenGL API without an active context.

This increases our API wrapper method count from 211 to 356.

Fixes #15814.
2022-12-20 10:42:31 +01:00
MacDue 9dea61e095 Meta: Include StylePropertiesModel.cpp in lagom LibWebView 2022-12-19 11:37:56 -05:00
0xxFF c4bc889346 Documentation: Adjust default TARGET to x86_64 in the documentation 2022-12-19 09:00:34 -05:00
Nico Weber 1a85539741 Meta: Find mke2fs on macOS even if HOMEBREW_PREFIX is not set
...as long as `brew` is on the path and `brew --prefix e2fsprogs`
tells us where it is.

This is for people who don't have `"$(brew shellenv)"` in their .zshrc.
2022-12-18 17:49:49 -07:00
Nico Weber 15ce757f12 Meta: Disable gdbstub when running under HVF on macOS
Without this, `serenity.sh run` fails with

    gdbstub: current accelerator doesn't support guest debugging

on an intel mac.
2022-12-18 17:46:29 -07:00
Stephan Unverwerth 67b2f8d68d LibGLSL: Add LibGLSL
This adds a new library, LibGLSL for parsing and compiling GLSL programs
to LibGPU IR. Currently the compiler consists only of stubs.
2022-12-17 22:39:09 -07:00
Andrew Kaster 37517ba8bb Meta: Prefer clang as a host compiler to gcc 2022-12-17 22:21:43 -07:00
Andrew Kaster d2e4565f72 Meta: Allow building with Apple clang 14.x
We previously disregarded Apple clang entirely, since no released
version was able to succesfully build Lagom. Xcode 14 seems to have
all the features we need, as we haven't added any code that needs
trunk clang features in quite a while.
2022-12-17 22:21:43 -07:00
EWouters 74927ac76d Meta: Fix mke2fs on MacOS
Use `Meta/.shell_include.sh` to find the `mke2fs` executable.
2022-12-17 16:12:48 -07:00
Tim Schumacher c6d71ca727 LibCore: Rename MemoryStream to FixedMemoryStream
This is to differentiate between the upcoming `AllocatingMemoryStream`,
which automatically allocates memory as needed instead of operating on a
static memory area.
2022-12-15 13:28:29 +00:00
Linus Groh 6ae79a84df LibJS: Convert Object::construct() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh 22089436ed LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
implicitfield 9665f41979 Kernel: Ignore an invalid QEMU multiboot entry
This was introduced in the QEMU commit 8504f12 and was causing the
kernel to fail to boot on the q35 machine.

Fixes #14952.
2022-12-14 17:05:06 +00:00
Andrew Kaster 733a318709 Meta+CMake: Extract Wasm spec tests into the binary directory
Clean up the Wasm spec tests CMake rules to extract and compile the wat
files into wasm files in the LibWasm binary directory instead of its
source directory. Also make the rules more robust to missing host tools,
and use more CMake install rules for the test files rather than relying
on build-root-filesystem.sh. Add some FIXMEs for later, we really
shouldn't be doing installation of test files into /home/anon at the
build-root-filesystem stage in $CURRENT_YEAR. Tests go in /usr/Tests
2022-12-14 20:29:43 +03:30
Lucas CHOLLET d3cdf151a4 Meta: Rename E2FSCK => E2FSCK_PATH
Done to increase consistency with other binaries' path.
2022-12-14 16:43:44 +00:00
Lucas CHOLLET 0fde7fe3c5 Meta: Factorize path resolution
This patch adds the `find_executable()` function that will hopefully
find executables in a distro-agnostic way and that is (hopefully as
well) easily upgradable.

The function uses some bash functionalities. So, we now require bash
for each script that includes `.shell_include.sh`.
2022-12-14 16:43:44 +00:00
Timothy Flynn d382e77d38 LibUnicode: Fix compilation when the UCD download is disabled 2022-12-14 15:24:48 +00:00
Tim Schumacher 9ec2cb3741 ConfigureComponents: Use Core::Stream to read output from whiptail 2022-12-14 15:19:35 +00:00
Baitinq 88c9e4f3b0 Meta: Don't depend on sudo for privileged operations
We previously depended on sudo's specific -E flag to keep all the
environment variables when performing a privilege escalation. We now
incorporate the -E flag into the $SUDO variable, allowing for other
privilege escalation binaries (such as doas) to be used (as long as
they preserve the current environment variables).
2022-12-14 14:38:13 +00:00
Andreas Kling 4abdb68655 LibJS: Remove Object(Object& prototype) footgun
This constructor was easily confused with a copy constructor, and it was
possible to accidentally copy-construct Objects in at least one way that
we dicovered (via generic ThrowCompletionOr construction).

This patch adds a mandatory ConstructWithPrototypeTag parameter to the
constructor to disambiguate it.
2022-12-14 15:11:57 +01:00
Andrew Kaster 16d4791212 CMake: Pass NO_POLICY_SCOPE to options cmake helpers
Tell CMake to not create a new policy scope for the
(lagom|serenity|common)_options.cmake helpers, and lets us set common
policies for both projects in common_options.cmake that actually apply
to the rest of the project, instead of just common_options.cmake itself.
2022-12-14 12:43:12 +01:00
Linus Groh a4d85cd522 LibJS: Convert Promise::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh ddc6e139a6 LibJS: Convert Object::create() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Linus Groh 91b0123eaf LibJS: Convert Array::create{,_from}() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Filiph Siitam Sandström f050534991 Lagom: Don't compile with -fPIC on WIN32 2022-12-13 21:53:29 +00:00
Timothy Flynn bb6a84cc85 LibTimeZone: Update to TZDB version 2022g
https://mm.icann.org/pipermail/tz-announce/2022-November/000076.html
2022-12-13 16:04:32 -05:00
Andrew Kaster 3ca661314f Meta: Build CMake from source if version is too old in serenity.sh 2022-12-13 11:36:14 +01:00
Andrew Kaster e4a59f664b Toolchain+Meta: Add script to build CMake from source
Since we upstreamed CMake support for Serenity, we can use the Platform
files from upstream instead of keeping our local copy. While not added
in this commit, we can add patching capabilities for the platform files
similar to what we do for gdb, llvm, gcc, and binutils later.
2022-12-13 11:36:14 +01:00
Daniel Bertalan 24d2c90a28 BindingsGenerator+CMake: Keep track of IDL dependencies
This commit teaches BindingsGenerator to generate depfiles, which can be
used by CMake to ensure that bindings are properly regenerated when
imported IDL files change.

Two new options, `--depfile` and `--depfile-target` are added.
- `--depfile` sets the path for the dependency file.
- `--depfile-target` lets us set a target name different than the output
  file in the depfile. This option is needed because generated files are
  first written to a temporary file, but depfiles have to refer to the
  final location.
These are analogous to GCC's `-MF` and `-MT` options respectively. The
depfile's syntax matches the ones generated by GCC.

Note: This changes the minimal required CMake version to 3.20 if the
Make generator is used, and to 3.21 for the Xcode generator. Ninja is
not affected.
2022-12-13 11:31:24 +01:00
Daniel Bertalan 8d1ad592a1 BindingsGenerator: Write generated code to disk instead of stdout
This commit adds the `-o` option for specifying an output path to
BindingsGenerator.
2022-12-13 11:31:24 +01:00
Jan200101 483c18437b Meta: Detect ccache being passed as the compiler
This prevents ccache from being invoking itself.
Icecc fails to ran this way because of recursion detection.
2022-12-12 21:34:09 -07:00
Jan200101 10d40af167 Meta: Separate ccache setup into its own component 2022-12-12 21:34:09 -07:00
Tim Schumacher 9a3e95785e LibCore: Propagate errors from Stream::*_entire_buffer 2022-12-12 14:16:42 +01:00
Tim Schumacher 6c7c5a6786 LibCore: Rename Stream::*_or_error to *_entire_buffer
All of our functions are `_or_error` (or are about to be), and maybe
making it less reminiscient of AK::Stream will make people use it more.
2022-12-12 14:16:42 +01:00
Tim Schumacher ed4c2f2f8e LibCore: Rename Stream::read_all to read_until_eof
This generally seems like a better name, especially if we somehow also
need a better name for "read the entire buffer, but not the entire file"
somewhere down the line.
2022-12-12 14:16:42 +01:00
Tim Schumacher 5061a905ff LibCore: Remove Stream::is_{readable,writable}
Next to functions like `is_eof` these were really confusing to use, and
the `read`/`write` functions should fail anyways if a stream is not
readable/writable.
2022-12-12 14:16:42 +01:00
Timothy Flynn 78353ec184 sql: Support running the sql REPL on Lagom 2022-12-11 10:08:17 -05:00
Tim Schumacher 20f0858f67 Meta: Return 0 from the fuzzing function in most cases
LibFuzzer documentation [1] states that all return values except for 0
and -1 are currently reserved for future use. -1 is a special return
value that causes LibFuzzer to not add a testing input to the testing
corpus, regardless of the code coverage that it causes.

[1] https://llvm.org/docs/LibFuzzer.html
2022-12-10 16:21:12 -07:00
Thomas Queiroz 6debd967ba Lagom/CodeGenerators: Use HashMap::try_ensure_capacity 2022-12-10 14:29:46 +01:00
Tim Schumacher b0af53749d Meta: Switch to the Lagom directory before building fuzzers
This confused quite a number of people in the past, and it is still
slightly annoying to always switch the directory when testing both the
OS and the fuzzer build. Instead, let's just switch to the correct
directory automatically.
2022-12-10 14:03:46 +01:00
Lucas CHOLLET 839c1a574d CI: Add a check to report git merge commit 2022-12-10 12:07:06 +00:00
Tim Schumacher f93c7fbb5e LibCompress: Port GzipDecompressor to Core::Stream 2022-12-10 12:05:55 +00:00
Andrew Kaster 0e90b0921e Meta: Use absolute paths in Meta/analyze-qemu-coverage.sh
This is a bit easier to read in the output when running locally, and a
bit better script hygiene overall.
2022-12-10 11:51:16 +00:00
Andrew Kaster 8356677868 CMake: Force-link clang_rt.profile.a to LibC when building with coverage
This used to be in place until 671712cae6.

I had commented on that PR that "yeah should be good to remove". Turns
out that's not the case. A future patch to the clang driver might make
this obsolete :^).
2022-12-10 11:51:16 +00:00
Luke Wilde 565dc0f296 LibWeb: Add namespace qualifier to type names equal to a C++ namespace
For example, Document.getSelection returns Selection, which is in the
Selection namespace.

Namespaces.h has Linus' copyright since he changed the "is_one_of" list
to an Array.
2022-12-10 00:21:10 +00:00
Tim Schumacher 2fc2025f49 LibCore: Move Core::Stream::File::exists() to Core::File
`Core::Stream::File` shouldn't hold any utility methods that are
unrelated to constructing a `Core::Stream`, so let's just replace the
existing `Core::File::exists` with the nicer looking implementation.
2022-12-08 12:52:14 +00:00
Linus Groh 525f22d018 LibJS: Replace standalone js_string() with PrimitiveString::create()
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
2022-12-07 16:43:06 +00:00
Timothy Flynn 3a915483b0 IPCCompiler: Mark size_t as a primitive type
This allows size_t to be used within an IPC message without being passed
by const-reference.
2022-12-07 13:09:00 +01:00
MacDue 1574f2c3f6 Meta+Userland: Pass Gfx::FloatSize by value
Just two floats like Gfx::FloatPoint.
2022-12-07 11:48:27 +01:00
MacDue 27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue e011eafd37 Meta+Userland: Pass Gfx::FloatPoint by value
Just a small 8-byte value like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue 7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
MacDue bbc149ebb9 Meta+Userland: Pass Gfx::Color by value
Gfx::Color is always 4 bytes (it's just a wrapper over u32) it's less
work just to pass the color directly.

This also updates IPCCompiler to prevent from generating
Gfx::Color const &, which makes replacement easier.
2022-12-07 11:48:27 +01:00
Timothy Flynn d50b9165cd Meta: Manually compute the length of the WASM JS REPL source string
The REPL does not have a reliable way to tell us the UTF-8 byte count of
the source string, so we must use strlen() ourselves.
2022-12-06 13:53:24 +00:00
Linus Groh 57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Timothy Flynn 91b3a3bb58 Meta: Initialize the WASM JS REPL with a known time zone
The runtime environment of the WASM REPL does not have time zone
information; the file system is virtual (does not have /etc/localtime),
and the TZ environment variable is not set. This causes LibTimeZone to
always fall back to UTC.

Instead, we can get the time zone from the user's browser before we
enter this limited environment. The REPL website will pass the time zone
into the WASM REPL.
2022-12-05 22:24:50 +00:00
Timothy Flynn 14524ad019 Meta: Explicitly link generated compile-time data into the WASM JS REPL
Without this, we were in a weird state where LibTimeZone believed it had
TZDB data, but that data wasn't actually available to it. This caused
functions like JS::get_named_time_zone_offset_nanoseconds() to trip an
assertion when entering "new Date();" into the REPL.
2022-12-05 22:24:50 +00:00
Tim Schumacher c57be0f474 LibAudio: Switch LoaderPlugin to a more traditional constructor pattern
This now prepares all the needed (fallible) components before actually
constructing a LoaderPlugin object, so we are no longer filling them in
at an arbitrary later point in time.
2022-12-05 17:49:47 +01:00
Linus Groh babfc13c84 Everywhere: Remove 'clang-format off' comments that are no longer needed
https://github.com/SerenityOS/serenity/pull/15654#issuecomment-1322554496
2022-12-03 23:52:23 +00:00
Linus Groh d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Linus Groh 8639d8bc21 Meta: Switch to clang-format-15 as the standard formatter
The two major changes noticeable on the SerenityOS codebase are:
- Much improved support for const placement, clang-format-14 ignored
  our east-const configuration in various places
- Different formatting for requires clauses, now breaking them onto
  their own line, which helps with readability a bit

Current versions of CLion also ship LLVM 15, so the built-in formatting
now matches CI formatting again :^)
2022-12-03 23:52:23 +00:00
Andrew Kaster f539bf467c Meta+CI: Add CI job specifically for bundling serenity-js artifacts
These are used by esvu, and it is sad that we don't have macOS binaries
availble for consumption by esvu users. Add a matrix job to handle this
separately from the test262 results.
2022-12-03 09:05:40 -05:00
Luke Wilde 715e56a74c LibWeb: Add @@toStringTag to platform object prototypes
This was forgotten to be added in the LibWeb GC conversion.
This caused some brand checks to fail in skribbl.io's JavaScript and
thus caused unexpected exceptions.
2022-11-30 18:21:02 +01:00
Tim Schumacher d402f6cdb3 LibCore: Add support for ReadonlyBytes to MemoryStream 2022-11-30 12:09:53 +00:00
Tim Schumacher fd3a823a20 LibArchive: Move loading the next tar header into a helper function
This now also validates the first header that is loaded, so we can drop
the corresponding FIXME from `tar`.
2022-11-30 08:03:31 +01:00
Tim Schumacher cbeaba0c12 LibArchive: Use Core::Stream inside TarInputStream 2022-11-30 08:03:31 +01:00
Andrew Kaster 1adc3530b2 CI: Install gcc-12 for Android nightly CI job
This *also* got missed in the gcc-12 update, because we weren't
installing an explicit gcc version prior. Hopefully that's the last of
the long tail of issues from that migration!
2022-11-26 09:40:07 +01:00
Andrew Kaster 9bf2a7c7e5 Meta: Use proper versions in is_compiler_supported check in serenity.sh
We were checking the compilers against clang-12 and gcc-10. Since the
check itself is confusing, some comments are warranted.
2022-11-25 18:41:21 -07:00
implicitfield 19e6befddc FuzzTar+tar: Advance the stream before continuing
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53733
This bug was caused by a regression introduced in c88d8a2.
2022-11-26 01:24:12 +01:00
Ali Mohammad Pur f102931688 Meta: Add a js REPL wasm target
...and build it only with emscripten.
2022-11-26 02:23:15 +03:30
Ali Mohammad Pur 2110e7cf85 Everywhere: Add support for compilation under emscripten
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-11-26 02:23:15 +03:30
Zaggy1024 393cfdd5c5 LibVideo: Read Matroska lazily so that large files can start quickly
The Demuxer class was changed to return errors for more functions so
that all of the underlying reading can be done lazily. Other than that,
the demuxer interface is unchanged, and only the underlying reader was
modified.

The MatroskaDocument class is no more, and MatroskaReader's getter
functions replace it. Every MatroskaReader getter beyond the Segment
element's position is parsed lazily from the file as needed. This means
that all getter functions can return DecoderErrors which must be
handled by callers.
2022-11-25 23:28:39 +01:00
Zaggy1024 9cf7e8c5aa LibVideo: Reorganize demuxer file hierarchy and rename Matroska files
As new demuxers are added, this will get quite full of files, so it'll
be good to have a separate folder for these.

To avoid too many chained namespaces, the Containers subdirectory is
not also a namespace, but the Matroska folder is for the sake of
separating the multiple classes for parsed information entering the
Video namespace.
2022-11-25 23:28:39 +01:00
Baitinq 45e22dafb3 Meta: Look for e2fsck path on build-image-qemu.sh
Now we attempt to look for the path of e2fsck before checking if the
path can be found in any of the predefined routes. This fixes e2fsck
not being found on some "special" distros like NixOS.

Related #13754
2022-11-24 16:58:30 +01:00
Timothy Flynn e840d27d8e headless-browser: Add a mode for being controlled by WebDriver
This adds command line flags for WebDriver to pass its IPC socket path
(if running on Serenity) or its FD passing socket (if running elsewhere)
for the headless-browser to connect to.
2022-11-24 00:10:56 +00:00
Andreas Kling 71067cbc6c LibJS+LibWeb: Make Runtime/AbstractOperations.h not include AST.h
This led to considerable fallout and many files had to be patched with
now-missing include statements.
2022-11-23 16:05:59 +00:00
implicitfield ee0c9ed87b LibArchive: Simplify error handling 2022-11-23 11:19:16 +01:00
Timothy Flynn b2164ad979 Meta: Do not hard-code index types for UCD/CLDR/TZDB code generators
Hand-picking the smallest index type that fits a particular generated
array started with commit 3ad159537e. This
was to reduce the size of the generated library.

Since then, the number of types using UniqueStorage has grown a ton,
creating a long list of types for which index types are manually picked.
When a new UCD/CLDR/TZDB is released, and the current index type no
longer fits the generated data, we fail to generate. Tracking down which
index caused the failure is a pretty annoying process.

Instead, we can just use size_t while in the generators themselves, then
automatically pick the size needed for the generated code.
2022-11-18 17:00:51 +00:00
Gunnar Beutner 3287aa20b1 Meta: Don't try to enable GDB support on Windows
This probably didn't work before either but the option
was silently ignored by GDB. Unfortunately 7.2.0-rc0 isn't so kind.
2022-11-15 07:27:00 -05:00
implicitfield c88d8a21cc LibArchive: Make TarInputStream::advance report errors
Fixes this bug that was reported by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52862
2022-11-13 17:37:26 -07:00
Andrew Kaster a2cd61d19d CI: Use gcc-12 in nightly Android host lagom build stage 2022-11-11 10:26:55 +01:00
Timothy Flynn 357fd76e30 Meta: Generate a helper constructor for single-value IPC responses
When an IPC message returns a single value, we generate a class with a
constructor that is something like:

    class MessageResponse {
        MessageResponse(SingleReturnType value)
            : m_value(move(value))
        {
        }
    };

If that IPC message wants to return a value that SingleReturnType is
constructible from, you have to wrap that return call with braces:

    return { value_that_could_construct_single_return_type };

That isn't really an issue except for when we want to mix TRY semantics
with the return type. If SingleReturnType is constructible from an Error
type (i.e. something similar to ErrorOr), the following doesn't work:

    TRY(fallible_function());

Because MessageResponse would not be constructible from Error. Instead,
we must do some workaround with a custom TRY macro, as in 31bb792.

This patch generates a constructor that makes TRY usable as-is without
any custom macros. We perform a very similar trick in ThrowCompletionOr
inside LibJS. This constructor will allow you to create MessageResponse
from any type that SingleReturnType is constructible from.
2022-11-09 14:15:59 +00:00
Timothy Flynn 3618abdd19 Meta: Compile new WebContent IPC endpoints for WebDriver in Lagom 2022-11-09 07:43:11 +01:00
Liav A 3cc0d60141 Kernel: Split the Ext2FileSystem.{cpp,h} files into smaller components 2022-11-08 02:54:48 -07:00
Gunnar Beutner 4e406b0730 Meta+LibUnicode: Avoid relocations for emoji data
Previously each emoji had its own symbol in the library which was then
referred to by another symbol. This caused thousands of avoidable data
relocations at load time.

This saves about 122kB RAM for each process which uses LibUnicode.
2022-11-06 17:34:06 +01:00
Gunnar Beutner 2d3567ee92 Meta+LibUnicode: Avoid relocations for static unicode data
Previously the s_decomposition_mappings variable would refer to other
data in s_decomposition_mappings_data. This would cause thousands of
avoidable relocations at load time.

This saves about 128kB RAM for each process which uses LibUnicode.
2022-11-06 17:34:06 +01:00
Gunnar Beutner f2ccb702e8 Meta: Make file-system resizing work on macOS
Previously we'd fail to execute the resize2fs tool which then results
in us recreating the image from scratch:

resizing disk image...
Image resized.
line 132: /usr/sbin/resize2fs: No such file or directory
failed, not using existing image
done
2022-11-04 09:05:36 +00:00
Timothy Flynn 558901acb4 LibTimeZone: Update to TZDB version 2022f
https://mm.icann.org/pipermail/tz-announce/2022-October/000075.html
2022-11-04 08:56:11 +00:00
Timothy Flynn a5bf32018f LibJS+LibUnicode: Add "microsecond" and "nanosecond" as sanctioned units
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/f627573
2022-11-03 18:37:48 +00:00
Timothy Flynn b820b9b2ff LibUnicode: Make the generated .h and .cpp paths for emoji data optional
This is to allow people making emoji to run the generator to create the
expected commit message format.
2022-11-03 16:37:04 +00:00
Aliaksandr Kalenik e4db71c88b LibWeb: Support translate3d 2022-11-02 11:04:23 +00:00
Aliaksandr Kalenik f099e2aa12 LibWeb: Use more verbose input in CSS transform function generator 2022-11-02 11:04:23 +00:00
Tim Schumacher ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Tim Schumacher 678db534ff LibC: Properly implement stack protectors
The shared parts are now firmly compiled into LibC instead of being
defined as a static library and then being copied over manually.
The non-shared ("local") parts are kept as a static library that is
linked into each binary on demand.

This finally allows us to support linking with the -fstack-protector
flag, which now replaces the `ssp` target being linked into each binary
accidentally via CMake.
2022-11-01 14:49:09 +00:00
Tim Schumacher 7834e26ddb Everywhere: Explicitly link all binaries against the LibC target
Even though the toolchain implicitly links against -lc, it does not know
where it should get LibC from except for the sysroot. In the case of
Clang this causes it to pick up the LibC stub instead, which might be
slightly outdated and feature missing symbols.

This is currently not an issue that manifests because we pass through
the dependency on LibC and other libraries by accident, which causes
CMake to link against the LibC target (instead of just the library),
and thus points the linker at the build output directory.

Since we are looking to fix that in the upcoming commits, let's make
sure that everything will still be able to find the proper LibC first.
2022-11-01 14:49:09 +00:00
Timothy Flynn 9e9a07415e CI: Ensure the manpage generation step shuts down the VM on failure
Currently, if the script fails, it simply runs "exit 1". This exits the
script, but keeps the VM running, so CI hangs until it times out.

Instead of exiting, write a failure status to an error log and shutdown.
CI can then read that error log and fail the run if needed.
2022-10-31 22:10:14 +00:00
Linus Groh acfb546048 LibWeb: Handle currently ignored WebIDL::ExceptionOr<T>s 2022-10-31 14:12:44 +00:00
Linus Groh f01d90aa63 Lagom: Update GCC version check in CMakeLists.txt
This was forgotten in bc2ebcadc0.
2022-10-31 14:08:39 +00:00