Commit graph

1574 commits

Author SHA1 Message Date
Andrew Kaster d0e002d122 CI: Use proper paths to template files in nightly-pipeline.yml
Azure paths are relative to the pipeline file.
Addtionally, pipeline stages can't have spaces or parentheses in them
2022-05-07 20:38:18 +02:00
EWouters a07e12609e Ports/mrsh: Fix workdir, remove or upgrade patches
Also removes mrsh from the list of ports missing descriptions. I tried
to be descriptive about the patches, but as I picked this port up from
someone else, I'm not 100% sure how to best explain the patches.
2022-05-07 17:00:39 +02:00
Liav A c246d86867 Meta: Use VMWare SVGA adapter if running QEMU Q35 machine
This let us test the VMWare SVGA adapter easily. We already use the std
vga (which is compatible with bochs-display that only lacks VGA support)
on the i440FX QEMU machine so we keep testing it there too, and on the
Q35 machine we use a bochs-display device as secondary display.
2022-05-06 18:04:57 +02:00
Andrew Kaster 44bcd7c7aa CI: Add x86_64 Clang Coverage pipeline in Azure
Add a job to the Azure pipelines to run tests with coverage enabled, and
aggregate the test results in a folder of html pages showing the
coverage results overall, and per-file.

Future work is needed to take the published pipeline artifact for the
coverage results and display them somewhere interesting.
2022-05-02 01:46:18 +02:00
Andrew Kaster 3e32fb911e Meta: Add script to analyze coverage data from an existing disk image
The analyze-qemu-coverage.sh script cracks open the _disk_image for the
given SERENITY_ARCH and SERENITY_TOOLCHAIN and extracts llvm profile
data into a local directory owned by the current user. It then calls a
coverage artifact script from llvm to create a nice html report for all
the source files referenced by the profile data files.

We currently grab a script from llvm via wget. In the future a custom
script to call llvm-cov and llvm-profdata should probably be used.
2022-05-02 01:46:18 +02:00
Andrew Kaster 5120b39d0e Meta+Userland: Add ENABLE_USERSPACE_COVERAGE_COLLECTION CMake option
This option sets -fprofile-instr-generate -fcoverage-mapping for Clang
builds only on almost all of Userland. Loader and LibTimeZone are
exempt. This can be used for generating code coverage reports, or even
PGO in the future.
2022-05-02 01:46:18 +02:00
Andrew Kaster a6b2c34746 Meta: Remove unused serenity_libc_static helper function 2022-05-02 01:46:18 +02:00
kleines Filmröllchen df57536c40 AK: Put invalid UTF8 debug spam behind a flag
This is very annoying if we're (intentionally) passing invalid UTF8 into
Utf8View.
2022-04-27 00:02:24 +02:00
kleines Filmröllchen a67bbf1ac4 Meta: Re-enable automatic virtualization detection on Windows
Before, we wouldn't enable virtualization on Windows anymore unless
SERENITY_VIRTUALIZATION_SUPPORT was set explicitly. As far as we know,
there's no automatic way of detecting whether WHPX is enabled or not. So
we'll just enable virtualization on Windows by default, and if that
doesn't work the user can still disable it manually with
SERENITY_VIRTUALIZATION_SUPPORT=0.
2022-04-26 22:42:38 +02:00
Daniel Bertalan dbb2347000 Meta: Allow Clang to be used as the host compiler for Lagom
Various Clang binaries are now considered when choosing the compiler for
Lagom.

The selection precedence is as follows:
1. Use the compiler set via CC/CXX if it's a supported version
2. Use newest available GCC if it's supported
3. Use newest available Clang if it's supported

Note that Apple Clang is still not supported, as its versioning scheme
and the fact that it masquerades as both GCC and Clang would complicate
this logic even more.

Fixes #12253
2022-04-26 15:01:46 +02:00
Daniel Bertalan 57c6829249 CI: Update the path to our LLVM patches
The LLVM patch has been broken up into smaller commits and moved to a
separate directory. CI should look at this new location to determine if
the toolchain needs to be rebuilt.
2022-04-23 10:43:32 -07:00
Daniel Bertalan d6a735fe62 Meta: Use clang-format from the Clang toolchain if available 2022-04-23 10:43:32 -07:00
Daniel Bertalan 01b31d9858 Toolchain+Ports: Update LLVM to 14.0.1
Besides a version bump, the following changes have been made to our
toolchain infrastructure:
- LLVM/Clang is now built with -march=native if the host compiler
  supports it. An exception to this is CI, as the toolchain cache is
  shared among many different machines there.
- The LLVM tarball is not re-extracted if the hash of the applied
  patches doesn't differ.
- The patches have been split up into atomic chunks.
- Port-specific patches have been integrated into the main patches,
  which will aid in the work towards self-hosting.
- <sysroot>/usr/local/lib is now appended to the linker's search path by
  default.
- --pack-dyn-relocs=relr is appended to the linker command line by
  default, meaning ports take advantage of RELR relocations without any
  patches or additional compiler flags.

The formatting of LLVM port's package.sh has been bothering me, so I
also indented the arguments to the CMake invocation.
2022-04-23 10:43:32 -07:00
kleines Filmröllchen 60ff054b02 Meta: Rename SERENITY_KVM_SUPPORT -> SERENITY_VIRTUALIZATION_SUPPORT 2022-04-23 13:39:13 +02:00
kleines Filmröllchen 67d99f80b9 Meta: Use SERENITY_KVM_SUPPORT to also toggle virtualization on Windows
It's sometimes nice to turn off virtualization, even on Windows :^)
2022-04-23 13:39:13 +02:00
kleines Filmröllchen 49b087f3cd LibAudio+Userland: Use new audio queue in client-server communication
Previously, we were sending Buffers to the server whenever we had new
audio data for it. This meant that for every audio enqueue action, we
needed to create a new shared memory anonymous buffer, send that
buffer's file descriptor over IPC (+recfd on the other side) and then
map the buffer into the audio server's memory to be able to play it.
This was fine for sending large chunks of audio data, like when playing
existing audio files. However, in the future we want to move to
real-time audio in some applications like Piano. This means that the
size of buffers that are sent need to be very small, as just the size of
a buffer itself is part of the audio latency. If we were to try
real-time audio with the existing system, we would run into problems
really quickly. Dealing with a continuous stream of new anonymous files
like the current audio system is rather expensive, as we need Kernel
help in multiple places. Additionally, every enqueue incurs an IPC call,
which are not optimized for >1000 calls/second (which would be needed
for real-time audio with buffer sizes of ~40 samples). So a fundamental
change in how we handle audio sending in userspace is necessary.

This commit moves the audio sending system onto a shared single producer
circular queue (SSPCQ) (introduced with one of the previous commits).
This queue is intended to live in shared memory and be accessed by
multiple processes at the same time. It was specifically written to
support the audio sending case, so e.g. it only supports a single
producer (the audio client). Now, audio sending follows these general
steps:
- The audio client connects to the audio server.
- The audio client creates a SSPCQ in shared memory.
- The audio client sends the SSPCQ's file descriptor to the audio server
  with the set_buffer() IPC call.
- The audio server receives the SSPCQ and maps it.
- The audio client signals start of playback with start_playback().
- At the same time:
  - The audio client writes its audio data into the shared-memory queue.
  - The audio server reads audio data from the shared-memory queue(s).
  Both sides have additional before-queue/after-queue buffers, depending
  on the exact application.
- Pausing playback is just an IPC call, nothing happens to the buffer
  except that the server stops reading from it until playback is
  resumed.
- Muting has nothing to do with whether audio data is read or not.
- When the connection closes, the queues are unmapped on both sides.

This should already improve audio playback performance in a bunch of
places.

Implementation & commit notes:
- Audio loaders don't create LegacyBuffers anymore. LegacyBuffer is kept
  for WavLoader, see previous commit message.
- Most intra-process audio data passing is done with FixedArray<Sample>
  or Vector<Sample>.
- Improvements to most audio-enqueuing applications. (If necessary I can
  try to extract some of the aplay improvements.)
- New APIs on LibAudio/ClientConnection which allows non-realtime
  applications to enqueue audio in big chunks like before.
- Removal of status APIs from the audio server connection for
  information that can be directly obtained from the shared queue.
- Split the pause playback API into two APIs with more intuitive names.

I know this is a large commit, and you can kinda tell from the commit
message. It's basically impossible to break this up without hacks, so
please forgive me. These are some of the best changes to the audio
subsystem and I hope that that makes up for this :yaktangle: commit.

:yakring:
2022-04-21 13:55:00 +02:00
kleines Filmröllchen 6b13436ef6 LibCore: Introduce SharedSingleProducerCircularQueue
This new class with an admittedly long OOP-y name provides a circular
queue in shared memory. The queue is a lock-free synchronous queue
implemented with atomics, and its implementation is significantly
simplified by only accounting for one producer (and multiple consumers).
It is intended to be used as a producer-consumer communication
datastructure across processes. The original motivation behind this
class is efficient short-period transfer of audio data in userspace.

This class includes formal proofs of several correctness properties of
the main queue operations `enqueue` and `dequeue`. These proofs are not
100% complete in their existing form as the invariants they depend on
are "handwaved". This seems fine to me right now, as any proof is better
than no proof :^). Anyways, the proofs should build confidence that the
implemented algorithms, which are only roughly based on existing work,
operate correctly in even the worst-case concurrency scenarios.
2022-04-21 13:55:00 +02:00
Tim Schumacher ec6016fa2c Meta: Allow setting a host IP address to bind to 2022-04-20 14:12:34 +02:00
Tim Schumacher 1878488c04 Meta: Commonize network device settings 2022-04-20 14:12:34 +02:00
Ali Mohammad Pur 302a0c54f0 Base: Add some default completions to shellrc 2022-04-18 19:53:10 +04:30
Sam Atkins 42d87239a8 LibWeb: Generate some metadata about transform functions
This will be used to parse and validate their parameters.
2022-04-18 14:16:28 +02:00
Sam Atkins 872ad98eba LibWeb: Generate TransformFunction to/from string functions 2022-04-18 14:16:28 +02:00
Sam Atkins 5f3498d50f LibWeb: Add code generator for CSS transform functions
This first step just generates the TransformFunction enum, but more will
follow.
2022-04-18 14:16:28 +02:00
Tim Schumacher 8c278bba43 Meta: Keep timestamps of manually copied toolchain output 2022-04-17 10:53:31 -07:00
Jelle Raaijmakers 8cfabbcd93 Tests: Implement reference image testing for LibGL
Each LibGL test can now be tested against a reference QOI image.
Initially, these images can be generated by setting `SAVE_OUTPUT` to
`true`, which will save a bunch of QOI images to `/home/anon`.
2022-04-17 09:58:29 +04:30
Sam Atkins d564cf1e89 LibCore+Everywhere: Make Core::Stream read_line() return StringView
Similar reasoning to making Core::Stream::read() return Bytes, except
that every user of read_line() creates a StringView from the result, so
let's just return one right away.
2022-04-16 13:27:51 -04:00
Sam Atkins 3b1e063d30 LibCore+Everywhere: Make Core::Stream::read() return Bytes
A mistake I've repeatedly made is along these lines:
```c++
auto nread = TRY(source_file->read(buffer));
TRY(destination_file->write(buffer));
```

It's a little clunky to have to create a Bytes or StringView from the
buffer's data pointer and the nread, and easy to forget and just use
the buffer. So, this patch changes the read() function to return a
Bytes of the data that were just read.

The other read_foo() methods will be modified in the same way in
subsequent commits.

Fixes #13687
2022-04-16 13:27:51 -04:00
Sam Atkins a20188cd91 LibWeb: Use generated enum code for property value validation
This has the nice benefit of removing a lot of duplicated lists of
values from Properties.json. :^)
2022-04-14 14:54:06 +02:00
Sam Atkins c66da0f2cb LibWeb: Assign an underlying type to generated CSS enums
I'm *pretty* sure that even a u32 would be overkill but you never know
with CSS specs.
2022-04-14 14:54:06 +02:00
Sam Atkins c50661067d LibWeb: Generate and use to_string(css_enum) functions
The only one that's actually used is for Repeat, but it's easy to
generate them so might as well. :^)
2022-04-14 14:54:06 +02:00
Sam Atkins 9bf511caa3 LibWeb: Generate to_value_id() functions 2022-04-14 14:54:06 +02:00
Sam Atkins 3f61f869c8 LibWeb: Generate ValueID-to-enum conversion functions 2022-04-14 14:54:06 +02:00
Sam Atkins a97944e483 LibWeb: Add a new code generator for CSS enums
Alias values are represented by "alias-name=real-name".

We have a lot of repetitive code for converting between ValueID and
property-specific enums. Let's see if we can generate it. :^)

This first step just produces the enums, from a JSON file. The values in
there are a duplication of what's in Properties.json, but eventually
those will go away.
2022-04-14 14:54:06 +02:00
Sam Atkins c449cabae3 LibWeb: Move CSS Parser into new Web::CSS::Parser namespace
The goal here is to move the parser-internal classes into this namespace
so they can have more convenient names without causing collisions. The
Parser itself won't collide, and would be more convenient to just
remain `CSS::Parser`, but having a namespace and a class with the same
name makes C++ unhappy.
2022-04-12 23:03:46 +02:00
EWouters d89a58216d Ports/pt2-clone: Update pt2-clone to version 1.43
Upgrade patches to git style, add ReadMe.md and remove from the list
of ports missing descriptions.
2022-04-11 19:43:56 -07:00
EWouters cf0798158a Ports/klong: Update klong to version 20220315
Upgrade patch to git style, add ReadMe.md and remove from the list of
ports missing descriptions.
2022-04-11 19:43:56 -07:00
EWouters 769615fc48 Ports/gawk: Update gawk to version 5.1.1
The patch for config.sub is no longer required.

This also removes gawk from the list of ports missing descriptions as
it no longer has any patches.
2022-04-11 19:43:56 -07:00
EWouters 8828b038f5 Ports/diffutils: Update diffutils to version 3.8
The fnmatch patch that was added in 6de6dff is reverted because it is
not clear why it is necessary, as discussed in #9206.

This also removes diffutils from the list of ports missing descriptions
as it no longer has any patches.
2022-04-11 19:43:56 -07:00
Simon Wanner 4cbbb72ce8 Meta/Lagom: Add a fuzzer for the WOFF parser 2022-04-09 23:48:18 +02:00
Simon Wanner bf6d64c199 LibGfx: Add a loader the Web Open Font Format (WOFF)
This format is 'just' a zlib compressed wrapper for TrueType/OpenType
which makes implementing it rather convenient. :^)
2022-04-09 23:48:18 +02:00
Simon Wanner 206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Simon Wanner 6f8fd91f22 LibGfx: Move TTF files from TrueTypeFont/ to Font/TrueType/ 2022-04-09 23:48:18 +02:00
stelar7 ce08fae13b Meta: Add fuzzer for Poly1305 2022-04-08 14:02:02 +04:30
Timothy Flynn 1f2542247f LibUnicode: Upgrade to CLDR version 41.0.0
Release notes: https://cldr.unicode.org/index/downloads/cldr-41

Note that the HourCycleRegion enum now contains 272 entires, thus needs
to be bumped from u8 to u16.
2022-04-07 08:29:10 -04:00
Timothy Flynn 8a46794ff8 LibUnicode: Replace individual UCD file downloads with single UCD.zip
Instead of downloading nearly 20 files individually, we can download a
single .zip file similar to how we download a single CLDR .zip. This is
to reduce the number of connections/downloads to/from unicode.org.
2022-04-06 17:12:08 -07:00
Stephan Unverwerth 5bb76e9b63 LibGL+LibGPU+LibSoftGPU: Load SoftGPU driver dynamically
This loads libsoftgpu.so during GLContext creation and instantiates the
device class which is then passed into the GLContext constructor.
2022-04-06 11:32:24 +02:00
Kenneth Myhra 0b86574293 LibWeb: Verify argument_check before generating if statement
This fixes an error where we would generate an empty 'if' statement body
if argument_check was empty.
2022-04-05 22:33:44 +02:00
Kenneth Myhra 887e13f364 LibWeb: Get argument count from Function::parameters::size()
Previously this retrieved argument count from Function::length() which
did not return the correct count in all situations.
2022-04-05 22:33:44 +02:00
Kenneth Myhra ba23d036bd LibWeb: Add IDLGenerators::is_primitive()
This adds the is_primitive() method as described in the Web IDL
specification. is_primitive() returns true if the type is a bigint,
boolean or numeric type.
2022-04-05 22:33:44 +02:00
Timothy Flynn b36c3a68d8 js: Convert non-UTF-8 encoded files to UTF-8 before parsing 2022-04-05 00:14:29 +01:00
Nico Weber fd82121319 Tests: Add some test coverage for the TTF parser
This is in Tests/LibTTF instead of Tests/LibGfx because Tests/LibGfx
depends on serenity's file system layout and can't run in lagom,
but this new test runs just fine in lagom.
2022-04-03 19:16:03 +02:00
Nico Weber 9b24600779 Meta: Give Lagom build errors colored diagnostics
Non-lagom builds get this from the root CMakeLists.txt file,
but lagom builds didn't before this change.
2022-04-03 19:16:03 +02:00
Jelle Raaijmakers 9ca15793e7 Meta: Move screenshots into subdir
It's a bit neater to give them their own directory instead of jamming
them in between our shell scripts :^)
2022-04-03 13:14:15 +01:00
Jelle Raaijmakers 31b72c20f0 Meta: Check port property for ports in the linter
We now make sure the directory name and `port` property are identical.
2022-04-03 12:35:14 +01:00
Sam Atkins b07659d00c Meta+LibWeb: Port PropertyID.h/cpp generators to invoke_generator() 2022-04-02 09:18:07 -04:00
Sam Atkins fc81d6c9f3 Meta+LibWeb: Port ValueID.h/cpp generators to invoke_generator() 2022-04-02 09:18:07 -04:00
Sam Atkins cb406e79f4 Meta+LibWeb: Port MediaFeatureID.h/cpp generators to invoke_generator() 2022-04-02 09:18:07 -04:00
Idan Horowitz b172b56757 LibWeb: Include relevant headers in IDL constructor implementations
Similarly to implementations of prototype methods, the implementations
of constructors sometimes require generated types.
2022-04-02 13:13:37 +03:00
Idan Horowitz a7f2d46b49 LibWeb: Support integral default values for IDL unions 2022-04-02 13:13:37 +03:00
Idan Horowitz 32d142b06c LibWeb: Remove no-op calls to emit_includes_for_all_imports for headers
When called with is_header=true the method was essentailly a no-op.
2022-04-02 13:13:37 +03:00
Idan Horowitz 110d73d786 LibWeb: Strip double quotes from IDL enum default values 2022-04-02 13:13:37 +03:00
Idan Horowitz 3ee8b5e534 LibWeb: Cache and reuse resolved IDL imports instead of rejecting them
This ensures that transitive imports succeed even if they were directly
imported beforehand.
2022-04-02 12:22:48 +04:30
Ali Mohammad Pur 265dd9b445 Meta: Avoid showing elements in extremely large vectors in gdb
This is most often just an invalid vector anyway.
2022-04-01 21:41:41 +01:00
Ali Mohammad Pur 899888bbf2 Meta: Update gdb script for changes in HashTable 2022-04-01 21:41:41 +01:00
Idan Horowitz 086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Idan Horowitz 852ae6c195 Meta: Switch to clang-format-14 as the standard formatter
Now that clang-format-14 ubuntu packages are available, it's time to
finally upgrade our clang-format version. This version brings with it
a bunch of useful features with const-placement being the most notable.
These will be enabled in the following commits.
2022-04-01 21:24:45 +01:00
Liav A d0abae8907 Kernel: Stop debug spam when using mmap on /dev/mem device
This is not really useful and quite annoying so let's disable it by
default.
2022-04-01 19:59:45 +02:00
Tim Schumacher 743922984c Fuzzers: Add a basic input shim when running standalone 2022-03-31 22:11:04 -07:00
Tim Schumacher bf502ae3b0 CMake: Allow building fuzzing targets without libFuzzer or OSS-Fuzz 2022-03-31 22:11:04 -07:00
Tim Schumacher e3519b8e5c Meta: Rename Fuzzer flags to ENABLE_FUZZERS_{LIBFUZZER,OSSFUZZ} 2022-03-31 22:11:04 -07:00
EWouters 98db3a3ce9 Meta: Fix format-string in the port linter 2022-03-31 21:59:20 -07:00
Matthew Olsson 5f9d35909d LibPDF: Move font files into their own directory 2022-03-31 18:10:45 +02:00
Idan Horowitz f45d361f03 LibWeb: Replace ad-hoc EventHandler type with callback function typedef 2022-03-31 01:10:47 +02:00
Idan Horowitz 1c4f128fd1 LibWeb: Add support for IDL callback functions 2022-03-31 01:10:47 +02:00
Idan Horowitz 9ff79c9d54 LibWeb: Support non-interface top-level extended attributes 2022-03-31 01:10:47 +02:00
Idan Horowitz c14cb65215 LibWeb: Add support for IDL typedefs 2022-03-31 01:10:47 +02:00
Idan Horowitz f0cd28dedd LibWeb: Stop generating C++ includes for non-code-generating IDL files
Specifically, IDL files that do not include interface or enumeration
declarations do not generate any code, and as such should not be
included.
2022-03-31 01:10:47 +02:00
Pankaj Raghav 820a653725 Meta: Use 4k logical and physical blocks for nvme in QEMU
4k logical blocks are better for block devices in QEMU as they align
with the underlying filesystem which typically has 4k logical blocks
such as our EXT2 filesystem.
2022-03-30 19:31:12 +03:00
Timothy Flynn 066352c9aa LibJS+LibUnicode: Align ECMA-402 "sanctioned" terminology with UTS 35
This is an editorial change in the Intl spec. See:
https://github.com/tc39/ecma402/commit/087995c
https://github.com/tc39/ecma402/commit/233d29c

This also adds a missing spec link for the sanctioned units and fixes a
broken spec link for IsSanctionedSingleUnitIdentifier. In LibUnicode,
the NumberFormat generator is updated to use the constexpr helper to
retrieve sanctioned units.
2022-03-30 14:24:32 +01:00
Tom Maisey d63cb35c0d Meta: Fix e2fsck variable on macOS in build-image-qemu.sh
Despite carefully adding homebrew's e2fsprogs to the PATH,
the script then defined E2FSCK as if we are always on Linux.
2022-03-30 01:57:51 -07:00
Idan Horowitz 824cf570d3 LibWeb: Stop casting unsigned long IDL return values to i32
These values may not fit into an i32.
2022-03-30 08:56:25 +03:00
Idan Horowitz 44601a8e74 LibWeb: Support IDL optional integer arguments 2022-03-30 08:56:25 +03:00
Kenneth Myhra de7d333d43 markdown-check: Port to LibMain 2022-03-29 21:28:29 -07:00
Jelle Raaijmakers c637795888 Ports: Update PHP to 8.1.4 2022-03-29 22:49:27 +01:00
Andreas Kling ab4c73746c LibWeb: Add @@toStringTag own property on wrappers
This makes wrappers stringify to the expected "[object InterfaceName]"
instead of just "[object Object]".
2022-03-29 17:03:15 +02:00
Karol Kosek dcb24e943d Tests: Add a basic UTF-8 to UTF-8 LibTextCodec test 2022-03-29 01:01:32 +02:00
Daniel Bertalan 3d0178a2f7 Meta: Do not try to unzip the already decompressed WASM test suite .tar
WASM_SPEC_TEST_TAR_PATH actually refers to a tarball that has already
been decompressed with gzip, so running `tar -xzf` on it fails.

I introduced this mistake in 66582a875f.

There is no need to keep an intermediary plain .tar file around, we can
pass the WASM_SPEC_TEST_GZ_PATH .tar.gz directly to `tar -xzf`.
2022-03-29 00:00:36 +02:00
Ali Mohammad Pur 67357fe984 LibXML: Add a fairly basic XML parser
Currently this can parse XML and resolve external resources/references,
and read a DTD (but not apply or verify its rules).
That's good enough for _most_ XHTML documents as the HTML 5 spec
enforces its own rules about document well-formedness, and does not make
use of XML DTDs (aside from a list of predefined entities).

An accompanying `xml` utility is provided that can read and dump XML
documents, and can also run the XML conformance test suite.
2022-03-28 23:11:48 +02:00
Hendiadyoin1 bd6927ecab Meta: Refactor the IPC-compiler and port it to LibMain
This does a few things in total:
* Ports the IPC-compiler to LibMain
* Extract some compiler steps into separate functions
* Minify some appends to use appendln (or appendff in the case of
  StringBuilder)

This reduces the clang-tidies maximum cognitive-complexity score for
this file from 325 to under 100.
2022-03-28 23:08:08 +02:00
Daniel Bertalan 66582a875f Meta: Specify -z when decompressing tar.gz archives
While GNU tar automatically detects the used compression algorithm,
POSIX requires that we specify -z if the tarball is compressed with
gzip.

Fixes a build error on OpenBSD.
2022-03-27 12:17:59 -07:00
Linus Groh 6ca03b915e Kernel: Support all Intel-defined CPUID feature flags for EAX=1
We're now able to detect all the regular CPUID feature flags from
ECX/EDX for EAX=1 :^)

None of the new ones are being used for anything yet, but they will show
up in /proc/cpuinfo and subsequently lscpu and SystemMonitor.

Note that I replaced the periods from the SSE 4.1 and 4.2 instructions
with underscores, which matches the internal enum names, Linux's
/proc/cpuinfo and the general pattern of replacing special characters
with underscores to limit feature names to [a-z0-9_].

The enum member stringification has been moved to a new function for
better re-usability and to avoid cluttering up Processor.cpp.
2022-03-27 18:54:56 +02:00
Linus Groh 4727b5bd4d Meta: Fix path to GCC's addr2line in serenity.sh
I'm not sure when this changed, but the path is wildly different now.
2022-03-27 18:54:56 +02:00
Sam Atkins d6901d2119 Meta: Add range checking to all numeric CSS types
We did already have range checking for the `<integer>` and `<number>`
types, but this patch adds this functionality to all numeric types
(dimensions and percentages).

The syntax in Properties.json is taken from the spec:
https://www.w3.org/TR/css-values-3/#numeric-ranges

eg, `length [0,∞]` defines that a Length is allowed as long as it has a
positive value.

The implementation here allows for any number to be the positive or
negative limit, even though only 0 and positive/negative infinity are
meaningful values without a unit.
2022-03-26 18:15:08 +01:00
Andreas Kling 261cd1d4c7 LibWeb: Mark CSS properties as not affecting stacking context by default
We were mistakenly treating all CSS properties as if changing them
requires a rebuild of the stacking context tree.
2022-03-25 11:57:30 +01:00
Tim Schumacher fad1114d4d Meta: Remove obsolete HeaderCheck .gitignore
This appears to be a remnant from the earlier HeaderCheck revisions,
where CMakeLists.txt was automatically generated.

Now that a (static) copy of CMakeLists.txt is checked in, this file
doesn't have any effect anymore.
2022-03-24 20:11:39 -07:00
Idan Horowitz 45c5fcf5cb Meta: Disable KASLR when debugging the kernel with GDB
This lets GDB resolve the kernel symbols correctly.
2022-03-24 23:36:56 +00:00
Idan Horowitz 5626e1b324 LibWeb: Rename PARSER_DEBUG => HTML_PARSER_DEBUG
Since this macro was created we gained a couple more parsers in the
system :^)
2022-03-24 21:37:49 +01:00
Lenny Maiorani e08cd4d608 CMake: Add serenity_lib_static 2022-03-24 03:04:57 +01:00
Timothy Flynn 324f709d29 LibWeb: Support IDL default values of "null" for optional arguments
This is a bit strange in the IDL syntax, but e.g., in HTMLSelectElement,
we have (simplified):

    undefined add(optional (HTMLElement or long)? before = null)

This could instead become:

    undefined add(optional (HTMLElement or long) before)

This change generates code for the former as if it were the latter.
2022-03-22 02:08:15 +01:00
Timothy Flynn 57296393ed LibWeb: Begin implementing SVGRectElement's SVGAnimatedLength attributes 2022-03-21 21:04:39 +01:00
Timothy Flynn 3ebc5cc58e LibWeb: Support generating IDL float types
The float type is used quite a bit in the SVG spec.
2022-03-21 21:04:39 +01:00
Andreas Kling 8c88ee1165 LibWeb: Only invalidate stacking context tree for opacity/z-index change
I came across some websites that change an elements CSS "opacity" in
their :hover selectors. That caused us to relayout on hover, which we'd
like to avoid.

With this patch, we now check if a property only affects the stacking
context tree, and if nothing layout-affecting has changed, we only
invalidate the stacking context tree, causing it to be rebuilt on next
paint or hit test.

This makes :hover { opacity: ... } rules much faster. :^)
2022-03-21 13:03:33 +01:00
Nico Weber 681fac07ed Meta: Always disable kvm on aarch64 hosts for now
run.sh builds i686 by default, and the aarch64 port of serenity
isn't very far along yet.

Without this change, `run.sh` without arguments unceremoniously
fails with:

    [0/1] cd .../serenity/Build/i686 && /usr...
          ENITY_ARCH=i686 /home/thakis/src/serenity/Meta/run.sh
    qemu-system-i386: invalid accelerator kvm

That's because /dev/kvm exists, but that's no good on a non-intel host.
2022-03-20 19:53:47 -07:00
Nico Weber 20c6dabaff Lagom: Build with -fsigned-char
When building on an arm host system, char defaults to unsigned,
leading to errors such as:

  serenity/AK/StringBuilder.cpp:198:20:
    error: comparison is always true due to limited range of data type
           [-Werror=type-limits]
    198 |             if (ch >= 0 && ch <= 0x1f)
        |

Building with -fsigned-char makes things work like on Intel, and
it's what we already do in Kernel/CMakeLists.txt for the same reasons.
2022-03-20 19:53:47 -07:00
Brian Gianforcaro 97f622747b Everywhere: Move commonmark.spec.json to /home/anon/Tests 2022-03-20 22:20:59 +01:00
Brian Gianforcaro 95b295971d Everywhere: Move tests to /home/anon/Tests 2022-03-20 22:20:59 +01:00
Brian Gianforcaro 16bee0ba79 Everywhere: Move js/web/wasm tests under /home/anon/Tests 2022-03-20 22:20:59 +01:00
Brian Gianforcaro 67fc81a65a Everywhere: Move cpp-tests under /home/anon/Tests 2022-03-20 22:20:59 +01:00
Ali Mohammad Pur 612d5f201a Meta: Skip wasm tests whose modules cannot be loaded
Also add support for a few more assertion types to go along with it.
2022-03-20 10:44:32 +03:30
Brian Gianforcaro 66e7ac1954 Meta: Error out on find_program errors with CMake less than 3.18
We have seen some cases where the build fails for folks, and they are
missing unzip/tar/gzip etc. We can catch some of these in CMake itself,
so lets make sure to handle that uniformly across the build system.

The REQUIRED flag to `find_program` was only added on in CMake 3.18 and
above, so we can't rely on that to actually halt the program execution.
2022-03-19 15:01:22 -07:00
Itamar b6f358689c CMake: Modify include path when building from Hack Studio
With regular builds, the generated IPC headers exist inside the Build
directory. The path Userland/Services under the build directory is
added to the include path.

For in-system builds the IPC headers are installed at /usr/include/.
To support this, we add /usr/include/Userland/Services to the build path
when building from Hack Studio.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2022-03-19 22:02:44 +01:00
Itamar fe7d28e870 CMake: Install generated IPC headers under /usr/include in compile_ipc()
Generated IPC headers are now installed under /usr/include in the
system's filesystem image.
2022-03-19 22:02:44 +01:00
stelar7 60c228b914 LibWeb: Handle nullish this_value when creating idl functions 2022-03-19 17:40:23 +00:00
Lenny Maiorani 4c5e9f5633 Everywhere: Deduplicate day/month name constants
Day and month name constants are defined in numerous places. This
pulls them together into a single place and eliminates the
duplication. It also ensures they are `constexpr`.
2022-03-18 23:48:50 +00:00
Timothy Flynn c0dd188c4d LibTimeZone: Update to TZDB version 2022a
https://mm.icann.org/pipermail/tz-announce/2022-March/000070.html
2022-03-17 16:38:33 +00:00
Andreas Kling 275db39c94 LibWeb: Annotate which CSS properties may affect layout
This patch adds CSS::property_affects_layout(PropertyID) which tells us
whether a CSS property would affect layout if it were changed.

This will be used to avoid unnecessary relayout work when something
changes that really only requires us to repaint the page.

To mark a property as not affecting layout, set "affects-layout" to
false in the corresponding Properties.json entry. Note that all
properties affect layout by default.
2022-03-16 18:06:45 +01:00
Ali Mohammad Pur ab55abb0f8 Meta: Enable all wasm extensions when building test suite
...and let LibWasm do the validation instead of removing the test when a
module is invalid.
Also, one of the tests has an integer literal starting with zero, so
account for this to make it not fail :^)
2022-03-16 15:44:52 +00:00
sin-ack 436262ea3a Meta: Use the ImplementedAs value in the attribute setter
Co-Authored-By: Luke Wilde <lukew@serenityos.org>
2022-03-16 00:38:31 +01:00
Linus Groh 4260638121 Meta: Add copy-src to commands in ZSH autocomplete script 2022-03-14 22:20:35 +00:00
Linus Groh 7560f61b71 Meta: Add aarch64 to targets in ZSH autocomplete script 2022-03-14 22:20:24 +00:00
Andreas Kling 74fda2a761 LibWeb: Make CSS::property_initial_value() use an Array internally
Since we want to store an initial value for every CSS::PropertyID,
it's pretty silly to use a HashMap when we can use an Array.

This takes the function from ~2.8% when mousing around on GitHub all the
way down to ~0.6%. :^)
2022-03-13 18:09:43 +01:00
Jakub V. Flasar 6d2c298b66 Kernel: Move aarch64 Prekernel into Kernel
As there is no need for a Prekernel on aarch64, the Prekernel code was
moved into Kernel itself. The functionality remains the same.

SERENITY_KERNEL_AND_INITRD in run.sh specifies a kernel and an inital
ramdisk to be used by the emulator. This is needed because aarch64
does not need a Prekernel and the other ones do.
2022-03-12 14:54:12 -08:00
Sam Atkins eb6e4e6775 Meta: Port Generate_CSS_PropertyID_cpp to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins a850465a4b Meta: Port Generate_CSS_PropertyID_h to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins e80038d938 Meta: Port Generate_CSS_ValueID_cpp to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins dd238df42d Meta: Port Generate_CSS_ValueID_h to LibMain/Core::Stream 2022-03-10 09:49:13 -05:00
Sam Atkins 7ce8a91341 Meta: Generate functions for validating media-query values
These work differently from how we validate StyleValues. There, we parse
a StyleValue from the CSS, and then see if it is allowed in the
property. That causes problems when the syntax is ambiguous - for
example, `0` can be a number or a Length.

Here instead, we ask what kinds of value are allowed for a
media-feature, and then only attempt to parse those kinds of value.
This makes the ambiguity problem go away. :^)

Each media-feature in the spec only accepts one type of value, and/or
some identifiers. This makes the switch statements for the type a bit
excessive, but the spec does not *require* that only one type is
allowed, so this is more future-proof.
2022-03-09 23:06:30 +01:00
Sam Atkins 0371d33132 LibWeb+Meta: Stop discrete media-features from parsing as ranges
Only "range" type media-features are allowed to appear in range syntax,
or have a `min-/max-` prefix.
2022-03-09 23:06:30 +01:00
Sam Atkins b7bb86462b Meta: Generate CSS::MediaFeatureID enum
This works largely the same as the PropertyID and ValueID generators,
but using LibMain, Core::Stream, and TRY().

Rather than have a MediaFeatureID::Invalid, I decided to return an
Optional. We'll see if that turns out better or not. :^)
2022-03-09 23:06:30 +01:00
Sam Atkins e986331a4f Meta: Move title/camel_casify() functions into their own file
These were duplicated among the CSS generators.
2022-03-09 23:06:30 +01:00
Andreas Kling fabcee016f LibWeb: Add basic support for DOM's NodeIterator and NodeFilter
This patch adds NodeIterator (created via Document.createNodeIterator())
which allows you to iterate through all the nodes in a subtree while
filtering with a provided NodeFilter callback along the way.

This first cut implements the full API, but does not yet handle nodes
being removed from the document while referenced by the iterator. That
will be done in a subsequent patch.
2022-03-09 16:43:00 +01:00
Sahan Fernando 04849c9561 Meta: Add SERENITY_GL environment variable to run.sh 2022-03-09 14:58:48 +03:30
Daniel Bertalan a25cc9619d Base+Meta: Make /usr/local read-write
This directory has to be writable if we want to install ports that have
been built inside Serenity. It's owned by root anyway, so having it be
read-only does not provide many security benefits.
2022-03-08 23:30:47 +01:00
davidot 6dd8ef485a Meta: Fix that the processor count was output to stderr and ignored
Because of ninja's default behavior of using all processors this gave
the correct behaviour because MAKEJOBS was empty. However this meant
that the processor count was printed to stderr when building.
2022-03-08 17:56:20 +01:00
davidot 3192cabc0e Meta: Read MAKEJOBS to limit jobs for ninja in serenity.sh
The default behavior of using all cores will still apply if no
MAKEJOBS variable is supplied.
2022-03-08 17:12:35 +01:00
Linus Groh 1422bd45eb LibWeb: Move Window from DOM directory & namespace to HTML
The Window object is part of the HTML spec. :^)
https://html.spec.whatwg.org/multipage/window-object.html
2022-03-08 00:30:30 +01:00
Matthew Olsson 73cf8205b4 LibPDF: Propagate errors in Parser and Document 2022-03-07 10:53:57 +01:00
Idan Horowitz 59e9e7cc61 LibWeb: Add a very basic and ad-hoc version of IDL overload resolution
This initial version lays down the basic foundation of IDL overload
resolution, but much of it will have to be replaced with the actual IDL
overload resolution algorithms once we start implementing more complex
IDL overloading scenarios.
2022-03-05 23:40:08 +01:00
Linus Groh 1719862d12 LibWeb: Hide some debug logging behind CANVAS_RENDERING_CONTEXT_2D_DEBUG
This can be quite noisy and isn't generally useful information.
2022-03-04 23:03:29 +01:00
Jelle Raaijmakers ae2591657d Meta: Add "SerenityOS" to the QEMU window title
Just a small quality of life improvement :^)
2022-03-03 11:47:18 +01:00
Liav A 629eed3a4c Meta: Add option to run SerenityOS on a QEMU MicroVM machine
The microvm machine type is a modern tool for kernel and firmware
developers to test their software against features like FDTs, second
IOAPIC, lack of legacy devices by default, the ability of using PCIe
without using PCI x86 IO ports, etc.

We can boot into such machine but we are limited in the functionality we
support currently for this type of virtual machine.
2022-03-02 18:41:54 +01:00
Liav A 2dbbec66e4 Meta: Add option to run SerenityOS on a QEMU ISA-PC machine
The ISA-PC machine type provides no PCI bus support, no IOAPIC support
and other modern PC features of our generation.

This is mainly a good environment for testing abstractions in the kernel
space, and can help with improving on them for the sake of porting the
OS to other chipsets and CPU architectures.
2022-03-02 18:41:54 +01:00
kleines Filmröllchen 084347becc Utilities+Meta: Check icons in markdown-check
We use the environment variable SERENITY_SOURCE_DIR to resolve and check
icon links. This is a bit inconvenient as SERENITY_SOURCE_DIR needs to
be set correctly before invoking the markdown checker, but as we use it
through the check-markdown script anyways, I think it's not a problem.
2022-02-26 20:05:06 +02:00
Luke Wilde 0568229d81 Lagom/Fuzzers: Add MP3 fuzzer 2022-02-26 19:31:16 +02:00
Itamar 3a71748e5d Userland: Rename IPC ClientConnection => ConnectionFromClient
This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'

find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
2022-02-25 22:35:12 +01:00
networkException 9279dd783b Everywhere: Use title case for man section titles
In addition to the section headings on man.serenityos.org,
all occurances of man section titles are now formatted in title case.
2022-02-25 12:06:31 -05:00
Linus Groh 967300e1e3 Meta: Title case 'File Formats' on man.serenityos.org 2022-02-24 23:04:22 +00:00
networkException 156e8a80c7 Meta: Use correct man page title for section 5 on man.serenityos.org 2022-02-24 22:49:03 +00:00
Sam Atkins 53a3937c34 LibWeb: Allow Angle/Frequency/Resolution/Time values for CSS properties 2022-02-24 08:04:25 +01:00
Ali Mohammad Pur bed129a69f LibTest+Spreadsheet: Add some basic spreadsheet runtime behaviour tests
As there's a somewhat active development going on, let's keep the
expected behaviour under tests to make sure nothing blows up :^)
2022-02-23 03:17:12 +03:30
Filiph Sandström b9dbe248aa Lagom: Port LibSyntax
LibSyntax was already building for lagom without any extra changes
so let's just enable it :^)
2022-02-21 16:42:23 +00:00
Sviatoslav Peleshko 9399698aaa Meta: Add "vdagent" character device for both qemu-vdagent and spicevmc
Previously we added it only if spice was available, but it's possible to
build qemu with --disable-spice --enable-spice-protocol, which provides
qemu-vdagent but no spicevmc. In such case we still configured
qemu-vdagent to use "vdagent" device, but never actually defined it, so
the qemu-vdagent was never working.
2022-02-20 20:32:22 -08:00
Andrew Kaster fb179bc289 Fuzzers: Avoid unnecessary ByteBuffer copies in FuzzWAVLoader
Avoid trying to memcpy from 0-byte sources as well, by bailing early on
nullptr data inputs.
2022-02-20 19:04:59 +00:00
Andrew Kaster 0c95d9962c Lagom: Add two-stage build for Fuzzers to enable fuzzing generated code
This allows us to fuzz the generated unicode and timezone database
helpers, and to fuzz things like LibJS using Fuzzilli to get proper
coverage of our unicode handling code.

Update the Azure CI to use the new two-stage build as well, and cleanup
some unused CMake options there.
2022-02-20 19:04:59 +00:00
Brian Gianforcaro f01e1d0c17 Ports/gdb: Add descriptions to all gdb patches and remove dead code
Before working on the gdb port some more, I wanted to get these patches
cleaned up to have a good base to build upon.
2022-02-20 11:49:41 +01:00
Luke Wilde 0e6c7eea0f LibWeb: Add AbortSignal as a wrappable type 2022-02-20 02:03:24 +01:00
Luke Wilde ced7e8ab28 LibWeb: Add support for dictionary types to union types
This also fixes some indentation issues in the generated code.
2022-02-20 02:03:24 +01:00
Luke Wilde d0ebe80f69 LibWeb: Add dictionary types to idl_type_name_to_cpp_type
This allows dictionaries to appear in sequences, records and unions.
2022-02-20 02:03:24 +01:00
Luke Wilde 567abd52a3 LibWeb: Add support for optional, non-nullable wrapper types 2022-02-20 02:03:24 +01:00
Luke Wilde 86650e37fe LibWeb: Don't perform ToObject when converting values to wrapper types
WebIDL checks the type of the value is Object instead of performing
ToObject on the value.

https://webidl.spec.whatwg.org/#implements
2022-02-20 02:03:24 +01:00
Gunnar Beutner 6b9913f010 Meta: Explicitly set number of available inodes for genext2fs
According to its manpage genext2fs tries to create the file system with
as few inodes as possible. This causes SerenityOS to fail at boot time
when creating temporary files.
2022-02-19 13:13:22 +02:00
Daniel Bertalan 0f2e18403c Meta: Make serenity.sh gdb work with the Clang toolchain
We now pass along the toolchain type to all subcommands. This ensures
that gdb will load the correct debug information for kernels compiled
with Clang, and the following warning won't appear with the GNU
toolchain:

> WARNING: unknown toolchain 'gdb'. Defaulting to GNU.
>         Valid values are 'Clang', 'GNU' (default)
2022-02-19 11:36:08 +01:00
Linus Groh fb1dca2c4b LibWeb: Move WebSocket into the Web::WebSockets namespace
WebSockets got moved from the HTML standard to their own, the new
WebSockets Standard (https://websockets.spec.whatwg.org).

Move the IDL file and implementation into a new WebSockets directory and
C++ namespace accordingly.
2022-02-18 19:34:08 +00:00
Ben Abraham ae346cff6b LibWeb: Add partially functioning Worker API
Add a partial implementation of HTML5 Worker API.
Messages can be sent from the inner context externally.
2022-02-17 22:45:21 +01:00
Ali Mohammad Pur 144ef3eb9f WrapperGenerator: Don't emit code for imported enumerations 2022-02-17 19:55:27 +01:00
Ali Mohammad Pur c38163494a WrapperGenerator: Add support for IDL mixin interfaces 2022-02-17 19:55:27 +01:00
Ali Mohammad Pur e9c76d339b Meta: Split and refactor the WrapperGenerator a bit
The single 4000-line WrapperGenerator.cpp file was proving to be a pain
to hack, and was filled with spaghetti, split it into a bunch of files
to lessen the impact of the spaghetti.
Also refactor the whole parser to use a class instead of a giant
function with a million lambdas.
2022-02-17 19:55:27 +01:00
Sam Atkins 8260135d4d LibCore+Everywhere: Return ErrorOr from ConfigFile factory methods
I've attempted to handle the errors gracefully where it was clear how to
do so, and simple, but a lot of this was just adding
`release_value_but_fixme_should_propagate_errors()` in places.
2022-02-16 19:49:41 -05:00
Andreas Kling e76e8e22b5 LibWeb: Separate "event listener" from "EventListener"
I can't imagine how this happened, but it seems we've managed to
conflate the "event listener" and "EventListener" concepts from the DOM
specification in some parts of the code.

We previously had two things:

    - DOM::EventListener
    - DOM::EventTarget::EventListenerRegistration

DOM::EventListener was roughly the "EventListener" IDL type,
and DOM::EventTarget::EventListenerRegistration was roughly the "event
listener" concept. However, they were used interchangeably (and
incorrectly!) in many places.

After this patch, we now have:

    - DOM::IDLEventListener
    - DOM::DOMEventListener

DOM::IDLEventListener is the "EventListener" IDL type,
and DOM::DOMEventListener is the "event listener" concept.

This patch also updates the addEventListener() and removeEventListener()
functions to follow the spec more closely, along with the "inner invoke"
function in our EventDispatcher.
2022-02-16 22:21:45 +01:00
Ali Mohammad Pur d8388f30c8 Meta: Make the WrapperGenerator generate includes based on imports
We no longer include all the things, so each generated IDL file only
depends on the things it actually needs now.
A possible downside is that all IDL files have to explicitly import
their dependencies.

Note that non-IDL dependencies still remain and are injected into all
generated files, this can be resolved later if desired by allowing IDL
files to import headers.
2022-02-16 22:48:32 +03:30
Ali Mohammad Pur 57997ed336 Meta: Support DOMExceptions when invoking IDL getters/setters 2022-02-16 22:48:32 +03:30
Ali Mohammad Pur ce6adf25e5 Meta: Add support for enumerations to the IDL compiler 2022-02-16 22:48:32 +03:30
Timothy Flynn 70ede2825e LibUnicode: Use BCP 47 data to filter valid calendar names 2022-02-16 07:23:07 -05:00
Timothy Flynn 71d86261c3 LibUnicode: Use BCP 47 data to filter valid numbering system names
There isn't too much of an effective difference here other than that the
BCP 47 data contains some aliases we would otherwise not handle.
2022-02-16 07:23:07 -05:00
Timothy Flynn 63c3437274 LibUnicode: Use BCP 47 data to generate available calendars and numbers
BCP 47 will be the single source of truth for known calendar and number
system keywords, and their aliases (e.g. "gregory" is an alias for
"gregorian"). Move the generation of available keywords to where we
parse the BCP 47 data, so that hard-coded aliases may be removed from
other generators.
2022-02-16 07:23:07 -05:00
Timothy Flynn 89ead8c00a LibJS+LibUnicode: Parse Unicode keywords from the BCP 47 CLDR package
We have a fair amount of hard-coded keywords / aliases that can now be
replaced with real data from BCP 47. As a result, the also changes the
awkward way we were previously generating keys. Before, we were more or
less generating keywords as a CSV list of keys, e.g. for the "nu" key,
we'd generate "latn,arab,grek" (ordered by locale preference). Then at
runtime, we'd split on the comma. We now just generate spans of keywords
directly.
2022-02-16 07:23:07 -05:00
Timothy Flynn d0fc61e79b LibUnicode: Extract the BCP 47 package from the CLDR
This package was originally meant to be included in CLDR version 40, but
was missed in their release scripts. This has been resolved:
https://unicode-org.atlassian.net/browse/CLDR-15158

Unfortunately, the CLDR was re-released with the same version number. So
to bust the build's CLDR cache, change the "version" used to detect that
we need to redownload the CLDR.
2022-02-16 07:23:07 -05:00
Idan Horowitz ab14abc40f Meta: Actually run gml-format in CI
Third time's a charm.
2022-02-15 19:33:46 +02:00
Idan Horowitz bc38155b9c Meta: Increase Azure CI timeout for Lagom builds 2022-02-15 18:02:54 +02:00
thankyouverycool 0505e031f1 Meta+LibUnicode: Download and parse Unicode block properties
This parses Blocks.txt for CharacterType properties and creates
a global display array for use in apps.
2022-02-15 10:13:19 -05:00
Linus Groh 24d5ca4a9d LibWeb: Remove non-standard ReturnNullIfCrossOrigin IDL attribute
This is no longer needed as BrowsingContextContainer::content_document()
now does the right thing, and HTMLIFrameElement.contentDocument is the
only user of this attribute. Let's not invent our own mechanisms for
things that are important to get right, like same origin comparisons.
2022-02-15 01:31:03 +01:00
Idan Horowitz 6be75bd5e4 Meta: Use clang-13 instead of clang-12 in Azure CI
This should hopefully resolve a clang ICE seen in PR #12523.
2022-02-14 23:55:23 +02:00
Anonymous 745b998774 LibJS: Get rid of unnecessary work from canonical_numeric_index_string
The spec version of canonical_numeric_index_string is absurdly complex,
and ends up converting from a string to a number, and then back again
which is both slow and also requires a few allocations and a string
compare.

Instead this patch moves away from using Values to represent canonical
a canonical index. In most cases all we need to know is whether a
PropertyKey is an integer between 0 and 2^^32-2, which we already
compute when we construct a PropertyKey so the existing is_number()
check is sufficient.

The more expensive case is handling strings containing numbers that
don't roundtrip through string conversion. In most cases these turn
into regular string properties, but for TypedArray access these
property names are not treated as normal named properties.
TypedArrays treat these numeric properties as magic indexes that are
ignored on read and are not stored (but are evaluated) on assignment.

For that reason there's now a mode flag on canonical_numeric_index_string
so that only TypedArrays take the cost of the ToString round trip test.
In order to improve the performance of this path this patch includes
some early returns to avoid conversion in cases where we can quickly
know whether a property can round trip.
2022-02-14 21:06:49 +00:00
Timothy Flynn b52e592eac LibUnicode: Port the CLDR time format generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn ca3bcf201f LibUnicode: Port the CLDR date format generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn f39540876b LibUnicode: Port the CLDR number format generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn a338e9403b LibUnicode: Port the CLDR locale generator to the stream API
This adds a generator utility to read an entire file and parse it as a
JSON value. This is heavily used by the CLDR generators. The idea here
is to put the file reading details in the utility so that when we have a
good story for generically reading an entire stream in LibCore, we can
update the generators to use that by only touching this helper.
2022-02-14 11:39:46 -05:00
Timothy Flynn a64a7940e4 LibUnicode: Port the UCD generator to the stream API 2022-02-14 11:39:46 -05:00
Timothy Flynn 9327c2233f LibTimeZone: Port the TZDB generator to the stream API
This also moves the open_file helper to the utility file. It's currently
a lambda redefined in each TZDB/Unicode generator. It used to display
the missing command line flag and other info local to each generator.
After switching to LibMain, it just returns a generic error message, and
is duplicated several times.
2022-02-14 11:39:46 -05:00
czapek1337 7b919c9d93 Meta: Bump Limine version to 2.78.2 2022-02-14 11:52:07 +01:00
czapek1337 77f25e44ed Meta: Include the EFI executable in Limine image 2022-02-14 11:52:07 +01:00
czapek1337 64ff8af074 Meta: Add support for the Limine bootloader 2022-02-14 11:52:07 +01:00
Luke Wilde b7c435de17 LibWeb: Add support for record<K, V> types as input 2022-02-14 11:32:17 +01:00
Andreas Kling 4b412e8fee Revert "LibJS: Get rid of unnecessary work from canonical_numeric_index_string"
This reverts commit 3a184f7841.

This broke a number of test262 tests under "TypedArrayConstructors".
The issue is that the CanonicalNumericIndexString AO should not fail
for inputs like "1.1", despite them not being integral indices.
2022-02-13 16:01:32 +01:00
Anonymous 3a184f7841 LibJS: Get rid of unnecessary work from canonical_numeric_index_string
The spec version of canonical_numeric_index_string is absurdly complex,
and ends up converting from a string to a number, and then back again
which is both slow and also requires a few allocations and a string
compare.

Instead lets use the logic we already have as that is much more
efficient.

This improves performance of all non-numeric property names.
2022-02-13 14:44:36 +01:00
Idan Horowitz 0a93bf5e7b Meta: Actually run gml-format in CI
Since gml-format is part of Lagom, it must be added to the post-lagom
linters section, or else it won't ever actually run.
2022-02-13 02:36:35 +02:00
DerpyCrabs 2f828231c4 LibWeb: Implement Geometry::DOMRectList
Implement DOMRectList that is used as a return type of
getClientRects functions on Element and Range.
2022-02-12 22:43:10 +01:00
Daniel Bertalan ba5bbde7ee Meta: Enable RELR relocations
Also add a check to serenity.sh to ensure that the toolchain is new
enough for this feature to work.
2022-02-11 18:07:53 +01:00
Daniel Bertalan 7ab6816b49 Ports: Update binutils to version 2.38 2022-02-11 18:07:53 +01:00
Ali Mohammad Pur cb7becb067 LibTLS+RequestServer: Add an option to dump TLS keys to a log file
This file allows us to decrypt TLS messages in wireshark, which can help
immensely in debugging network stuff :^)
2022-02-09 21:23:25 +01:00
Andrew Kaster 820e99f97d LibWeb: Add initial implementation for WorkerGlobalScope
This initial implementation stubs out the WorkerGlobalScope,
WorkerLocation and WorkerNavigator classes. It doesn't take into account
all the things that actually need passed into the constructors for these
objects, nor the extra abstract operations that need to be performed on
them by the rest of the Browser infrastructure. However, it does create
bindings that compile and link :^)
2022-02-09 17:21:05 +01:00
Linus Groh 6508ff5bbd LibWeb: Stop using MVL for sequence storage in WrapperGenerator
Use MarkedVector<Value> instead.
2022-02-09 12:25:27 +00:00
Linus Groh bc183dbbcb LibJS: Replace uses of MarkedValueList with MarkedVector<Value>
This is effectively a drop-in replacement.
2022-02-09 12:25:27 +00:00
Timothy Flynn 636a6a2fb8 Meta: Add a CPack installation target for js(1)
This adds a CPack configuration to generate a release package for js(1).
Our current CMake requirement is 3.16, which doesn't have a great story
for automatically installing a binary target's library dependencies. If
we eventually require CMake 3.21 or above, we can remove the helper
.cmake file added here in lieu of RUNTIME_DEPENDENCIES.
2022-02-09 12:19:56 +03:30
Luke Wilde 5aacec65ab LibWeb: Rewrite EventTarget to more closely match the spec
This isn't perfect (especially the global object situation in
activate_event_handler), but I believe it's in a much more complete
state now :^)

This fixes the issue of crashing in prepare_for_ordinary_call with the
`i < m_size` crash, as it now uses the IDL callback functions which
requires the Environment Settings Object. The environment settings
object for the callback is fetched at the time the callback is created,
for example, WrapperGenerator gets the incumbent settings object for
the callback at the time of wrapping. This allows us to remove passing
in ScriptExecutionContext into EventTarget's constructor.

With this, we can now drop ScriptExecutionContext.
2022-02-08 17:47:44 +00:00
davidot 1c4c251be3 LibJS+Everywhere: Remove all VM::clear_exception() calls
Since VM::exception() no longer exists this is now useless. All of these
calls to clear_exception were just to clear the VM state after some
(potentially) failed evaluation and did not use the exception itself.
2022-02-08 09:12:42 +00:00
kleines Filmröllchen 6ee597369d Meta+Userland: Run the GML formatter on CI and pre-commit
Now that the GML formatter is both perserving comments and also mostly
agrees to the existing GML style, it can be used to auto-format all the
GML files in the system. This commit does not only contain the scripts
for running the formatting on CI and the pre-commit hook, but also
initially formats all the existing GML files so that the hook is
successfull.
2022-02-07 18:39:50 +01:00
kleines Filmröllchen 4931c88b13 LibGUI: Remove GML prefix in favor of proper namespace
Prefixes are very much a C thing which we don't need in C++. This commit
moves all GML-related classes in LibGUI into the GUI::GML namespace, a
change somewhat overdue.
2022-02-07 18:39:50 +01:00
James Puleo 2f646f4284 Meta: Add instructions on using Lagom in an external project 2022-02-07 11:04:07 +00:00
serenityosrocks 7371d16b03 Meta: Fix "Meta/serenity.sh run x86_64 Clang" on M1 Macs
QEMU crashes on M1 Macs when using `--accel hvf` option.

To solve this, detect the host's architecture and only add the
`--accel hvf` parameter if we are running on a "x86_64" machine.
This will allow "arm64" machines like M1 Macs to work correctly.
2022-02-07 02:25:32 +00:00
Andreas Kling 627ad6c37c LibWeb: Add a proper FocusEvent interface for "focus" and "blur" events 2022-02-07 00:04:50 +01:00
Linus Groh 6f20f49b21 Everywhere: Rename JS::PropertyKey variables from property_{name => key}
PropertyKey used to be called PropertyName, but got renamed. Let's
update all the variables of this type as well.
2022-02-06 22:02:45 +00:00
Andrew Pietila 3758dffd16 Meta: Don't override SERENITY_QEMU_DISPLAY_DEVICE if it is already set 2022-02-06 18:29:25 +00:00
Andreas Kling 5dd4b3eaaa LibWeb: Put ResolvedCSSStyleDeclaration debug spam behind a macro
Blowing up the debug console with a fajillion FIXME's whenever you
navigate in the web inspector is no fun.
2022-02-06 16:22:58 +01:00
Morten Larsen 2c3b297895 Lagom: Exclude libraries with X86 code when building for macOS on Arm
The CMakeLists.txt for Lagom contains a few libraries and executables
with X86-specific code. By excluding those libraries, Lagom builds
for macOS on Arm as well. The places are marked FIXME to be removed
when the libraries will build for Arm.
2022-02-06 03:15:00 +00:00
Στέφανος 43d706a29e Meta: Fix problematic e2fsck behavior (Debian)
Under Debian `e2fsck` is found in `/sbin/` which does not match the
existing "version" the script currently uses (`/usr/sbin/e2fsck`
versus `/sbin/e2fsck`); therefore I added a simple `if` condition to
remedy the situation by verifying whether the original path exists or
not, so I can use the one Debian expects.

Special thanks goes to Tim Flynn a.k.a. `trflynn89` for his valuable
feedback.
2022-02-05 19:34:40 +00:00
Sam Atkins e111e8e44e LibWeb: Type-check calc() in in property_accepts_value()
This means only CalculatedStyleValues that would return the desired type
will be accepted.
2022-02-04 13:52:02 +01:00
Brian Gianforcaro ee61739e0a Meta: Add install-native-partition CMake target installing to a real FS
While playing around with getting serenity to run on my main desktop
machine I wanted a way of easily updating my physical serenity
partition.

To use it you just need to:
- Create and format your local partition to ext4
- Set `SERENITY_TARGET_INSTALL_PARTITION` to the partition /dev path.
- Run the `install-native-partition` build target.

Example:

    $ export SERENITY_TARGET_INSTALL_PARTITION=/dev/nvme1n1p3
    $ cd serenity/Build/x86_64
    $ ninja install-native-partition
2022-02-04 12:44:50 +01:00
Andreas Kling dc3bf32307 LibWeb: Add barebones CanvasGradient object
Also add the CanvasRenderingContext2D APIs to go along with it.
Note that it can't be used for anything yet.
2022-02-03 22:35:13 +01:00
Timothy Flynn ea814a3ce6 LibTimeZone: Parse and generate time zone coordinate data 2022-02-03 16:11:15 +01:00
Lucas CHOLLET daec521010 Build: Remove hardcoded executable path
Let which find the fuse2fs executable path for us, as it is not in
`/usr/sbin` in every distro.
2022-02-01 10:20:54 +01:00
Idan Horowitz 2d50c08f34 LibUnicode: Download and parse {Grapheme,Word,Sentence} break props 2022-01-31 21:05:04 +02:00
Timothy Flynn 6efbafa6e0 Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Luke Wilde 68813fbe70 LibWeb: Add initial support for passing union types into IDL functions
This currently does not accept ArrayBuffer, DataView, TypedArrays,
callback functions, nullable types, dictionaries, records and frozen
arrays.
2022-01-31 15:25:36 +01:00
Luke Wilde fb7ca09f04 LibWeb: Add support for passing sequences into IDL functions 2022-01-31 15:25:36 +01:00
Timothy Flynn 2e1db1b090 LibTimeZone: Use new generator util to generate all time zones
Added the call to generate_available_values(), then realized it is the
exact same as the existing, manually written implementation. So let's
use the new utility.
2022-01-31 00:32:41 +00:00
Timothy Flynn bb0f548614 LibUnicode: Generate a list of available currencies 2022-01-31 00:32:41 +00:00
Timothy Flynn 481ced53d8 LibUnicode: Generate a list of available numbering systems 2022-01-31 00:32:41 +00:00
Timothy Flynn ebd33e580b LibUnicode: Generate a list of available calendars 2022-01-31 00:32:41 +00:00
Timothy Flynn 4d43aeae30 LibUnicode: Fill in case-first and numeric BCP47 keywords
Unlike other BCP47 keywords that we are parsing, these only appear in
the BCP47 XML file itself within the CLDR. The values are very simple
though, so just hard code them until the Unicode org re-releases the
CLDR with BCP47: https://unicode-org.atlassian.net/browse/CLDR-15158
2022-01-29 20:27:24 +00:00
Idan Horowitz e28af4a2fc Kernel: Stop using HashMap in Mutex
This commit removes the usage of HashMap in Mutex, thereby making Mutex
be allocation-free.

In order to achieve this several simplifications were made to Mutex,
removing unused code-paths and extra VERIFYs:
 * We no longer support 'upgrading' a shared lock holder to an
   exclusive holder when it is the only shared holder and it did not
   unlock the lock before relocking it as exclusive. NOTE: Unlike the
   rest of these changes, this scenario is not VERIFY-able in an
   allocation-free way, as a result the new LOCK_SHARED_UPGRADE_DEBUG
   debug flag was added, this flag lets Mutex allocate in order to
   detect such cases when debugging a deadlock.
 * We no longer support checking if a Mutex is locked by the current
   thread when the Mutex was not locked exclusively, the shared version
   of this check was not used anywhere.
 * We no longer support force unlocking/relocking a Mutex if the Mutex
   was not locked exclusively, the shared version of these functions
   was not used anywhere.
2022-01-29 16:45:39 +01:00
Itamar 1aa8f73ddb IPCCompiler: Don't loop endlessly on nameless parameters
Previously, given a malformed IPC call declaration, where a parameter
does not have a name, the IPCCompiler would spin endlessly while
consuming more and more memory.

This is because it parses the parameter type incorrectly
(it consumes superfluous characters into the parameter type).

An example for such malformed declaration is:
tokens_info_result(Vector<GUI::AutocompleteProvider::TokenInfo>) =|

As a temporary fix, this adds VERIFY calls that would fail if we're at
EOF when parsing parameter names.

A real solution would be to parse C++ parameter types correctly.
LibCpp's Parser could be used for this task.
2022-01-29 12:44:15 +01:00
Idan Horowitz fcdd56633b Meta: Set correct boot drive when running with SERENITY_NVME_ENABLE 2022-01-28 19:05:52 +02:00
Mika Sundland 06d905622a Meta: Check if gdu is part of GNU coreutils 2022-01-28 07:19:52 +00:00
Timothy Flynn 789f093b2e LibUnicode: Parse and generate relative-time format patterns
Relative-time format patterns are of one of two forms:

    * Tensed - refer to the past or the future, e.g. "N years ago" or
      "in N years".
    * Numbered - refer to a specific numeric value, e.g. "in 1 year"
      becomes "next year" and "in 0 years" becomes "this year".

In ECMA-402, tensed and numbered refer to the numeric formatting options
of "always" and "auto", respectively.
2022-01-27 21:16:44 +00:00
Timothy Flynn 27eda77c97 LibUnicode: Create a nearly empty generator for relative-time formatting
This sets up the generator plumbing to create the relative-time data
files. This data could probably be included in the date-time generator,
but that generator is large enough that I'd rather put this tangentially
related data in its own file.
2022-01-27 21:16:44 +00:00
Timothy Flynn 589e7354fb LibUnicode: Remove extraneous semi-colons at end of generator functions 2022-01-27 21:16:44 +00:00
Timothy Flynn 2d2f713426 LibUnicode: Generate per-locale minimum grouping digit values
Previously, we were breaking up digits into groups without regard for
the locale's minimumGroupingDigits value in the CLDR. This value is 1 in
most locales, but is 2 in locales such as pl-PL. What this means is that
in those locales, the group separator should only be inserted if the
thousands group has at least 2 digits. So 1000 is formatted as "1,000"
in en-US, but "1000" in pl-PL. And 10000 is "10,000" in en-US and
"10 000" in pl-PL.
2022-01-27 20:30:52 +00:00
Timothy Flynn f657362fda LibEDID: Do not check if ${PNP_IDS_EXPORT_PATH} exists in pnp_ids.cmake
This check isn't needed because download_file() will check if it exists
already before doing the download. Worse, it would prevent the generator
target from being defined if the file existed, which then made CMake not
realize the generated files were important and delete them.
2022-01-26 16:37:38 +01:00
Timothy Flynn e092f1614c LibEDID: Rename the downloaded PNP IDs file
After fixing the CMake file to use the correct paths, users may have had
to manually remove the existing downloaded pnp.ids.html for CMake to re-
run the generator. So this change renames the downloaded file to
pnp_ids.html to ensure everyone picks up that change without manual
intervention.
2022-01-26 16:37:38 +01:00
Timothy Flynn 99c8dadcec LibEDID: Use correct paths for LibEDID generated files
Code generators that generate their files for both Lagom and Serenity
have a blob in their CMake file like this:

    set(TIME_ZONE_DATA_HEADER LibTimeZone/TimeZoneData.h)
    set(TIME_ZONE_DATA_IMPLEMENTATION LibTimeZone/TimeZoneData.cpp)
    set(TIME_ZONE_META_TARGET_PREFIX LibTimeZone_)

    if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibTimeZone")
        # Serenity build.
        set(TIME_ZONE_DATA_HEADER TimeZoneData.h)
        set(TIME_ZONE_DATA_IMPLEMENTATION TimeZoneData.cpp)
        set(TIME_ZONE_META_TARGET_PREFIX "")
    endif()

LibEDID generates files only for Serenity, but was using the Lagom build
version of the _HEADER, _IMPLEMENTATION, and _PREFIX variables. Thus if
pnp_ids.cmake was ever touched, the following error would be raised:

    Userland/Libraries/LibEDID/EDID.cpp:18:18: fatal error:
    LibEDID/PnpIDs.h: No such file or directory
        18 | #        include <LibEDID/LibEDID/PnpIDs.h>

Use the Serenity paths in pnp_ids.cmake and in the #include within
LibEDID itself.
2022-01-26 16:37:38 +01:00
Timothy Flynn e2bcf5fafd Meta: Download PNP ID data with fallible download function 2022-01-26 00:22:53 +00:00
Timothy Flynn 931302c500 Meta: Download TZDB data with fallible download function 2022-01-26 00:22:53 +00:00
Timothy Flynn c7ef86f5d9 Meta: Download UCD and CLDR data with fallible download function 2022-01-26 00:22:53 +00:00
Timothy Flynn e805fce46e Meta: Add a CMake function to download remote files during the build
This function will handle download failures. It doesn't support hashing
for integrity yet, but if the download times out or otherwise fails, the
build itself will fail. But default, file(DOWNLOAD) in CMake doesn't
fail the build; we must pass in and check a STATUS variable.
2022-01-26 00:22:53 +00:00
davidot b40308d0a4 Tests+LibJS: Add very simple bytecode LibJS tests
These tests are not meant as a replacement to test-js with the -b option
but are meant to test simple cases until that works.
Before this it was very easy to accidentally break bytecode since no
tests were run in bytecode mode. This hopefully makes it easier to spot
such regressions :^).
2022-01-25 23:26:14 +00:00
Ali Mohammad Pur 98183ef572 Meta: Correct the PNP ID download condition
`PNP_IDS_PATH` does not exist, set this to `PNP_IDS_EXPORT_PATH` to
avoid redownloading the database every reconfigure.
2022-01-26 00:53:09 +03:30
Timothy Flynn bced4e9324 LibJS+LibUnicode: Convert Intl.ListFormat to use Unicode::Style
Remove ListFormat's own definition of the Style enum, which was further
duplicated by a generated ListPatternStyle enum with the same values.
2022-01-25 19:02:59 +00:00
Timothy Flynn 1f051a8e25 LibTimeZone: Handle time zones which begin the year in daylight savings 2022-01-25 18:39:36 +00:00
Timothy Flynn 7103012c7d LibTimeZone: Add an API to retrieve both daylight and standard offsets
This API will also include the formatted name of the time zone, with
respect for DST (e.g. EST vs EDT for America/New_York).
2022-01-25 18:39:36 +00:00