Commit graph

1306 commits

Author SHA1 Message Date
Andrew Kaster
5ab3fcf710 Meta: Update jakt build support for fully bootstrapped compiler
Remove the Corrosion dependency, and use the now-builtin
add_jakt_executable function from the Jakt install rules to build our
example application.

By using find_package(Jakt), we now have to set ENABLE_JAKT manually on
both serenity and Lagom at the same time, so the preferred method to do
this for now is:

    cmake -B Build/superbuild<arch><toolchain> \
          -S Meta/CMake/Superbuild \
          -DENABLE_JAKT=ON \
          -DJAKT_SOURCE_DIR=/path/to/jakt

Where omitting JAKT_SOURCE_DIR will still pull from the main branch of
SerenityOS/jakt. This can be done after runing Meta/serenity.sh run.
2022-09-09 11:23:42 +02:00
Timothy Flynn
ff48220dca Userland: Move files destined for LibLocale to the Locale namespace 2022-09-05 14:37:16 -04:00
Timothy Flynn
fc8bf7ac3e LibUnicode+Userland: Migrate generated CLDR data to LibLocaleData
Currently, LibUnicodeData contains the generated UCD and CLDR data. Move
the UCD data to the main LibUnicode library, and rename LibUnicodeData
to LibLocaleData. This is another prepatory change to migrate to
LibLocale.
2022-09-05 14:37:16 -04:00
Jesse Buhagiar
8df09f6e13 Utilities/lsusb: Fix uninitialized variable error
The variable `print_verbose` (which prints verbose information about the
USB devices connected to the system) was uninitialized in `lsusb`. This
was causing the verbose information to be printed if `-v` was NOT seen
on the command line.
2022-09-04 13:26:05 -04:00
Linus Groh
cfa5885855 LibJS: Turn initialize_global_object() into a regular initialize()
There's nothing special about global object initialization anymore, this
can just work the same way as for any other object now.
2022-08-28 16:36:56 +01:00
Linus Groh
867ad03995 LibJS: Move Console ownership from GlobalObject to ConsoleObject
GlobalObject is now a regular object with no special properties :^)
2022-08-28 16:36:56 +01:00
Linus Groh
50428ea8d2 LibJS: Move intrinsics to the realm
Intrinsics, i.e. mostly constructor and prototype objects, but also
things like empty and new object shape now live on a new heap-allocated
JS::Intrinsics object, thus completing the long journey of taking all
the magic away from the global object.
This represents the Realm's [[Intrinsics]] slot in the spec and matches
its existing [[GlobalObject]] / [[GlobalEnv]] slots in terms of
architecture.

In the majority of cases it should now be possibly to fully allocate a
regular object without the global object existing, and in fact that's
what we do now - the realm is allocated before the global object, and
the intrinsics between both :^)
2022-08-27 11:29:10 +01:00
Tim Schumacher
5f99934dce Userland: Consolidate most PATH resolving into a single implementation
We previously had at least three different implementations for resolving
executables in the PATH, all of which had slightly different
characteristics.

Merge those into a single implementation to keep the behaviour
consistent, and maybe to make that implementation more configurable in
the future.
2022-08-23 19:00:04 +01:00
Linus Groh
275dea9d98 LibJS: Remove {Bytecode::,}Interpreter::global_object()
The basic idea is that a global object cannot just come out of nowhere,
it must be associated to a realm - so get it from there, if needed.

This is to enforce the changes from all the previous commits by not
handing out global objects unless you actually have an initialized
realm (either stored somewhere, or the VM's current realm).
2022-08-23 13:58:30 +01:00
Linus Groh
b345a0acca LibJS+LibWeb: Reduce use of GlobalObject as an intermediary
- Prefer VM::current_realm() over GlobalObject::associated_realm()
- Prefer VM::heap() over GlobalObject::heap()
- Prefer Cell::vm() over Cell::global_object()
- Prefer Wrapper::vm() over Wrapper::global_object()
- Inline Realm::global_object() calls used to access intrinsics as they
  will later perform a direct lookup without going through the global
  object
2022-08-23 13:58:30 +01:00
Linus Groh
e3895e6c80 LibJS: Pass Realm to define_native_{accessor,function}()
This is needed so that the allocated NativeFunction receives the correct
realm, usually forwarded from the Object's initialize() function, rather
than using the current realm.
2022-08-23 13:58:30 +01:00
Linus Groh
7c468b5a77 LibJS: Pass Realm to GlobalObject::initialize_global_object()
Global object initialization is tightly coupled to realm creation, so
simply pass it to the function instead of relying on the non-standard
'associated realm' concept, which I'd like to remove later.

This works essentially the same way as regular Object::initialize() now.

Additionally this allows us to forward the realm to GlobalObject's
add_constructor() / initialize_constructor() helpers, so they set the
correct realm on the allocated constructor function object.
2022-08-23 13:58:30 +01:00
Linus Groh
b465f46e00 LibJS: Remove GlobalObject parameter from native functions 2022-08-23 13:58:30 +01:00
Linus Groh
25849f8a6d LibJS: Replace GlobalObject with VM in common AOs [Part 18/19] 2022-08-23 13:58:30 +01:00
Linus Groh
ae9e031f56 LibJS: Replace GlobalObject with VM in Reference AOs [Part 6/19] 2022-08-23 13:58:30 +01:00
Linus Groh
a022e548b8 LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
This is where the fun begins. :^)
2022-08-23 13:58:30 +01:00
Linus Groh
f9705eb2f4 LibJS: Replace GlobalObject with VM in Intl AOs [Part 1/19]
Instead of passing a GlobalObject everywhere, we will simply pass a VM,
from which we can get everything we need: common names, the current
realm, symbols, arguments, the heap, and a few other things.

In some places we already don't actually need a global object and just
do it for consistency - no more `auto& vm = global_object.vm();`!

This will eventually automatically fix the "wrong realm" issue we have
in some places where we (incorrectly) use the global object from the
allocating object, e.g. in call() / construct() implementations. When
only ever a VM is passed around, this issue can't happen :^)

I've decided to split this change into a series of patches that should
keep each commit down do a somewhat manageable size.
2022-08-23 13:58:30 +01:00
Linus Groh
f3117d46dc LibJS: Remove GlobalObject from VM::throw_completion()
This is a continuation of the previous five commits.

A first big step into the direction of no longer having to pass a realm
(or currently, a global object) trough layers upon layers of AOs!
Unlike the create() APIs we can safely assume that this is only ever
called when a running execution context and therefore current realm
exists. If not, you can always manually allocate the Error and put it in
a Completion :^)

In the spec, throw exceptions implicitly use the current realm's
intrinsics as well: https://tc39.es/ecma262/#sec-throw-an-exception
2022-08-23 13:58:30 +01:00
Linus Groh
b99cc7d050 LibJS+LibWeb: Replace GlobalObject with Realm in create() functions
This is a continuation of the previous two commits.

As allocating a JS cell already primarily involves a realm instead of a
global object, and we'll need to pass one to the allocate() function
itself eventually (it's bridged via the global object right now), the
create() functions need to receive a realm as well.
The plan is for this to be the highest-level function that actually
receives a realm and passes it around, AOs on an even higher level will
use the "current realm" concept via VM::current_realm() as that's what
the spec assumes; passing around realms (or global objects, for that
matter) on higher AO levels is pointless and unlike for allocating
individual objects, which may happen outside of regular JS execution, we
don't need control over the specific realm that is being used there.
2022-08-23 13:58:30 +01:00
Tim Schumacher
4889eb019a strace: Pledge rpath for searching binaries
After commit 91a03bc6ae we no longer try
to discover files for exec-ing by simply trying to exec on them, but we
check for the files existence by using `Core::file::exists()` first.

Contrary to the old solution, this now requires the `rpath` pledge, so
pledge it to keep `strace` from crashing when using non-absolute paths.
2022-08-20 12:28:46 +02:00
kleines Filmröllchen
e52a7663ce Utilities/file: Handle all supported audio MIME types 2022-08-16 13:58:51 +01:00
Lucas CHOLLET
4f87f03bd1 Base: Launch AudioServer at session start-up 2022-08-14 21:52:35 +01:00
Liav A
c85f81bc9d Utilities/lsblk: Remove Interface Type column
We are going to remove this slice of data from the SysFS later on, so
lsblk must not try to read it.
2022-08-14 01:09:03 +01:00
Andreas Kling
50d951aea2 LibJS: Let Shape store a Realm instead of a GlobalObject
This is a cautious first step towards being able to create JS objects
before a global object has been instantiated.
2022-08-05 12:42:46 +02:00
Andreas Kling
69a45adfbe LibWeb: Remove page_did_set_document_in_top_level_browsing_context()
This PageClient callback was never used for anything.
2022-08-05 12:42:46 +02:00
networkException
2cdc7c4ca0 wallpaper: Add pledge promises 2022-08-02 04:04:08 +00:00
networkException
85b133d47f Utilities+Base: Rename pape utility to wallpaper 2022-08-02 04:04:08 +00:00
Andreas Kling
548081ea23 Userland+Base: Make the window titlebar font configurable separately
Instead of defaulting to "bold variant of the system default font",
let's allow the user to set any font they want as the titlebar font.
2022-08-01 10:29:53 +02:00
Liav A
aea3213d51 Utilities/lsusb: Allow the utility to work without existing USB IDs file
In case we failed to open /res/usb.ids or the user requested to not use
that file, we simply don't try to resolve the USB IDs and print them
without any identification.
2022-07-28 04:28:25 -07:00
MacDue
281e46e8b3 grep: Fix out of bounds StringView indexing
This is another case of out of bounds indexing exposed by 13406b8.
2022-07-27 22:51:54 +00:00
Undefine
97cc33ca47 Everywhere: Make the codebase more architecture aware 2022-07-27 21:46:42 +00:00
MacDue
9d0dccaa3f less: Fix out of bounds StringView indexing
This fixes indexing the StringView before knowing if the index
is valid. This did not crash until the changes from 13406b8
which added runtime checks for StringView indexing.
2022-07-27 05:34:41 -07:00
Tim Schumacher
25e6ad8d3e chown: Implement recursion 2022-07-25 23:52:46 +01:00
Tim Schumacher
7b7c9a2194 chown: Add support for multiple file paths 2022-07-25 23:52:46 +01:00
Tim Schumacher
864221cb02 ln: Implement correct handling of directories as link targets 2022-07-25 22:21:01 +01:00
Tim Schumacher
26d4a44a0f ln: Rework to use LibCore syscall wrappers 2022-07-25 22:21:01 +01:00
Tim Schumacher
a031b7a174 chmod: Implement the --recursive flag 2022-07-25 15:32:46 +02:00
Tim Schumacher
0329a644f8 chmod: Port to ArgsParser 2022-07-25 15:32:46 +02:00
Tim Schumacher
480ba792e3 du: Consolidate all "do not print" conditions
All of these conditions should make du just not report the file size
individually, but it should still count them into the grand total.

In the case of the `--threshold` option, this was actually implemented
incorrectly before, as it would report size 0 for files that did not
match the threshold.
2022-07-24 13:32:51 +01:00
Tim Schumacher
e4cdc7f685 du: Only use unmodified file sizes internally
This keeps us from repeatedly applying the block size calculation on
already processed values.
2022-07-24 13:32:51 +01:00
Tim Schumacher
9af302920a du: Use 64-bit integers when handling file sizes or related values
We may very well dip into files larger than 4G at some point, so 32-bit
values are not enough, and the 64-bit sized `off_t` doesn't fully make
sense either, as it features negative values.

Instead, switch to the explicit type of `u64` everywhere, which is the
same size on all platforms and is unsigned. The exception to this is
the threshold, which needs to be signed instead of unsigned.
2022-07-24 13:32:51 +01:00
Tim Schumacher
c1ab29b73c du: Fix a typo in the --exclude-from option 2022-07-24 13:32:51 +01:00
Tim Schumacher
6b270f7d01 du: Don't stop descending even if the maximum depth is reached
The `--max-depth` option only controls until which depth individual file
sizes are printed, it does not stop the utility from traversing that
branch further (as the file sizes would be wrong otherwise).

Restructure the program to track the current depth, and return early if
the current depth is higher than the maximum allowed depth, which skips
all parts of the logic that are concerned with user output.
2022-07-24 13:32:51 +01:00
Itamar
db11cfa2c5 Utilities+LibELF: Temporary promises for dynamic linker in "pledge"
This adds a "temporary promises for the dynamic-linker" flag ('-d')
to the "pledge" utility.

Example usage:
pledge -d -p "stdio rpath" id

Without the '-d' flag, id would crash because the dynamic linker
requires 'prot_exec'.

When this flag is used and the program to be run is dynamically linked,
"pledge" adds promises that are required by the dynamic linker
to the promise set provided by the user.

The dynamic linker will later "give up" the pledge promises it no
longer requires.
2022-07-21 16:40:11 +02:00
Tim Schumacher
d270c57022 du: Implement the 1k block size short option 2022-07-21 16:37:04 +02:00
Tim Schumacher
220a50111a du: Invert apparent-size behaviour
The apparent size is what `stat` says what we use. The non-apparent size
is the blocks that we actually use on-disk.
2022-07-21 16:37:04 +02:00
Tim Schumacher
d2d6e7835e du: Implement custom block sizes 2022-07-21 16:37:04 +02:00
Tim Schumacher
c938321731 du: Replace home-grown block-based size calculation with ceil_div 2022-07-21 16:37:04 +02:00
Ali Mohammad Pur
4387ad9fc6 js: Don't pass error strings as the format argument to outln()
This fixes a crash when the error contains '{}', or an invalid format
string.
2022-07-20 21:25:59 +01:00
kleines Filmröllchen
3f59356c79 LibAudio: Rename ConnectionFromClient to ConnectionToServer
The automatic nomenclature change for IPC sockets got this one wrong.
2022-07-19 11:17:45 +01:00