Commit graph

51740 commits

Author SHA1 Message Date
Tim Ledbetter 089ff7b94e LibCore: Enable modification of a user's supplementary groups 2023-06-26 19:31:09 +02:00
Tim Ledbetter ba34931620 strings: Don't bail immediately on error
Previously, strings would exit immediately if there was an error
changing file ownership. We now print an error to stderr and
continue when an error occurs.
2023-06-26 19:28:42 +02:00
Tim Ledbetter c723101728 strings: Add -o option as an alias for -t o 2023-06-26 19:28:42 +02:00
Tim Ledbetter a2fb0768ff strings: Add commonly used long option names for -n and -t 2023-06-26 19:28:42 +02:00
Tim Ledbetter ab1e8a7b91 strings: Replace the -p option with the more commonly used -f
Previously, the `-p` option printed the path of the file being
processed before any strings for that file. The `-f` prints the file
path before each string . This matches the behavior of strings on
Linux and FreeBSD.
2023-06-26 19:28:42 +02:00
Tim Ledbetter 3de4cd0ba9 Base: Add man page for env 2023-06-26 19:27:45 +02:00
Tim Ledbetter 6aa87e2119 env: Add -u option to unset environment variables 2023-06-26 19:27:45 +02:00
Tim Ledbetter b9e7998b53 LibC: Return EINVAL from unsetenv() if input is empty or contains "=" 2023-06-26 19:27:45 +02:00
Shannon Booth d3a27eeaf2 LibDiff: Port Diff::Hunk from DeprecatedString to String
Removing the last instance of DeprecatedString in this library! :^)
2023-06-26 19:26:34 +02:00
Shannon Booth 9dc92f19b8 LibDiff: Port Diff::parse_hunks from DeprecatedString to StringView 2023-06-26 19:26:34 +02:00
Shannon Booth c60150da15 HackStudio: Use StringView in DiffViewer::draw_line 2023-06-26 19:26:34 +02:00
Shannon Booth ee92378b80 LibDiff: Make Diff::from_text fallible 2023-06-26 19:26:34 +02:00
Shannon Booth 23df5748f6 LibDiff: Make Diff::parse_hunks fallible
Currently the only error that can happen is an OOM. However, in the
future there may be other errors that this function may throw, such as
detecting an invalid patch.
2023-06-26 19:26:34 +02:00
Shannon Booth dbd838efdf LibDiff: Replace DeprecatedString with StringView in parse_hunk_location 2023-06-26 19:26:34 +02:00
Shannon Booth 84e8ff34a2 diff: Use StringView instead of DeprecatedString 2023-06-26 19:26:34 +02:00
Tim Ledbetter 96fecc434c chgrp: Add support for multiple file paths 2023-06-26 19:26:20 +02:00
Andi Gallo 8afe5ce718 LibWeb: Fix min-content initialization for row measures
This ensures that min-content contributions from cells with no content
are computed using their calculated values, which are never considered
for min-content before then. The specification diverges from column
measures algorithm, which doesn't use specified width of cells anywhere.
2023-06-26 19:25:34 +02:00
Daniel Bertalan 5aef8f280f LibJS: Fix integer overflow in Number::exponentiate
The exponent might be larger than the range of values representable by
an i32, so we have to use the `fmod` function instead of the modulo
operator.

This fixes 3 test262 tests on AArch64. No changes on x86-64.
2023-06-26 19:25:12 +02:00
Andreas Kling 56fb5a3f5d LibJS/Bytecode: Ensure iterator is closed after array destructuring
If destructuring didn't exhaust the iterator, we have to manually close
the iterator.

49 new passes on test262. :^)
2023-06-26 19:18:06 +02:00
Andreas Kling 55531e5cda LibJS/Bytecode: Use LHS identifier as function name on logical assign
This now creates a function named `x`:

    x ||= function() { }

9 new passes on test262. :^)
2023-06-26 16:07:33 +02:00
Andreas Kling 17ba47558c LibWeb: Make a copy of Document's DocumentObserver set when iterating
The observer callbacks can do all kinds of things, so let's not be in
the middle of iterating the set in case someone decides to mutate it.

Fixes a crash when loading https://lichess.org/
2023-06-26 12:10:33 +02:00
Timothy Flynn 6fb670c1c2 LibJS: Implement Iterator.prototype.find 2023-06-26 10:39:07 +02:00
Timothy Flynn 1f05b0638f LibJS: Implement Iterator.prototype.every 2023-06-26 10:39:07 +02:00
Timothy Flynn 6ac1d5afae LibJS: Implement Iterator.prototype.some 2023-06-26 10:39:07 +02:00
Timothy Flynn 134bb44ca0 LibJS: Implement Iterator.prototype.forEach 2023-06-26 10:39:07 +02:00
Timothy Flynn 35380b2aef LibJS: Implement Iterator.prototype.toArray 2023-06-26 10:39:07 +02:00
Timothy Flynn acc05480e8 LibJS: Implement Iterator.prototype.reduce 2023-06-26 10:39:07 +02:00
Timothy Flynn ad42b4ea67 LibJS: Implement Iterator.prototype.flatMap
This prototype is a bit tricky in that we need to maintain the iteration
state of the mapped iterator's inner iterator as we return values to the
caller. To do this, we create a FlatMapIterator helper to perform the
steps that apply to the current iteration state.
2023-06-26 10:39:07 +02:00
Timothy Flynn 67028ee3a3 LibJS: Implement Iterator.prototype.drop 2023-06-26 10:39:07 +02:00
Timothy Flynn 0e2f9f006d LibJS: Implement Iterator.prototype.take 2023-06-26 10:39:07 +02:00
Timothy Flynn 7e0083fb65 LibJS: Rename ErrorType::IntlNumberIsNaN to ErrorType::NumberIsNaN
It will be used outside of the Intl namespace, so give it a less overly
specific name.
2023-06-26 10:39:07 +02:00
Timothy Flynn deeee65e37 LibJS: Implement Iterator.prototype.filter 2023-06-26 10:39:07 +02:00
Timothy Flynn 3eb2e4e08a LibJS: Implement Iterator.prototype.map
This uses a new Iterator type called IteratorHelper. This does not
implement IteratorHelper.prototype.return as that relies on generator
objects (i.e. the internal slots of JS::GeneratorObject), which are not
hooked up here.
2023-06-26 10:39:07 +02:00
Timothy Flynn 7ff6b472c0 LibJS: Implement Iterator.prototype [ @@toStringTag ] 2023-06-26 10:39:07 +02:00
Timothy Flynn d9d245faa7 LibJS: Implement Iterator.from and the WrapForValidIteratorPrototype
Iterator.from creates an Iterator from either an existing iterator or
an iterator-like object. In the latter case, it sets the prototype of
the returned iterator to WrapForValidIteratorPrototype to wrap around
the iterator-like object's iteration methods.
2023-06-26 10:39:07 +02:00
Timothy Flynn 5736b53013 LibJS: Add an Iterator constructor and object
The Iterator object cannot be constructed directly but can be subclassed
or created with `Iterator.from` (not implemented here).
2023-06-26 10:39:07 +02:00
Timothy Flynn 428109e709 LibJS: Forward declare IteratorRecord and remove inclusion from VM.h
This drastically reduces the amount of compilation required when
Iterator.h is changed.
2023-06-26 10:39:07 +02:00
Timothy Flynn 4977000fa0 LibJS: Rename JS::Iterator to JS::IteratorRecord
This is in preparation for an upcoming implementation of the Iterator
Helpers proposal. That proposal will require a JS::Object type named
"Iterator", so this rename is to avoid conflicts.
2023-06-26 10:39:07 +02:00
Andrew Kaster cd2a6767bc AK: Never use assert() when targeting Windows platforms
The Windows CRT definition of assert() is not noreturn, and causes
compile errors when using it as the backing for VERIFY() in debug
configurations of applications like the Jakt compiler.
2023-06-26 05:09:00 +02:00
Luke Wilde c5f3b3ae02 LibJS/Bytecode: Return the proper result for iteration statements 2023-06-26 04:58:27 +02:00
Luke Wilde b162c9117e LibJS/Bytecode: Set accumulator to undefined at start of catch blocks
Otherwise we leak the error value through to the result.
2023-06-26 04:58:27 +02:00
Zaggy1024 1789905d4a LibVideo/PlaybackManager: Don't crash when demuxer seek throws an error
`seek_demuxer_to_most_recent_keyframe()` wasn't correctly returning in
cases where an error was thrown by the demuxer. To avoid this, the
function now returns the error, and the playback state handler must act
on it instead, allowing it to exit the seeking state early.
2023-06-25 20:35:37 -04:00
Zaggy1024 b94c132dd1 Tests/LibVideo: Add a test for Matroska files containing CRC32 elements 2023-06-25 20:27:02 -04:00
Zaggy1024 cf1cb04af0 LibVideo/Matroska: Don't choke on files containing CRC32 elements
The EBML specification allows for CRC32 elements to be placed as the
first child element of a master element. However, our parsing of master
elements didn't take that into account, so an error would be thrown.

Instead of erroring out, the `parse_master_element()` function will now
skip CRC32 elements that are found as the first child of a master
element. If it is found after the first child, that will be considered
an error.

Void elements will also be skipped by `parse_master_element()`.

Since the `parse_cluster()` function has to seek the stream back to the
cluster's first child in order to allow cues' positions to be used
correctly, `parse_master_element()` had to be changed to return the
first element position, since the callback is not invoked for CRC32
elements. This means that the parameter used to communicate the element
position to the child element parsing function is unused, so that is
removed.
2023-06-25 20:27:02 -04:00
Andreas Kling a4a1d1b84a LibJS/Bytecode: Transfer object expression property names to functions
2 new passes on test262. :^)
2023-06-25 20:39:29 +02:00
Andreas Kling ad15a1e3e2 LibJS/Bytecode: Don't assert on eval() without arguments
3 new passes on test262. :^)
2023-06-25 19:41:53 +02:00
Andreas Kling ceb5199225 LibJS/Bytecode: Don't clobber accumulator in Put/Delete instructions
The fact that side effects clobbers the accumulator isn't just annoying
inside the instruction handler, but also really counter-intuitive in
the bytecode program itself.

17 new passes on test262. :^)
2023-06-25 19:14:30 +02:00
Andreas Kling 8450948458 LibJS: Make class definition evaluation work in bytecode mode
Instead of assuming that there's an active AST interpreter, this code
now takes VM& everywhere and invokes the appropriate interpreter.

92 new passes on test262. :^)
2023-06-25 18:28:44 +02:00
Andreas Kling 66936a0d61 LibJS/Bytecode: Fix non-string keys not being excluded in rest object
By converting the excluded names to PropertyKey before filtering, we
ensure that non-string keys get excluded as needed.

14 new passes on test262. :^)
2023-06-25 18:02:37 +02:00
Andreas Kling 6f0952c358 LibJS/Bytecode: Handle object destructuring to member expression
19 new passes on test262. :^)
2023-06-25 17:00:29 +02:00