Commit graph

45848 commits

Author SHA1 Message Date
Timothy Flynn
be8907e6bb LibJS: Return OptionalNone in fallible functions in the Intl namespace 2023-01-19 23:13:44 +00:00
Timothy Flynn
5349972f41 LibJS: Add a special ThrowCompletionOr constructor for OptionalNone
Currently, if you have a fallible function with an Optional return type
and try to return OptionalNone like this:

    ThrowCompletionOr<Optional<SomeType>> { return OptionalNone {}; }

Then ThrowCompletionOr's m_value (whose type is an Optional<ValueType>)
will be set to empty, rather than containing an empty Optional. This is
due to the ThrowCompletionOr's WrappedValueType constructor.

This patch adds a constructor specifically for OptionalNone. If someone
attempts to construct a ThrowCompletionOr with OptionalNone, but the
ValueType is not an Optional, a compile error like the following will
occur:

    ThrowCompletionOr<String> foo() { return OptionalNone {}; }

    error: no matching constructor for initialization of 'AK::String'

Otherwise, it will fill ThrowCompletionOr's m_value with an empty
Optional.
2023-01-19 23:13:44 +00:00
Timothy Flynn
d901a9989d LibLocale: Remove now-unused [LanguageID,LocaleID]::to_deprecated_string 2023-01-19 20:57:30 +00:00
Timothy Flynn
bb4b6d8ce3 LibJS: Port Intl locale resolution to String 2023-01-19 20:57:30 +00:00
Timothy Flynn
2f1184ccdb LibJS: Do not fully qualify references to CanonicalizeUnicodeLocaleId
This might've been needed at some point to disambiguate between another
function of the same name that is in LibLocale. But now that it takes a
VM parameter, it is for sure clear to the compiler what is being called.
2023-01-19 20:57:30 +00:00
Timothy Flynn
1e6e719592 LibJS: Propagate OOM errors from the PartitionPattern Abstract Operation 2023-01-19 20:57:30 +00:00
Timothy Flynn
bff0e25ebe LibJS: Propagate OOM errors from Intl Abstract Operations
This excludes the PartitionPattern AO as that has a much larger foot-
print and will be handled separately.
2023-01-19 20:57:30 +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
Timothy Flynn
618714e29a LibLocale: Add a method to convert LocaleID to a String 2023-01-19 20:57:30 +00:00
Karol Kosek
f3c6510b83 Ladybird: Accept file drops 2023-01-19 19:22:03 +00:00
Karol Kosek
731fec525e Ladybird: Add URL and 'open in background' parameters to new_tab()
This will avoid loading starting about:blank page in places when we know
exactly what we want to load.

The opening in background part might be useful for future things like
file drops and right-click open in new tab.
2023-01-19 19:22:03 +00:00
Karol Kosek
194ddca24f Ladybird: Move the initial blank page load to BrowserWindow
Takes care of a FIXME :^)
2023-01-19 19:22:03 +00:00
Karol Kosek
5e89773937 Ladybird: Don't prepend 'about:' urls with an http:// scheme 2023-01-19 19:22:03 +00:00
Karol Kosek
4f36893fda Ladybird: Set initial page when NOT connected to WebDriver
This flips an if check condition, making the JS console work in new tabs
again.
2023-01-19 19:22:03 +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
73350b8492 Tests: Mark TestCommonmark as DISABLED
This has no effect right now, but will allow us to use this same cmake
file from Lagom.
2023-01-19 11:50:10 +00:00
Sam Atkins
7b82f37ba3 Tests: Add missing library dependency for LibTimeZone tests 2023-01-19 11:50:10 +00:00
Sam Atkins
c0c700ed11 Tests: Add missing library dependencies for LibGL tests
These are required for running on Lagom.
2023-01-19 11:50:10 +00:00
Sam Atkins
1910dc8976 Tests: Move test PDF files into Tests/LibPDF
Let's put test files with the tests themselves, instead of a random user
directory. (But still copy them so they appear in the user directory
for convenience.)
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
Sam Atkins
a4c8353472 Tests: Correct serenity_test() invocation for LibTTF
Putting the LibTTF tests into the LibGfx directory worked fine before,
but causes issues if we try and call this from Lagom. Also, it's tidier
to put LibTTF tests in a LibTTF directory. :^)
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
Timothy Flynn
8438c509e9 LibCore: Make the FileWatcher test resilient against outside events
The test currently watches /tmp, which the OS can create/modify files
under at any time outside of our control. So just ignore events that we
aren't interested in.

Also test removing an item from the FileWatcher.
2023-01-19 11:29:48 +00:00
Timothy Flynn
0e7a48bd7d LibCore: Allow subclassing FileWatcher
This will be handy for platforms which need to be able to store extra
OS-specific members. For example, macOS needs to store a dispatch queue,
and event stream, etc.
2023-01-19 11:29:48 +00:00
Timothy Flynn
5063e218af AK: Move the AK::FixedPoint formatter to FixedPoint.h
This does not need to be defined in Format.h. This causes FixedPoint.h
to be included everywhere. This is particularly going to be an issue
when trying to include <CoreServices/CoreServices.h> on macOS. The macOS
SDK defines its own FixedPoint structure which will conflict with ours.
2023-01-19 11:29:48 +00:00
Timothy Flynn
027aee2c66 Userland: Add missing Math.h and IntegralMath.h header includes
These are currently being implicitly including by FixedPoint.h by way of
Format.h. The former will soon be removed from the latter, which would
otherwise cause a compile error in these files.
2023-01-19 11:29:48 +00:00
Peter Elliott
b217045f8f AK: Don't write trailing zeros with %g 2023-01-19 12:22:24 +01:00
Peter Elliott
5efcec308a Utilities: Rewrite sort(1) to be more posixy 2023-01-19 12:22:24 +01:00
Peter Elliott
d50de8e4ef Utilities: Replace fgrep with grep --fixed-strings 2023-01-19 12:22:24 +01:00
Peter Elliott
d844829de4 Ports: Fix compatiblity issues with running package.sh on Serenity 2023-01-19 12:22:24 +01:00
Joao Luz
18d72ed3fd Presenter: Disable actions when there is no loaded presentation 2023-01-19 11:15:46 +00:00
Tim Schumacher
da1706d697 LibC: Remove the stub iconv header
This was added in 2019 to trick GCC into accepting a newlib build, but
now this no longer seems to be required to build the toolchain.
2023-01-19 11:51:58 +01:00
Tim Schumacher
4dcc26e940 LibAudio: Skip MP3 frames if not enough historic data is available 2023-01-19 11:42:32 +01:00
Tim Schumacher
4ad9fbc6a5 LibAudio: Clear the MP3 bit stream when seeking 2023-01-19 11:42:32 +01:00
Tim Schumacher
9bf9702842 SoundPlayer: Translate device samples to source samples before seeking 2023-01-19 11:42:32 +01:00
Tim Schumacher
dfc57c0dd9 SoundPlayer: Don't offset the seek bar with the last seek value
The audio loader plugins already do this internally, if we do this a
second time the seek bar will just end up getting rendered at the wrong
place.
2023-01-19 11:42:32 +01:00
Tim Schumacher
daf181caa8 LibCore: Let offset-related Stream functions return an unsigned value
A negative return value doesn't make sense for any of those functions.
The return types were inherited from POSIX, where they also need to have
an indicator for an error (negative values).
2023-01-19 11:41:56 +01:00
Tim Schumacher
1ca62de558 LibCore: Return EBADF on unsupported stream operations 2023-01-19 11:41:56 +01:00
Tim Schumacher
e65767c2e7 LibDebug: Identify embedded resources with a preceding dot 2023-01-19 11:29:29 +01:00
Tim Schumacher
edd4913573 LibDebug: Factor out the "looks like embedded resource" condition 2023-01-19 11:29:29 +01: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
konrad
78d6de2ec1 Kernel: Make a slightly better demo for Aarch64 multiprocessing 2023-01-18 22:58:42 +01:00
konrad
9b12571a86 AK: Unify kernel debug messages, avoid printing time if unavailable 2023-01-18 22:58:42 +01:00
konrad
5791072280 Kernel: Detect Aarch64 virtual address bit width with CPU ID registers 2023-01-18 22:58:42 +01:00
konrad
401fc6afae Kernel: Detect Aarch64 physical address bit width with CPU ID registers 2023-01-18 22:58:42 +01:00
konrad
66c65f6e2c Kernel: Add and use accessors to read from Aarch64 CPU ID registers
Following registers accessors are updated and put in use:
* ID_AA64ISAR0_EL1, Instruction Set Attribute Register 0

Accessors for following registers are added and put in use:
* ID_AA64ISAR1_EL1, Instruction Set Attribute Register 1
* ID_AA64ISAR2_EL1, Instruction Set Attribute Register 2
* ID_AA64MMFR1_EL1, AArch64 Memory Model Feature Register 1
* ID_AA64MMFR2_EL1, AArch64 Memory Model Feature Register 2
* ID_AA64MMFR3_EL1, AArch64 Memory Model Feature Register 3
* ID_AA64MMFR4_EL1, AArch64 Memory Model Feature Register 4
* ID_AA64PFR0_EL1, AArch64 Processor Feature Register 0
* ID_AA64PFR1_EL1, AArch64 Processor Feature Register 1
* ID_AA64PFR2_EL1, AArch64 Processor Feature Register 2
* ID_AA64ZFR0_EL1, AArch64 SVE Feature ID register 0
* ID_AA64SMFR0_EL1, AArch64 SME Feature ID register 0
* ID_AA64DFR0_EL1, AArch64 Debug Feature Register 0
* ID_AA64DFR1_EL1, AArch64 Debug Feature Register 1

Additionally, there are few CPU features detected with
* TCR_EL1, Translation Control Register

but detection mechanism using it (for LPA/LPA2) is probably wrong as
this is control register, not a id register, and needs further work.

Finally, following registers are provided. Former one is already used,
while latter is given for future use:
* MIDR_EL1, Main ID Register
* AIDR_EL1, Auxiliary ID Register
2023-01-18 22:58:42 +01:00
konrad
6979cf230e Kernel: Print Aarch64 CPU features during CPU initialization 2023-01-18 22:58:42 +01:00
konrad
a8e9591bac Kernel: Split Aarch64 CPU setup into two stages
Former aims to bring the processor itself into desired state,
while latter allows for additional initialization with heap available.
2023-01-18 22:58:42 +01:00
konrad
97dce5d001 Kernel: Add Aarch64 CPU feature detection 2023-01-18 22:58:42 +01:00
konrad
9f736d782c AK: Patch ArbitrarySizedEnum operators for missing constructor
Patch kindly provided by Ali on #aarch64 on Discord.

Co-authored-by: Ali Mohammad Pur <mpfard@serenityos.org>
2023-01-18 22:58:42 +01:00