Commit graph

1154 commits

Author SHA1 Message Date
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
Timothy Flynn
fc0c88344b LibTimeZone: Slightly refactor the generated DST rule finding method
This just splits up the method to find the active DST rule for specified
time and time zone. This is to allow re-using the now split-off function
in upcoming commits.
2022-01-25 18:39:36 +00:00
Timothy Flynn
ef0155932b LibTimeZone: Parse and generate time zone abbreviation format strings
For example, today, America/New_York has the format string "E%sT" and
uses US DST rules. Those rules indicate the %s should be replaced by a
"D" in daylight time and "S" in standard time.
2022-01-25 18:39:36 +00:00
Idan Horowitz
67ce9e28a5 AK: Standardize the behaviour of GenericLexer::consume_until overloads
Before this commit all consume_until overloads aside from the Predicate
one would consume (and ignore) the stop char/string, while the
Predicate overload would not, in order to keep behaviour consistent,
the other overloads no longer consume the stop char/string as well.
2022-01-25 13:41:09 +03:30
Daniel Bertalan
4055c393fc Toolchain: Add support for building the userland with the mold linker
This commit adds support for building the SerenityOS userland with the
new [mold linker].

This is not enabled by default yet; to link using mold, run the
`Toolchain/BuildMold.sh` script to build the latest release of mold, and
set the `ENABLE_MOLD_LINKER` CMake variable to ON. This option relies on
toolchain support that has been added just recently, so you might need
to rebuild your toolchain for mold to work.

[mold linker]: https://github.com/rui314/mold
2022-01-24 10:41:47 +00:00
Tom
869c20b05d Meta+LibEDID: Download and generate the PNP ID database
This downloads the UEFI's published PNP ID database and generates a
lookup table for use in LibEDID. The lookup table isn't optimized at
all, but this can be easily done at a later point if needed.
2022-01-23 22:45:21 +00:00
Idan Horowitz
ace36681ff LibJS+LibIMAP: Use the new Optional<U>(Optional<T>) constructor
These look much nicer than these repeated ternaries :^)
2022-01-23 18:53:42 +02:00
mjz19910
1ef633472b Everywhere: Convert VM::call() to JS::call() 2022-01-23 15:24:45 +00:00
Timothy Flynn
6057a2ca30 timezone: Add a command line utility to set the system time zone 2022-01-23 12:48:26 +00:00
Timothy Flynn
da27937144 LibTimeZone: Add an API to retrieve a list of all known IANA time zones 2022-01-23 12:48:26 +00:00
Nico Weber
fd7de68d07 LibHTTP+AK: Rename CNETWORKJOB_DEBUG to NETWORKJOB_DEBUG 2022-01-23 00:45:22 +00:00
Nico Weber
a17b2248f2 LibHTTP+AK: Rename CHTTPJOB_DEBUG to HTTPJOB_DEBUG 2022-01-23 00:45:22 +00:00
Idan Horowitz
024ee0a99a CI: Fail Lagom linters step as soon as any linter fails
This prevents linters from covering the failure of previous linters by
overwriting the error code that Azure reads at the end of the step.
2022-01-22 21:40:09 +02:00
Nico Weber
3831e5fcff Utilities+Lagom: Remove test-crypto
After 4d5ffd364a, Tests/{LibCrypto,LibTLS} test the same things
and test-crypto has been redundant since then.
2022-01-22 01:44:05 +00:00
Nico Weber
6d532649d4 RequestServer+AK: Move happy-path logging behind REQUESTSERVER_DEBUG
vdbgln() was responsible for ~10% of samples on pv's flamegraph for
RequestServer (under request_did_finish) when loading github.com in
Browser and recording a whole-system profile. This makes that almost
completely disappear.
2022-01-22 01:28:01 +00:00
davidot
7cbf4b90e8 LibJS: Implement ImportCall and HostImportModuleDynamically
This allows us to load modules from scripts.
This can be dangerous as it can load arbitrary files. Because of that it
fails and throws by default. Currently, only js and JavaScriptTestRunner
enable the default hook.

This also adds tests to test-js which test module code. Because we
form a spec perspective can't "enter" a module this is the easiest way
to run tests without having to modify test-js to have special cases for
modules.
To specify modules in test-js we use the extension '.mjs' this is to
ensure the files are not executed. We do still want to lint these files
so the prettier scripts have changed to look for '.mjs' files as well.
2022-01-22 01:21:18 +00:00
davidot
0b89dbc529 Meta: Add JS_MODULE_DEBUG define flag 2022-01-22 01:21:18 +00:00
Luke Wilde
631bbcd00a LibJS: Refactor interpreter to use Script and Source Text Modules
This also refactors interpreter creation to follow
InitializeHostDefinedRealm, but I couldn't fit it in the title :^)

This allows us to follow the spec much more closely rather than being
completely ad-hoc with just the parse node instead of having all the
surrounding data such as the realm of the parse node.

The interpreter creation refactor creates the global execution context
once and doesn't take it off the stack. This allows LibWeb to take the
global execution context and manually handle it, following the HTML
spec. The HTML spec calls this the "realm execution context" of the
environment settings object.

It also allows us to specify the globalThis type, as it can be
different from the global object type. For example, on the web, Window
global objects use a WindowProxy global this value to enforce the same
origin policy on operations like [[GetOwnProperty]].

Finally, it allows us to directly call Program::execute in perform_eval
and perform_shadow_realm_eval as this moves
global_declaration_instantiation into Interpreter::run
(ScriptEvaluation) as per the spec.

Note that this doesn't evalulate Source Text Modules yet or refactor
the bytecode interpreter, that's work for future us :^)

This patch was originally build by Luke for the environment settings
object change but was also needed for modules. So I (davidot) have
modified it with the new completion changes and setup for that.

Co-authored-by: davidot <davidot@serenityos.org>
2022-01-22 01:21:18 +00:00
kleines Filmröllchen
8a92573732 LibAudio: Convert FlacLoader to use new Core::Stream APIs :^)
For this change to work "easily", Loader can't take const ByteBuffer's
anymore, which is fine for now.
2022-01-22 01:13:42 +03:30
mjz19910
2cf02c6f38 adjtime: Port to LibMain 2022-01-21 01:52:22 +01:00
Dmitry Petrov
1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00