Commit Graph

959 Commits

Author SHA1 Message Date
dayarthvader
67b7bbe1f6 ping: Handle optional field in the IPv4 header 2022-01-22 22:11:21 +00:00
Idan Horowitz
bb340f1272 markdown-check: Ignore absolute icon paths
We have no good way to handle these yet, and there's no point in
forcing everyone to skip their pre-commit checks.
2022-01-22 21:40:09 +02:00
Federico Guerinoni
e37af0b073 umount: Port to LibMain 2022-01-22 13:31:52 +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
davidot
0e56dac51e js: Display a warning if multiple files are given
Also instead of making a frankenstein path with all the paths combined
just take the first one, this is needed for resolving modules.
2022-01-22 01:21:18 +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
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
Jean-Baptiste Boric
736af8c7da groups: Do not attempt to open /etc/groups 2022-01-21 22:10:23 +01:00
Jean-Baptiste Boric
7fe7eab308 pwd: Add missing rpath pledge 2022-01-21 22:10:23 +01:00
David Lindbom
2ed4e47300 zip: Add unveil and pledge promises 2022-01-21 02:00:53 +01:00
David Lindbom
9d7a862509 cal: Add unveil and pledge promises 2022-01-21 02:00:53 +01:00
David Lindbom
5c74e66f85 aplay: Add unveil and pledge promises 2022-01-21 02:00:53 +01:00
mjz19910
2cf02c6f38 adjtime: Port to LibMain 2022-01-21 01:52:22 +01:00
Nico Weber
013799a4dd LibCrypto+LibJS: Better bigint bitwise_or binop
Similar to the bitwise_and change, but we have to be careful to
sign-extend two's complement numbers only up to the highest set bit
in the positive number.
2022-01-18 20:04:06 +03:30
Rummskartoffel
487377d1d7 disasm: Don't fail when trying to disassemble empty files
Given an empty file, disasm would try to create a zero-size memory
mapping of that file, which would fail with EINVAL.
2022-01-18 09:08:14 +01:00
Rummskartoffel
0aa5725f72 disasm: Convert to east-const and C++-style casts 2022-01-18 09:08:14 +01:00
Thijs Waalen
6210f62b1d readelf: Fall back to default interpreter path on empty path
This fixes readelf failing to map the interpreter for dynamic
libraries. When an ELF does not have the PT_INTERP header the
StringView will be of the inline capacity of the StringBuilder, not a
null StringView. This would cause readelf not to fallback on the
default interpreter path.
2022-01-16 22:36:06 -08:00
davidot
a5b11f7484 LibJS: Fix that '_' no longer accessed the last value in the REPL
This is now also not a concept that VM knows about and handled
completely by the REPL.
2022-01-16 14:57:12 +01:00
Kenneth Myhra
b76c66a9ed groupadd: Port to LibMain and use the new Core::Group abstraction :^) 2022-01-16 11:19:07 +01:00
Kenneth Myhra
294cbb7108 nc: Port to LibMain 2022-01-15 22:01:07 +01:00
Rummskartoffel
4aaab80649 unzip: Don't fail from mmap when trying to decompress empty files
Given an empty file, unzip would try to create a zero-size memory
mapping of that file, which would fail with EINVAL. With this commit,
attempting to unzip an empty file of course still fails, since that's
not a valid PKZIP file, but it now fails for the correct reason and with
the correct error message.
2022-01-15 22:24:19 +02:00
Timothy Flynn
58ccca6a9d LibJS+js: Pretty-print Date objects using the ToDateString AO 2022-01-15 20:13:48 +01:00
sin-ack
2e1bbcb0fa LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServer
This change unfortunately cannot be atomically made without a single
commit changing everything.

Most of the important changes are in LibIPC/Connection.cpp,
LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp.

The notable changes are:
- IPCCompiler now generates the decode and decode_message functions such
  that they take a Core::Stream::LocalSocket instead of the socket fd.
- IPC::Decoder now uses the receive_fd method of LocalSocket instead of
  doing system calls directly on the fd.
- IPC::ConnectionBase and related classes now use the Stream API
  functions.
- IPC::ServerConnection no longer constructs the socket itself; instead,
  a convenience macro, IPC_CLIENT_CONNECTION, is used in place of
  C_OBJECT and will generate a static try_create factory function for
  the ServerConnection subclass. The subclass is now responsible for
  passing the socket constructed in this function to its
  ServerConnection base; the socket is passed as the first argument to
  the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before
  any other arguments.
- The functionality regarding taking over sockets from SystemServer has
  been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket
  implementation of this functionality hasn't been deleted due to my
  intention of removing this class in the near future and to reduce
  noise on this (already quite noisy) PR.
2022-01-15 13:29:48 +03:30
alexmajor
67473085a1 Utilities: Port ifconfig to LibMain 2022-01-14 21:38:38 +01:00
kleines Filmröllchen
4d3a5c21b0 Utilities/aplay: Print progress in seconds and minutes by default
By default, aplay now prints the played time, the remaining time and the
total duration of the file in seconds and minutes. This is much more
intuitive. The old sample-based format is kept and hidden behind the -s
flag.
2022-01-14 21:37:23 +01:00
kleines Filmröllchen
8467327807 Utilities/aplay: Print format name under "Format"
This is not only nice to see, but it additionally tells developers that
the correct loader plugin was selected.
2022-01-14 21:37:23 +01:00
Lucas CHOLLET
8bc1a9e946 hostname: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
63466d385c host: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
dbcccde062 hexdump: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
02cb34a48a head: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
5ac52d0e4c gunzip: Remove StringView assignment on rhs-value 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
80a1ab3487 gunzip: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
c2e7acc8bb grep: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
9e1e80954b gml-format: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
f862fabe6e false: Port to LibMain 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
affef5d1a9 disasm: Port to LibMain 2022-01-14 19:42:19 +02:00
kleines Filmröllchen
be6418cc50 Everywhere: Use my new serenityos.org e-mail :^) 2022-01-14 11:54:09 +01:00
Idan Horowitz
cfb9f889ac LibELF: Accept Span instead of Pointer+Size in validate_program_headers 2022-01-13 22:40:25 +01:00
Idan Horowitz
3e959618c3 LibELF: Use StringBuilders instead of Strings for the interpreter path
This is required for the Kernel's usage of LibELF, since Strings do not
expose allocation failure.
2022-01-13 22:40:25 +01:00
Timothy Flynn
27c845eef2 js: Pretty-print the Intl.DisplayNames [[LanguageDisplay]] internal slot 2022-01-13 13:43:57 +01:00
sin-ack
aedb013ee3 LibIMAP+Userland: Convert LibIMAP::Client to the Serenity Stream APIs
You now cannot get an unconnected LibIMAP::Client, but you can still
close it. This makes for a nicer API where we don't have a Client object
in a limbo state between being constructed and being connected.

This code still isn't as nice as it should be, as TLS::TLSv12 is still
not a Core::Stream::Socket subclass, which would allow for consolidating
most of the TLS/non-TLS code into a single implementation.
2022-01-13 15:16:12 +03:30
sin-ack
53e9d757fe test-imap: Convert test-imap to LibMain 2022-01-13 15:16:12 +03:30
kleines Filmröllchen
9ec2b379a4 Meta: Fix Markdown linting
The new help://man links were linted incorrectly, and they're now
skipped by the markdown linter, such as in the pre-commit hook
2022-01-12 13:13:24 +01:00
Junior Rantila
0d328f3c86 LibCore+flock: Make Core::System::waitpid more ergonomic 2022-01-11 16:04:29 +01:00
kleines Filmröllchen
9e471353dd Meta: Convert new help page link styles for the man page website
The special URL links (help://man) and the application opening links now
work on the man page website. While the page links are translated
correctly, the application launch can't be implemented. For this reason,
an explanatory error page is shown instead.
2022-01-11 00:24:57 +01:00
Federico Guerinoni
9aa556fdf0 Userland: Port wasm to LibMain 2022-01-09 04:26:16 -08:00
Federico Guerinoni
05f0f70b00 Userland: Port tac to LibMain 2022-01-09 04:26:16 -08:00
Junior Rantila
abaee3a325 beep: Port to LibMain :^) 2022-01-09 11:16:00 +03:30
Michel Hermier
69cabb3ead Everywhere: Add serenity_dev_{makedev,major,minor}
Add them in `<Kernel/API/Device.h>` and use these to provides
`{makedev,major,minor}` in `<sys/sysmacros.h>`. It aims to be more in
line with other Unix implementations and avoid code duplication in user
land.
2022-01-09 00:58:44 +01:00
Linus Groh
eb60d16549 LibJS: Convert Interpreter::run() to ThrowCompletionOr<Value>
Instead of making it a void function, checking for an exception, and
then receiving the relevant result via VM::last_value(), we can
consolidate all of this by using completions.

This allows us to remove more uses of VM::exception(), and all uses of
VM::last_value().
2022-01-08 23:43:03 +01:00