Commit Graph

1855 Commits

Author SHA1 Message Date
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
Zaggy1024
353e1c2b4d LibVideo: Add PlaybackManager to load and decode videos
This file will be the basis for abstracting away the out-of-thread or
later out-of-process decoding from applications displaying videos. For
now, the demuxer is hardcoded to be MatroskaParser, since that is all
we support so far. The demuxer should later be selected based on the
file header.

The playback and decoding are currently all done on one thread using
timers. The design of the code is such that adding threading should
be trivial, at least based on an earlier version of the code. For now,
though, it's better that this runs in one thread, as the multithreaded
approach causes the Video Player to lock up permanently after a few
frames are decoded.
2022-10-31 14:47:13 +01:00
Zaggy1024
074f771b59 LibVideo: Add VideoFrame class for decoded video frames
The class is virtual and has one subclass, SubsampledYUVFrame, which
is used by the VP9 decoder to return a single frame. The
output_to_bitmap(Bitmap&) function can be used to set pixels on an
existing bitmap of the correct size to the RGB values that
should be displayed. The to_bitmap() function will allocate a new bitmap
and fill it using output_to_bitmap.

This new class also implements bilinear scaling of the subsampled U and
V planes so that subsampled videos' colors will appear smoother.
2022-10-31 14:47:13 +01:00
Linus Groh
4db85493e8 AK+Meta: Add WEB_FETCH_DEBUG macro 2022-10-30 20:10:29 +00:00
Jan200101
4b305e8fe4 Meta: Convert build directory path to be completely absolute 2022-10-27 20:43:55 +01:00
Timothy Flynn
bd592480e4 Meta: Replace Bash script for generating emoji.txt with C++ generator
We currently have two build-time parsers for the UCD's emoji-test.txt
file. To prepare for future changes, this removes the Bash parser and
moves its functionality to the newer C++ parser.
2022-10-27 12:59:56 +02:00
Timothy Flynn
b5a876e606 Meta: Allow specifying additional dependencies with invoke_generator 2022-10-27 12:59:56 +02:00
Timothy Flynn
006118599c Meta: Disallow emoji images with invalid code points in their file name 2022-10-26 18:40:20 +01:00
Linus Groh
bc2ebcadc0 Everywhere: Require version >= 12 for GCC host compiler
So far we've gotten away with using GCC 11 for Lagom and to compile the
toolchain, but via #15795 we discovered a compiler bug that has been
fixed in the latest version but would error the build with CI's GCC 11.
Time for an upgrade :^)

We already use ubuntu-22.04 images in most places, so this is pretty
straightforward. The only exception is Idan's self-hosted runner, which
uses Ubuntu Focal. LibJS should build fine with GCC 11, still.
2022-10-25 23:15:51 +01:00
Timothy Flynn
b077fccd3d LibLocale+LibJS: Update to CLDR version 42.0.0
There were some notable changes to the CLDR JSON format and data in this
release.

The patterns for a date at a specific time, i.e. "{date} at {time}", now
appear under the "atTime" attribute of the "dateTimeFormats" object.

Locale specific changes that affected test-js:

All locales:

* In many patterns, the code points U+00A0 (NO-BREAK SPACE) and U+202F
  (NARROW NO-BREAK SPACE) are now used in place of an ASCII space. For
  example, before the "dayPeriod" fields AM and PM.

* Separators such as U+2013 (EN DASH) are now surrounded by U+2009 (THIN
  SPACE) in place of an ASCII space character.

Locale "en":

* Narrow localizations of time formats are even more narrow. For
  example, the abbreviation "wk." for "week" is now just "wk".

Locale "ar":

* The code point U+060C (ARABIC COMMA) is now used in place of an ASCII
  comma.

* The code point U+200F (RIGHT-TO-LEFT MARK) now appears at the
  beginning of many localizations.

* When the "latn" numbering system is used for currency formatting, the
  currency symbol more consistently is placed at the end of the pattern.

Locale "he":

* The "many" plural rules category has been removed.

Locales "zh" and "es-419":

* Several display-name localizations were changed.
2022-10-25 10:10:39 +01:00
demostanis
3e8b5ac920 AK+Everywhere: Turn bool keep_empty to an enum in split* functions 2022-10-24 23:29:18 +01:00
Tim Schumacher
4ee0737d10 Meta: Default to the SDL QEMU frontend on SerenityOS
We don't yet have anything else than SDL, and certainly not GTK.
2022-10-24 15:52:42 +02:00
Tim Schumacher
40165a1c40 Meta: Also set CC/CXX when selecting the host toolchain
This ensures that the toolchain building scripts will use the host
toolchain that has been found manually, and that they won't fall back to
`cc` (which in the worst case may not even be installed).
2022-10-24 15:52:42 +02:00
Tim Schumacher
7ecc50db57 Lagom: Link the system's LibSystem on SerenityOS 2022-10-24 15:52:42 +02:00
Daniel Bertalan
f1f6c4c0b6 Meta: Detect Homebrew clang-format
Homebrew does not add upstream LLVM's install location to $PATH so as
not to conflict with XCode tools, so we need to run `brew --prefix llvm`
to figure out its install path.
2022-10-22 12:53:03 +02:00
Linus Groh
3b2e5b08d9 LibWeb: Remove dbgln FIXME spam from BindingsGenerator 2022-10-20 22:34:55 +02:00
Kenneth Myhra
ebd93c8d57 LibWeb: Revert support for DOM::Document in XHR::send()
This is a manual revert of commit: 7831e62

Let's revert this until we got nested union support in our IDL
generator/parser.
2022-10-20 17:57:52 +02:00
Andreas Kling
940b455ed0 LibWeb: Teach IDL generator to go from WindowProxy to EventTarget
This case requires some special handling, since there's no direct C++
inheritance relationship between HTML::WindowProxy and DOM::EventTarget.
2022-10-20 15:52:20 +02:00
Andreas Kling
68452c749a LibWeb: Prevent GC from running during intrinsics allocation
Due to the way we lazily construct prototypes and constructors for web
platform interfaces, it's possible for nested GC allocation to occur
while GC objects have been allocated but not fully constructed.

If the garbage collector ends up running in this state, it may attempt
to call JS::Cell::visit_edges() on an object whose vtable pointer hasn't
been set up yet.

This patch works around the issue by deferring GC while intrinsics are
being brought up. Furthermore, we also create a dummy global object for
the internal realm, and populate it with intrinsics. This works around
the same issue happening when allocating something (like the default UA
stylesheets) in the internal realm.

These solutions are pretty hacky and sad, so I've left FIXMEs about
finding a nicer way.
2022-10-20 15:16:23 +02:00
Timothy Flynn
27737f613c LibTimeZone+LibJS: Update to TZDB version 2022e
https://mm.icann.org/pipermail/tz-announce/2022-October/000074.html

This version changes America/Chicago's transtion from LMT to CST from
1883 Nov 18 12:09:24 to 1883 Nov 18 18:00.
2022-10-18 16:01:44 +02:00
Andrew Kaster
5e2fe7e2bf Lagom: Enable compile_commands.json for the lagom build directory
This allows a developer who only wants to look at Lagom to have their
IDE find source files and headers properly.
2022-10-17 15:55:55 +02:00
Andrew Kaster
b8e51425e9 Lagom+CMake: Propagate dependencies for generated custom targets
We have logic for serenity_generated_sources which works well for source
files that are specified in GENERATED_SOURCES prior to calling
serenity_lib or serenity_bin. However, code generated with
invoke_generator, and the LibWeb generators do not always follow the
pattern of the IDL and GML files.

For the LibWeb generators, we can just add_dependencies to LibWeb at the
time we declare the generate_Foo custom target. However for LibLocale,
LibTimeZone, and LibUnicode, we don't have the name of the target
available, so export the name in a variable to set into
GENERATED_SOURCES.

To make this work for Lagom, we need to make sure that lagom_lib and
serenity_bin in Lagom/CMakeLists.txt call serenity_generated_sources on
the target.

This enables the Xcode generator on macOS hosts, at least for Lagom.
2022-10-17 15:55:55 +02:00
Andrew Kaster
8160b53228 Lagom: Make lagom_lib take names prefixed with Lib
This matches serenity_lib, and consolidates the logic to strip Lib from
the front of the library name for the Lagom export name into one place
at the top of lagom_lib.
2022-10-17 15:55:55 +02:00
Tim Schumacher
2a4f81fc83 Meta: Start moving common shell definitions into a common file 2022-10-16 23:39:45 +02:00
Tim Schumacher
9d6c4c5137 Meta: Allow shellcheck to search sourced files in the script directory 2022-10-16 23:39:45 +02:00
Tim Schumacher
032ef1b461 Meta: Define SUDO for all the image building scripts
Back when adding support for `pls` as a `sudo` replacement,
`build-image-qemu` dynamically set the `SUDO` variable depending on what
system it was running on and used the contents of that variable to call
the correct elevation utility.

During recent changes to the elevation error message, that usage of the
variable was replicated across all of our scripts, but without also
replicating the logic to set that variable in the first place.

Add back the variable setting logic to all the other scripts to keep
them from running into unset variables.
2022-10-16 23:39:45 +02:00
Timothy Flynn
9fad23018a Meta: Remove unused "prefix" variable from invoke_generator() helper
This became unused after 1ae0cfd.
2022-10-16 21:16:48 +02:00
demostanis
1c979889b2 Meta: Print error if cmake does not exist 2022-10-16 17:49:18 +02:00
Idan Horowitz
9f3de0be6a Fuzzers: Add fuzzer for the Tar parser 2022-10-16 18:34:48 +03:00
Andrew Kaster
aacc49bab5 Lagom: Remove unecessary _lagom suffix from test and executable names
We needed this back when we included Lagom into the main serenity build,
but it has been unecessary since the superbuild.
2022-10-16 16:36:39 +02:00
Andrew Kaster
1ae0cfd08b CMake+Userland: Use CMakeLists from Userland to build Lagom Libraries
Also do this for Shell.

This greatly simplifies the CMakeLists in Lagom, replacing many glob
patterns with a big list of libraries. There are still a few special
libraries that need some help to conform to the pattern, like LibELF and
LibWebView.

It also lets us remove essentially all of the Serenity or Lagom binary
directory detection logic from code generators, as now both projects
directories enter the generator logic from the same place.
2022-10-16 16:36:39 +02:00
Andrew Kaster
a01c0e81f3 Meta: Use add_serenity_directory for LibTimeZone
This lets us eliminate the "meta prefix" for the LibTimeZone generators.
2022-10-16 16:36:39 +02:00
Andrew Kaster
f7f92f104f Lagom+LibCore: Build LibCore, AK, and LibMain with add_subdirectory
By deferring to the CMakeLists in each of these libraries' directories,
we can get rid of a lot of curious GLOB patterns and list removals in
the Lagom CMakeLists.
2022-10-16 16:36:39 +02:00
Kenneth Myhra
7831e62955 LibWeb: Add support for DOM::Document to XHR::send()
This patch adds support for posting a DOM::Document using XHR::send().
2022-10-16 02:06:29 +03:30
Gunnar Beutner
f70ec7582f Meta: Properly ignore targets which don't have a component name
Previously we'd add [component_name-NOTFOUND] sections to the
components.ini file for targets which weren't part of a component.
2022-10-15 13:12:42 +02:00
Undefine
135ca3fa1b Kernel: Add support for the FAT32 filesystem
This commit adds read-only support for the FAT32 filesystem. It also
includes support for long file names.
2022-10-14 18:36:40 -06:00
demostanis
48aea321c5 Meta: Don't tell to run script as root when that's not the actual error
Before, and that was the cause of many confusion in #build-problems
on Discord, the Meta/build-image-*.sh scripts would error out with
the message "this script needs to run as root" while the actual error
was unrelated.
2022-10-15 01:40:01 +02:00
Lucas CHOLLET
c837a1a8de LibAudio: Factorize stream initialisation to base class LoaderPlugin
All actual plugins follow the same logic to initialize their stream,
this commit factorizes all of this to their base class: `LoaderPlugin`.
2022-10-14 23:11:23 +02:00
kleines Filmröllchen
c439a34ff7 Meta: Get rid of /res/version.ini
There are no more users of this legacy version API. :yakgone:
2022-10-14 13:45:33 +02:00
ne0ndrag0n
b4456ecdbb Escalator: Add new method to privilege escalate within GUI 2022-10-14 11:23:06 +02:00
Andrew Kaster
b704f82487 Fuzzers: Add VP9Decoder and MatroskaReader fuzzers for LibVideo 2022-10-13 11:25:03 +02:00
Sam Atkins
80603f141a WebDriver: Add new WebDriver service
WebDriver aims to implement the WebDriver specification found at
https://w3c.github.io/webdriver/webdriver-spec.html . It's an HTTP
server that can create Browser sessions and control them.

Co-authored-by: Florent Castelli <florent.castelli@gmail.com>
2022-10-12 23:07:42 +02:00
Andrew Kaster
539fb08551 Userland: Remove unecessary uses of __serenity__ macro 2022-10-10 12:23:12 +02:00
Andrew Kaster
896d4e8dc1 LibRegex: Don't build LibRegex/C/Regex.cpp on Lagom
This file implements the POSIX APIs from <regex.h>, and is not suitable
for inclusion in a Lagom build. If we do include it, it will override
the host's regex functions and wreak havoc if it's resolved before the
host's implementation.
2022-10-10 12:23:12 +02:00
Zaggy1024
bbc053fa56 LibVideo: Add LibVideo test to Lagom 2022-10-09 20:32:40 -06:00
Andrew Kaster
2d5bee256e LibWeb: Re-implement HTML::Navigator using IDL
Get rid of the bespoke NavigatorObject class and use the modern IDL
strategies for creating platform objects to re-implement Navigator and
its associcated mixin interfaces. While we're here, implement it in a
way that brings WorkerNavigator up to spec :^)
2022-10-09 10:14:57 +02:00
Andrew Kaster
2acff8d853 LibWeb: Add new code generator for creating exposed interface helpers
This new code generator takes all the .idl files in LibWeb, looks for
each top level interface in there with an [Exposed=Foo] attribute, and
adds code to add the constructor and prototype for each of those exposed
interfaces to the realm of the relevant global object we're initialzing.

It will soon replace WindowObjectHelper as the way that web interfaces
are added to the Window object, and will be used in the future for
creating proper WorkerGlobalScope objects for dedicated and shared
workers.
2022-10-09 10:14:57 +02:00
Andrew Kaster
067a53b7e7 LibIDL: Remove static maps for interfaces and resolved imports
Instead, create a tree of Parsers all pointing to a top-level Parser.

All module imports and interfaces are stored at the top level, instead
of in a static map. This allows creating multiple IDL::Parsers in the
same process without them stepping on each others toes.
2022-10-09 10:14:57 +02:00
Timothy Flynn
f08a979b96 LibUnicode: Remove GCC codegen workaround
Reverts commits:
ffbf5596cd
f190e394b3
2022-10-07 18:21:40 +01:00
Timothy Flynn
f38c68177b LibUnicode: Update code point ideographic replacements for Unicode 15 2022-10-07 18:17:40 +01:00
Sam Atkins
0823a3c422 BindingsGenerator+LibWeb: Pass a VM to static IDL-based functions
This saves us from having to yoink the VM out of thin air.
2022-10-06 21:45:07 +01:00
Sam Atkins
a6f0508f9f BindingsGenerator+LibIDL: Parse "inherit" attributes
An "inherit attribute" calls an ancestor's getter with the same name,
but defines its own setter. Since a parent class's public methods are
exposed to child classes, we don't have to do any special handling here
to call the parent's methods, it just works. :^)
2022-10-06 21:45:07 +01:00
Andreas Kling
f190e394b3 LibUnicode: Let's use the GCC 11/12 workaround on all platforms
I seem to be getting some miscompiles on Linux as well, so let's make
the hitherto macOS-specific workaround universal.
2022-10-06 17:15:28 +02:00
Andreas Kling
a4ccdce011 LibWeb: Generate WebContent IPC endpoints for Lagom's LibWebView
This is pretty hackish but should get us back to building.
2022-10-06 16:35:53 +02:00
matcool
70d0c1616f LibUnicode: Add decomposition mappings and Unicode normalization
The mappings are exposed via `Unicode::code_point_decomposition(u32)`
and `Unicode::code_point_decompositions()`, the latter being useful for
reverse searching a code point from its decomposition.

The normalization code does not make use of `Quick_Check` props (https://www.unicode.org/reports/tr44/#Decompositions_and_Normalization),
meaning no quick check optimizations.
2022-10-06 08:24:39 -04:00
Timothy Flynn
e8410bc2ee Meta: Hide WebView behind ENABLE_LAGOM_LIBWEB CMake option
If ENABLE_LAGOM_LIBWEB is OFF, this will fail to build.
2022-10-06 14:12:54 +02:00
Andreas Kling
2ac385f4db CMake: Don't mess with absolute compile_ipc() source paths
If given an absolute path, compile_ipc() should just use it verbatim
instead of trying to be helpful.
2022-10-06 11:23:53 +02:00
Andreas Kling
4d762fd3a6 Lagom: Add Build WebContentClient as part of Lagom's LibWebView
This will allow us to use it in Ladybird. :^)
2022-10-06 09:51:04 +02:00
Nico Weber
2af028132a AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places
Doesn't use them in libc headers so that those don't have to pull in
AK/Platform.h.

AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is
defined in clang builds as well.) Using AK_COMPILER_GCC simplifies
things some.

AK_COMPILER_CLANG isn't as much of a win, other than that it's
consistent with AK_COMPILER_GCC.
2022-10-04 23:35:07 +01:00
Andrew Kaster
636602a54e LibWeb: Implement <input type=file> behavior
This includes punting on the actual file picker implementation all the
way out to the PageClient. It's likely that some of the real details
should be implemented somewhere closer, like the BrowsingContext or the
Page, but we'll get there.

For now, this allows https://copy.sh/v86 to load the emulation of the
preselected images all the way until it hits a call to
URL.createObjectURL.
2022-10-04 22:05:14 +02:00
Andreas Kling
3ca44e2258 BindingsGenerator: Allow the word "inline" in IDL identifiers
This has to be treated carefully since it's a C++ keyword.
2022-10-04 21:30:58 +02:00
vl-ms
d8b6f38748 Lagom: Change dl to ${CMAKE_DL_LIBS} for portability 2022-10-03 20:36:04 +01:00
Nico Weber
ffbf5596cd Lagom: Work around gcc codegen bug
Without this, GenerateUnicodeData crashes when run during the build.
With this, `serenity.sh run` brings up a running SerenityOS.
Since GenerateUnicodeData doesn't take a lot of time to run, just
disable optimizations to work around the problem for now.

Works around #15449.
2022-10-03 15:30:51 +01:00
Liav A
74018be739 Meta: Make x86-64 target the default
This is a preparation to check if our users find noticeable bugs in the
x86-64 target, before we can decide if we want to remove the i686 target
for good.
2022-10-03 11:14:53 +02:00
Andrew Kaster
376425639d Meta: Force -machine pc-i440fx-7.0 when using QEMU >= 7.1
Until the root cause behind #14952 is found, this workaround should stem
the tide of users in discord asking why their system crashes on startup.
2022-10-03 09:57:45 +01:00
Andrew Kaster
56b381aac0 LibWeb: Cleanup unecessary uses and includes of HTML::Window
The big global refactor left some stragglers behind for atomicity.

Clean up the rest, and remove a ton of includes of LibWeb/HTML/Window.h
2022-10-01 21:05:32 +01:00
Andrew Kaster
cc164dc1e2 Fuzzers: Convert FuzzCSSParser to use the MainThreadVM
Instead of trying to create a Window and a Document, and use those to
create a ParsingContext, just use the JS::Realm only constructor to make
sure that bindings are stashed on the main thread VM's realm.
2022-10-01 21:05:32 +01:00
Andrew Kaster
8407bf60c5 LibWeb: Introduce new construct_impl method for bound classes
In this generator change, we introduce a new factory method for bound
LibWeb objects that takes a JS::Realm instead of Web::HTML::Window.

The two methods are allowed to co-exist at this point, but the option to
take an HTML::Window will be removed once all clases are converted to
the new API.

We also start using the new Bindings::ensure_web_[prototype/constructor]
helpers from the Bindings/Intrinsics class so that we can eventually
remove the helpers from Window.h for the same.
2022-10-01 21:05:32 +01:00
Daniel Bertalan
41a8f3f40f Lagom: Link LibMain statically
This matches how LibMain is used within Serenity. This commit makes it
possible to build Lagom with LTO. Previously, `serenity_main` functions
would be dead-stripped away, as the linker could prove that nothing from
the executable ever called them.
2022-10-01 20:39:48 +02:00
Tim Schumacher
1faca15193 Toolchain: Move the binutils patch into its own folder
This makes binutils compatible with `./package.sh dev`, so that we can
regenerate patches more easily, and neatly stack (temporary) patches on
top.
2022-10-01 18:43:29 +01:00
Diego Iastrubni
18257604eb Lagom: Win32 support baby steps
This is the initial port of Lagom to win32. This will enable developers
to use Lagom as an alternative to vanilla STL/StandardC++Library - which
gives a much richer environment (think QtCore - but modern).

My main incentive - is to have a native Windows Ladybird working.

I am starting with AK, which does not yet fully compile (on mingw). When
AK is compiling (currently fails building StringBuffer.cpp) - I will
continue to LibCore and then the rest of the user space libraries
(excluding the GUI, which will be another different effort).

Most of the code is happily stollen from Andrew Kaster's fork - he
deserves the credit.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2022-09-29 17:01:22 +01:00
Timothy Flynn
5f9d8f25c6 AK+Meta: Define a debug flag for LibTimeZone 2022-09-28 23:52:51 +01:00
Timothy Flynn
9a1b24d5be LibTimeZone: Use the last DST rule in the TZDB if a match isn't found
Some time zones, like "Asia/Shanghai", use a set of DST rules that end
before present day. In these cases, we should fall back to last possible
RULE entry from the TZDB. The time zone compiler published by IANA (zic)
performs the same fallback starting with version 2 of the time zone file
format.
2022-09-28 23:52:51 +01:00
Timothy Flynn
7178c31f1c LibTimeZone: Update to TZDB version 2022d
https://mm.icann.org/pipermail/tz-announce/2022-September/000073.html
2022-09-27 15:16:09 +01:00
Linus Groh
9fb672e981 LibWeb: Implement '5.4. Request class' from the Fetch API :^) 2022-09-27 14:56:17 +01:00
Linus Groh
b9d626d6b2 LibWeb: Don't always assign values to nullable IDL dictionary members
IDL dictionary members are nullable by default (unless marked as
`required`) and should not get any value assigned unless one was
provided by the userland code that isn't undefined, or if the member has
a default value.

This is so that we can use Optional<T> in the internal representation
and check for "is present" via Optional::has_value().
2022-09-27 14:56:17 +01:00
Linus Groh
d38f1fb5b2 LibWeb: Fix bindings codegen for IDL enums with only one member
The SourceGenerator's @else@ mapping is only set in the second iteration
of the loop, causing the generated return for unrecognized values to not
be guarded by an else statement.
We can simply use a hardcoded 'else' here, @else@ is only to create the
first comparison as a plain 'if' and subsequent ones as 'else if'.
2022-09-27 14:56:17 +01:00
Timothy Flynn
eb0657c23e LibWeb: Add WebIDL to the IDL generator's list of web namespaces
Without this, the generated DOMExceptionConstructor does not refer to
the WebIDL::DOMException with its fully qualified name. This caused an
ambiguity error on my machine.
2022-09-26 14:00:31 +01:00
Linus Groh
bbaa05fcf9 LibWeb: Move DOMException from DOM/ to WebIDL/ 2022-09-25 19:13:31 +01:00
Andreas Kling
34c232def7 Lagom: Build DOMTreeModel from LibWebView
This will be used in Ladybird.
2022-09-25 12:10:28 +02:00
Andreas Kling
5778da765d Lagom: Build a tiny slice of LibGUI
We now build Model, ModelIndex and Icon from LibGUI. These will be used
in Ladybird to view the DOM tree model.
2022-09-25 12:09:36 +02:00
Linus Groh
2b2ccb3815 LibWeb: Replace 'heycam.github.io' links with 'webidl.spec.whatwg.org' 2022-09-24 19:32:09 +01:00
Linus Groh
86f68eb3c3 LibWeb: Move IDLOverloadResolution from Bindings/ to WebIDL/ 2022-09-24 19:31:39 +01:00
Linus Groh
4f73851afc LibWeb: Move CallbackType from Bindings/ to WebIDL/
Let's stop putting generic types and AOs from the Web IDL spec into
the Bindings namespace and directory in LibWeb, and instead follow our
usual naming rules of 'directory = namespace = spec name'. The IDL
namespace is already used by LibIDL, so Web::WebIDL seems like a good
choice.
2022-09-24 19:31:39 +01:00
kleines Filmröllchen
a5b72577e6 Meta: Enable full region dumping on CI 2022-09-24 14:22:09 +02:00
kleines Filmröllchen
1a7d6508e3 Kernel: By default, don't dump regions when a userspace crash happens
There is the DUMP_REGIONS_ON_CRASH debug macro which re-enables this
(old) behavior.
2022-09-24 14:22:09 +02:00
Andreas Kling
131c3f50de LibJS: Add JS::SafeFunction, like Function but protects captures from GC
SafeFunction automatically registers its closure memory area in a place
where the JS garbage collector can find it.

This means that you can capture JS::Value and arbitrary pointers into
the GC heap in closures, as long as you're using a SafeFunction, and the
GC will not zap those values!

There's probably some performance impact from this, and there's a lot of
things that could be nicer/smarter about it, but let's build something
that ensures safety first, and we can worry about performance later. :^)
2022-09-24 12:23:29 +02:00
Andrew Kaster
d6a741af6c Meta: Don't build Core::LocalServer on Android
We won't be able to use local servers on Android without some serious
Android work to create background tasks, so just disable this for now,
as it currently relies on Core::Account to take over from SystemServer.
2022-09-22 11:07:21 -04:00
Andrew Kaster
cca54e9535 CI: Remove Android NDK Cache
This actually never worked as a cache, the build has failed since it
tried to use it. This should restore the Android nightly build.
2022-09-22 11:07:21 -04:00
Ben Wiederhake
48062b3cca Meta: Remove 'time' invocation in lint-ci
Some systems don't have /usr/bin/time available, and during most runs
of lint-ci we don't actually care that much about the exact timing.
Therefore, let's just remove it. It's easy enough to add back in, if
someone wants to investigate an issue.
2022-09-22 00:45:10 +02:00
Linus Groh
edfef8e2f5 Everywhere: Rename WrapperGenerator to BindingsGenerator
This code generator no longer creates JS wrappers for platform objects
in the old sense, instead they're JS objects internally themselves.
Most of what we generate now are prototypes - which can be seen as
bindings for the internal C++ methods implementing getters, setters, and
methods - as well as object constructors, i.e. bindings for the internal
create_with_global_object() method.

Also tweak the naming of various CMake glue code existing around this.
2022-09-21 23:06:08 +01:00
Linus Groh
6055b0e850 LibWeb: Remove no-op impl() methods from the WEB_PLATFORM_OBJECT macro
These are leftovers from when wrapper objects still had an internal
implementation, which is no longer the case.
2022-09-21 21:12:24 +01:00
Linus Groh
2cab2a8e8f LibWeb: Turn is_platform_object() ifs into an Array 2022-09-21 21:12:24 +01:00
Linus Groh
464368f94a LibWeb: Rename is_wrappable_type() to is_platform_object()
This name more accurately reflects what we are checking. Also add an
explanatory note that only a hand-curated subset of platform object
types is checked in the absence of a full generated list.
2022-09-21 21:12:24 +01:00
Linus Groh
daf0a8dd91 LibWeb: Remove impl_is_wrapper() check from WrapperGenerator
This concept no longer applies to GC'd platform objects. The only place
where this was still used can use is_wrappable_type() instead.
2022-09-21 21:12:24 +01:00
Linus Groh
64a1992040 LibWeb: Remove support for RefPtr types in idl_type_name_to_cpp_type()
This is not used anymore.
2022-09-21 21:12:24 +01:00
Linus Groh
38b3ce8f03 LibIDL+LibWeb: Remove stale references to "wrapper class" concept
There are no wrappers for the platform object types anymore :^)
2022-09-21 21:12:24 +01:00
Timothy Flynn
51854e345a LibUnicode: Update to Unicode version 15.0.0
https://unicode.org/versions/Unicode15.0.0/
2022-09-21 14:04:22 +01:00
Timothy Flynn
739798e075 LibUnicode: Use recently added Core::Stream::read_all in code generators
The generators had a manual implementation when Core::Stream did not
have a read_all method.
2022-09-21 14:04:22 +01:00
Liav A
a40f289ee5 Meta: Add isa-vga device to ISA-PC and microvm machine types
With this device being added, we can now boot into graphics mode on
these platforms too. For ISA-PC machine this is basically the only
viable option to use, but in the future, we should remove this device
for the microvm machine type as it should allow us to determine better
options and detect them by using a given device tree blob.
2022-09-20 19:05:13 +01:00
Federico Guerinoni
4f46a0e4aa StateMachineGenerator: Remove unused variable
This fixes build on MacOS m1 arch.
2022-09-20 18:54:16 +01:00
Sam Atkins
684c3efc04 StateMachineGenerator: Port to LibMain and Core::Stream 2022-09-20 07:48:45 -04:00
Sam Atkins
cb45fa79ee LibEDID: Use Core::Stream API to generate PnpIDs 2022-09-20 07:48:45 -04:00
Sam Atkins
32810f6d1a IPCCompiler: Use Core::Stream API 2022-09-20 07:48:45 -04:00
Ben Wiederhake
230226028a Meta: Use time instead of /usr/bin/time in lint-ci.sh
I totally overlooked that /usr/bin/time is not universal, which broke
some systems. This commit instead calls 'time', allowing either a shell
built-in to kick in, or a (potentially different) binary be found
anywhere in the PATH.
2022-09-19 22:18:25 +04:30
Ben Wiederhake
761f079a22 Meta: Fix example invocations of the serenity.sh run command 2022-09-18 18:47:34 -07:00
Ben Wiederhake
f8a42ef0b3 Meta: Only check changed files in check-style.py during pre-commit
This speeds up the script from about 90ms down to about 10ms, for
reasonably common changesets.

80ms may not feel like much, but it adds up quickly, especially since
we run a dozen scripts during pre-commit.
2022-09-18 18:45:25 -07:00
Ben Wiederhake
532786848b Meta: Only check changed files in lint-gml-format.sh
This speeds up the script from about 140ms down to <10ms, even for
changesets that touch a handful of different GML files.

130ms may not feel like much, but it adds up quickly, especially since
we run a dozen scripts during pre-commit.
2022-09-18 18:45:25 -07:00
Ben Wiederhake
de581ca5fd Meta: Only check changed files in check-newlines-at-eof
This speeds up the script from about 120ms down to about 20ms for
reasonably common changesets.

100ms may not feel like much, but it adds up quickly, especially since
we run a dozen scripts during pre-commit.
2022-09-18 18:45:25 -07:00
Ben Wiederhake
4caaa78baf Meta: Only check changed files in check-debug-flags during pre-commit
This speeds up the script from about 170ms down to about 80ms for
changes in Debug.h.in or similarly "DEBUG"-rich files, down to <10ms for
more common changesets.

160ms may not feel like much, but it adds up quickly, especially since
we run a dozen scripts during pre-commit.
2022-09-18 18:45:25 -07:00
Ben Wiederhake
88c8ad840d Meta: Rewrite pre-commit script check-emoji in python
This reduces the scripts execution time from 0.57 seconds to 0.01
seconds, while also making the check a bit tighter, leaving fewer
possible problems.
2022-09-18 18:45:25 -07:00
Ben Wiederhake
c4895b7d95 Meta: Always show the timing of commands in lint-ci.sh
This should make it easier to identify slow-running scripts.
While we're at it, unify the output a little bit.
2022-09-18 18:45:25 -07:00
Ben Wiederhake
30cca01e24 HeaderCheck: Also check AK for broken headers 2022-09-18 13:27:24 -04:00
Ben Wiederhake
8a1e406615 HeaderCheck: Disable warning due to LibSoftGPU
Once LibSoftGPU drops this disable, HeaderCheck should remove it, too.
Until then, it is necessary to build at all.
2022-09-18 13:27:24 -04:00
Ben Wiederhake
2f7c9915b5 HeaderCheck: Remove outdated debug code
This should never have been committed.
2022-09-18 13:27:24 -04:00
Andreas Kling
9743849ddb LibWeb: Allow passing null to a nullable IDL union type
This fixes an issue on Twitter where they were instantiating an
IntersectionObserver with a null root. The root IDL type is
`(Element or Document)?` so null needs to be allowed.
2022-09-18 12:53:06 +02:00