Commit graph

1317 commits

Author SHA1 Message Date
networkException 4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
demostanis a194303948 less: Show correct line number
This patch makes less start at line 1 instead of 0.
2022-09-28 09:42:40 +01:00
demostanis 505910aea1 less: Properly stop on EOF 2022-09-28 09:42:40 +01:00
Lucas CHOLLET e1edd620ee pls: Use LibCore::Account::login() instead of manually setting the uid
In addition to changing the uid, the method also changes the gid and
properly sets groups. So this patch will also mitigate the security
issue of `pls`.
2022-09-28 00:35:36 +01:00
Lucas CHOLLET 8fabe9a3ad LibCore: Propagate errors from LibCore::Account::login() 2022-09-27 21:29:44 +01:00
Lucas CHOLLET 6900c4fe29 su: Add the --login option
This option, often used with only a lonely dash, allows to "simulate a
login". For now, it just changes the current directory to the home of
the new user.
2022-09-27 21:29:44 +01:00
Lucas CHOLLET 507cb411c2 LibCore: Use StringView instead of char * in Account 2022-09-27 21:29:44 +01:00
Thomas Voss 80b56ced93 Meta: Update my email-address 2022-09-27 15:15:36 +01:00
Sam Atkins fb2e1c4611 headless-browser: Install EventLoop and Font plugins so it doesn't crash 2022-09-21 20:42:36 +01:00
Andreas Kling cd7262ee56 LibWeb+LibWebView+WebContent: Add Web::Platform::ImageCodecPlugin
This replaces the previous Web::ImageDecoding::Decoder interface.
While we're doing this, also move the SerenityOS implementation of this
interface from LibWebView to WebContent. That means we no longer have to
link with LibImageDecoderClient in applications that use a web view.
2022-09-16 15:15:50 +02:00
demostanis 847577bea2 uniq: Improve POSIX compliance
Adds -d, -c, -i, -f and -s options.
It differs a little bit from other implementations,
but it does the trick and corresponds to POSIX's description
2022-09-09 14:11:52 +01:00
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