Commit Graph

1895 Commits

Author SHA1 Message Date
Timothy Flynn
5e29e04122 LibJS+LibLocale: Propagate errors from find_regional_values_for_locale
This had quite the footprint.
2023-01-27 18:00:17 +00:00
Timothy Flynn
b2097f4059 LibJS+LibLocale: Port Intl.DateTimeFormat to String 2023-01-27 18:00:17 +00:00
Timothy Flynn
ad8183beb4 Meta: Support running ladybird with arguments from serenity.sh
You may now, for example, run:

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

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

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

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

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

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

Some GLOBs remain but this is most of them.

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

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

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

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

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

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

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

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

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

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

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

 - And the programs associated with any individual glyph.

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

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

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

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

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

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

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

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

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

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

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

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

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

Timings:
Before:
  Time (abs ≡): 20.440 s [User: 133.928 s, System: 12.290 s]
After:
  Time (abs ≡): 20.346 s [User: 135.534 s, System: 11.207 s]
2023-01-05 15:03:52 +01:00