Commit graph

46515 commits

Author SHA1 Message Date
Lucas CHOLLET 81bd91c1c3 SystemServer: Propagate errors
This patch also includes some changes in the way that the environment
and arguments are passed to `exec`. It was needed to fit the signature
of `Core::System::exec`. That's beneficial though, as we are now doing
`String` manipulation in a fallible environment, so we can propagate
more errors.
2023-02-01 19:21:10 +01:00
Lucas CHOLLET cd0b7656fa ConfigServer: Unveil "/etc/passwd"
This is needed to use functions like `getpwuid()`.
2023-02-01 19:21:10 +01:00
Nico Weber fb79fc0ba6 Tests: Add a basic ICC profile test
icc-v4.jpg is Meta/Websites/serenityos.org/happy/3rd/bgianf.jpg.
There are a whole bunch of jpgs with v4 color profiles and I just picked
one fairly arbitrarily. It looks like a fairly standard v4 matrix
profile that in this form is also present in many jpgs taken by mobile
phone cameras. It uses parametric curves.

icc-v2.png is based on ./Documentation/WebServer_localhost.jpg since
that is the only image in the repo with a v2 color profile. It also has
all kinds of interesting and somewhat exotic tags, such as an 'dscm' (an
Apple extension to have a description of type 'mluc', since normal
'desc' is required ot have type 'desc' in v2 files -- in v4, 'desc' has
type 'mluc') tag of type 'mluc' that actually contains data in several
languages and that exercises the non-BMP UTF-16BE decoder. It's however
still also a fairly standard v2 matrix profile, which uses 'curv'
instead of 'para' for its curves ('para' is v4-only).

I converted that jpeg file to png, and cropped most of the image
data to save on file size by running:

    sips -s format png --cropToHeightWidth 21 42 in.jpg --out out.png
2023-02-01 19:19:30 +01:00
Nico Weber d43b306814 LibGfx: Give ICC::TagType a virtual destructor
ICC::Profile deletes these objects via base class pointers, so this
is needed that destructors in the subclasses get called.

(Found by asan on CI when adding test coverage.)
2023-02-01 19:19:30 +01:00
Cubic Love 0cfce93e51 Base+Presenter: Add icons for Presenter
Add application and filetype icons for Presenter in 32px and 16px
2023-02-01 19:17:48 +01:00
Timothy Flynn 38b0b32bb4 Meta: Set LD_LIBRARY_PATH to Build/lagom for Lagom test targets
Some tests, such as those under LibGL, try to load shared libraries at
runtime which are stored in Build/lagom. Because all tests' working
directory is that of their CMakeLists.txt file, they fail to find those
shared libraries at runtime.

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

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

Note that for non-test Lagom targets which do not set this property, the
working directory will be Build/lagom (because the property will be the
empty string, which CMake resolves relative to the current build path).
2023-02-01 12:28:02 -05:00
Nico Weber 0a97206a25 Meta: Derust fuzzer build docs
The document wasn't updated in 9c2211f246.
2023-02-01 14:44:58 +00:00
Sam Atkins ced59fb3a0 Spider: Make double-click skip the new-game animation 2023-02-01 14:19:15 +00:00
Sam Atkins 8744e8b561 Spider: Use a single State enum instead of a series of booleans 2023-02-01 14:19:15 +00:00
Sam Atkins 5de8b38783 Solitaire: Make double-click skip the new-game animation 2023-02-01 14:19:15 +00:00
Sam Atkins e8d83b1ae1 Solitaire: Use a single State enum instead of a series of booleans
We had 4 different bools before, but the only valid states were either
that only one of them was true, or than none of them are true. An enum
is a better fit here, by enforcing that we can only be in one state at
a time.
2023-02-01 14:19:15 +00:00
Timothy Flynn 9f9b8e7273 CI: Move running LibWeb layout tests to Azure
The current config on GitHub Actions does not use ccache, so it takes
quite a while to build. Instead, let's just run these tests on Azure
where we already build Ladybird and have ccache enabled. This also lets
us sanitize LibWeb on both Linux and macOS.

The script changes here are to A) handle differences between Azure and
GitHub Actions and B) to support running on macOS.
2023-02-01 14:04:44 +00:00
Timothy Flynn 093e7e2a86 Ladybird: Exit Ladybird normally during dump-layout-tree mode
Don't use _exit() - this is a forceful exit that will bypass all exit
handlers. This includes AddressSanitizer, and will prevent ASan from
exiting the app with a fatal error code.
2023-02-01 14:04:44 +00:00
Timothy Flynn 9fd54e1f90 Ladybird: Store the WebContent QSocketNotifier on the stack
This was being heap allocated with naked-new and never freed. Caught by
AddressSanitizer.
2023-02-01 14:04:44 +00:00
Timothy Flynn ac80475a1f Ladybird: Initialize boolean command line argument
This being uninitialized was caught by AddressSanitizer.
2023-02-01 14:04:44 +00:00
Timothy Flynn 96f409ec1e LibWeb+WebContent: Do not reference-count file request objects
There is currently a memory leak with these file request objects due to
the callback on_file_request_finish referencing itself in its capture
list. This object does not need to be reference counted or allocated on
the heap. It is only ever stored in a HashMap until a response is
received from the browser, and it is not shared.
2023-02-01 14:04:44 +00:00
Nico Weber 9bb469f324 Meta: Build and run Tests/LibGfx in lagom builds
They can be run using

    Meta/serenity.sh test lagom TestFontHandling

which will build _all_ test binaries and then run TestFontHandling.

There's also

    Meta/serenity.sh run lagom TestFontHandling

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

Finally, manually doing

    Meta/serenity.sh build lagom TestFontHandling

followed by

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

will build and then run just that one test in a way that makes the test
pass.
2023-02-01 08:56:56 -05:00
Nico Weber c8832807d6 LibGfx+Tests: Remove code unnecessary after 9e7c16d0a4 2023-02-01 08:56:56 -05:00
Nico Weber bea3f3fc46 LibGfx: Move TestImageDecoder over to input file approach in 8cfabbcd93
Rather than reading files out of /res, put them in a subfolder of
Tests/LibGfx/ and pick the path based on AK_OS_SERENITY.

That way, the tests can also pass when run under lagom.

(I just `cp`d all the files that the test previously read from
random places into Tests/LibGfx/test-inputs.)
2023-02-01 08:56:56 -05:00
Nico Weber b8b5e0f680 LibGfx: Move TestFontHandling over to input file approach in 8cfabbcd93
Rather than reading files out of /res, put them in a subfolder of
Tests/LibGfx/ and pick the path based on AK_OS_SERENITY.

That way, the tests can also pass when run under lagom.
2023-02-01 08:56:56 -05:00
Xexxa 389224c2d2 Base: Add more emoji
👊 - U+1F44A ONCOMING FIST
🚶 - U+1F6B6 PERSON WALKING
🚶‍♂️ - U+1F6B6 U+200D U+2642 MAN WALKING
🚶‍♀️ - U+1F6B6 U+200D U+2640 WOMAN WALKING
🧑‍🦯 - U+1F9D1 U+200D U+1F9AF PERSON WITH WHITE CANE
👨‍🦯 - U+1F468 U+200D U+1F9AF MAN WITH WHITE CANE
👩‍🦯 - U+1F469 U+200D U+1F9AF WOMAN WITH WHITE CANE
🚴 - U+1F6B4 PERSON BIKING
🚴‍♂️ - U+1F6B4 U+200D U+2642 MAN BIKING
🚴‍♀️ - U+1F6B4 U+200D U+2640 WOMAN BIKING
👡 - U+1F461 WOMAN’S SANDAL
2023-02-01 13:46:04 +00:00
Nico Weber 407d882eee Documentation: Rename WebServer_localhost to .jpg
It took me way too long to figure out why PNGImageDecoderPlugin
couldn't load WebServer_localhost.png -- turns out it's a jpeg file.
2023-02-01 13:40:37 +00:00
Ali Mohammad Pur c045d09840 LibLine: Quit event loop when an error occurs on update
Previously we were crashing, which was excessive, if we can't read
anymore, we should just return with an error.
2023-02-01 01:04:42 +03:30
Andreas Kling ce6636e78e LibGfx: Make glyph ID lookup faster with a cache
This patch adds a "GlyphPage" cache which stores the mapping between
code points and glyph IDs in a segmented table of "pages".

This makes Font::glyph_id_for_code_point() significantly faster by
not reparsing the font tables every time you call it.

In the future, we can add more information to GlyphPage (such as
horizontal metrics for each glyph) to further reduce time spent in
text layout and painting.
2023-01-31 17:14:57 +01:00
Ben Wiederhake e147d0b572 AK: Fix all quadratic-time append-loops over ByteBuffer 2023-01-31 16:58:25 +01:00
Iman Seyed 0ebcc99e12 AK: Remove unused network ordered 'address' variable 2023-01-31 12:42:49 +01:00
Timothy Flynn e74e8381d5 LibJS: Allow "approximately" results to differ in plural form
This is a normative change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/08f599b

Note that this didn't seem to actually affect our implementation. The
Unicode spec states:

https://www.unicode.org/reports/tr35/tr35-53/tr35-numbers.html#Plural_Ranges
"If there is no value for a <start,end> pair, the default result is end"

Therefore, our implementation did not have the behavior noted by the
issue this normative change addressed:

    const pr = new Intl.PluralRules("en-US");
    pr.selectRange(1, 1); // Is "other", should be "one"

Our implementation already returned "one" here because there is no such
<start=one, end=one> value in the CLDR for en-US. Thus, we already
returned the end value of "one".
2023-01-30 14:10:07 -05:00
Jelle Raaijmakers 5c1038e54f LibSoftGPU: Remove DeprecatedString usage 2023-01-30 13:49:52 -05:00
Jelle Raaijmakers a8cb70c0c4 LibGPU: Remove DeprecatedString usage 2023-01-30 13:49:52 -05:00
Jelle Raaijmakers e3f8ac2c05 LibGL: Remove DeprecatedString usage
We only use it for the extension string, which we now convert into a
`ByteBuffer` object containing the null-terminated bytes :^)
2023-01-30 13:49:52 -05:00
Timothy Flynn 6a50fb465c LibJS: Make use of the Intl MV in more Intl.NumberFormat AOs
This is an editorial change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/c24b33e

Note our implementation was already using the Intl MV in these AOs just
due to C++ type safety.
2023-01-30 12:19:14 -05:00
Timothy Flynn a283daaab7 LibJS: Refactor the Intl.NumberFormat GetStringOrBooleanOption AO
This is an editorial change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/654bfad
2023-01-30 12:19:14 -05:00
Timothy Flynn be347f67dc LibJS: Shorten some spec text for BestAvailableLocale
This is an editorial change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/654bfad
2023-01-30 12:19:14 -05:00
Timothy Flynn 4475f21e9e LibJS: Allow locale approximately signs to be empty in Intl.NumberFormat
This is a normative change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/23e69cf

This isn't particularly testable because every locale in the CLDR has a
non-empty "approximatelySign" field in cldr-numbers-modern. The issue
for this change seems to be considering the "miscPatterns/approximately"
field instead, which has different semantics. But as noted on the CLDR
issue https://unicode-org.atlassian.net/browse/CLDR-14918, the ICU uses
the "approximatelySign" field (as do our implementation).
2023-01-30 12:19:14 -05:00
Timothy Flynn 5b3b14be0a LibJS: Move resolution of some Intl.NumberFormat options to a common AO
This is a normative change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/29acfc6

This is to allow Intl.PluralRules to use these options, as they were in-
effect required by later AOs anyways.
2023-01-30 12:19:14 -05:00
Tim Schumacher 093cf428a3 AK: Move memory streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher 11550f582b Tests: Remove the 10KB file read test for AllocatingMemoryStream
When we move the test to AK (together with the actual stream
implementation), finding the input file to read from is going to become
significantly harder, since the test also runs outside of SerenityOS.

Since this was just a smoke test during early development (and we should
now have reasonable coverage with actual usages in the other parts of
the OS), let's just remove that test instead of trying to make input
file lookups work.
2023-01-29 19:16:44 -07:00
Tim Schumacher 22f0d04f43 AK: Provide a fallback definition for std::nothrow 2023-01-29 19:16:44 -07:00
Tim Schumacher 2470dd3bb5 AK: Move bit streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher 94f139c111 AK: Move buffered streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher 8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Tim Schumacher 5f2ea31816 AK: Move Handle from LibCore and name it MaybeOwned
The new name should make it abundantly clear what it does.
2023-01-29 19:16:44 -07:00
Tim Schumacher 5fa590de71 AK: Remove Buffered 2023-01-29 19:16:44 -07:00
Tim Schumacher ae64b68717 AK: Deprecate the old AK::Stream
This also removes a few cases where the respective header wasn't
actually required to be included.
2023-01-29 19:16:44 -07:00
Andreas Kling 230cb3b0cb AK: Add DeprecatedString::from_utf8()
This will be used in Jakt to help transition off of DeprecatedString.
2023-01-29 23:41:42 +01:00
Andreas Kling 6b497b8710 AK: Add two helpers to DeprecatedStringCodePointIterator 2023-01-29 23:41:42 +01:00
Nico Weber f4c1269d4c Tests: Modernize TestImageDecoder a bit
- Use MUST() instead of checking plugin_decoder_or_error.is_error()
- Use MappedFile::bytes()
- Don't use EXPECT_EQ when comparing to fixed bools

No intended behavior change.
2023-01-29 22:37:37 +00:00
Nico Weber 10ae570ac5 Tests: Make LibGfx tests not depend on LibGUI
As far as I can tell, that's not needed and never was.
2023-01-29 22:36:13 +00:00
Nico Weber fef15becb2 LibGfx: Support ICCs in JPEGs that are split across several tags
Most jpegs that use multi-tag ICCs are in CMYK format, so running
`icc` on them still produces

    Runtime error: Unsupported number of components in SOF

but it no longer prints several

    jpg: Ignoring ICC profile spanning several chunks (1/9)

lines before that.

(And if I manually comment out that error message, the profile
is printed fine. But we can't decode the actual pixel data yet.)
2023-01-29 19:17:35 +00:00