Commit graph

26398 commits

Author SHA1 Message Date
Andreas Kling dc884aa0d3 LibJS/Bytecode: Remove unnecessary variable environment stack
The var environments will unwind as needed with the ExecutionContext
and there's no need to include it in the unwind info.

We still need to do this for lexical environments though, since they
can have short local lifetimes inside a function.
2023-07-02 18:30:02 +02:00
Niklas Lahnstein e2b0cacb89 3DFileViewer: Properly handle ENOENT errors 2023-07-02 17:35:35 +02:00
Niklas Lahnstein 8534506ab0 3DFileViewer: Use ArgsParser 2023-07-02 17:35:35 +02:00
stelar7 0fc73679f1 LibTLS: Fix typo in ecdsa_sha512 OID 2023-07-02 16:13:37 +02:00
stelar7 77080fbade LibTLS: Rename parse_version to parse_certificate_version
This is not a generic version, but specifically for certificates.
2023-07-02 16:13:37 +02:00
Torstennator 0c95564533 PixelPaint: FilterGallery fix preview
This patch fixes an issue where the preview for an filter was always
based on the content bitmap even if the edit mode was set to Mask.
Now the preview is using the content or mask bitmap based on the
current edit mode and therefore generates the correct preview of
what is going to be changed.
2023-07-02 15:23:42 +02:00
Torstennator d9d9103cbb PixelPaint: Start using Editing-Masks for some tools
This patch starts to integrate the usage of Editing-Masks for the
following tools: Spray-Tool, Brush-Tool and Erase-Tool
2023-07-02 15:23:42 +02:00
Torstennator 0a120e239a PixelPaint: Remove todo from LevelDialog
This patch removes a todo where the revert for any changes could be
optimized. Previously every single pixel was copied back from the
reference bitmap to the content bitmap. Now the editors content
bitmap is just replaced with the reference bitmap that is a copy
of the unchanged content bitmap.
2023-07-02 15:23:42 +02:00
Torstennator 1f31e72843 PixelPaint: LevelDialog enhancements
This patch adds the ability to apply slider changes only to regions
where a editing-mask was drawn.
2023-07-02 15:23:42 +02:00
Torstennator e3509efc1b PixelPaint: Introduce new mask features
This patch adds a new Editing-Mask type to layers. This kind of mask
is used to restrict changes on the content bitmap only to areas where
the mask is drawn. The intensity of a pixel change is controlled by the
alpha-value of the mask.

Furthermore a function to invert and clear masks has been introduced.
When a new mask is created for a layer the edit mode of the layer is
also changed to Mask so that the user can immediately start to draw the
mask.
2023-07-02 15:23:42 +02:00
Ali Mohammad Pur 7e5f1fa895 LibLine: Defer handling SIGWINCH and SIGINT
Performing these immediately can introduce a race condition between the
user's signal-related logic and LibLine's own, so defer the handlers to
make sure they run when our terminal IO cannot interfere with the
user's.
2023-07-02 16:27:52 +03:30
Andreas Kling fb979dcf34 LibJS/Bytecode: Make Bytecode::Interpreter participate in GC marking
Since the relationship between VM and Bytecode::Interpreter is now
clear, we can have VM ask the Interpreter for roots in the GC marking
pass. This avoids having to register and unregister handles and
MarkedVectors over and over.

Since GeneratorObject can also own a RegisterWindow, we share the code
in a RegisterWindow::visit_edges() helper.

~4% speed-up on Kraken/stanford-crypto-ccm.js :^)
2023-07-02 14:50:02 +02:00
Andreas Kling cea2071349 LibJS/Bytecode: Infer name of anonymous exported classes when possible
5 new passes on test262. :^)
2023-07-02 12:18:25 +02:00
Andreas Kling b0ae1e80fb LibJS/Bytecode: Support using MemberExpression as rest property
Also, don't assert while dumping an AST with this construct.

7 new passes on test262. :^)
2023-07-02 11:53:10 +02:00
Daniel Bertalan 0df7255fe7 LibJS/Bytecode: Do not clobber completion value with VariableDeclaration
While the completion value of a variable declaration is specified to be
empty, we might already have a completion value in the accumulator from
a previous statement. Preserve it so as to avoid clobbering it.

This fixes 6 tests on test262.
2023-07-02 10:54:35 +02:00
Andreas Kling bd2c3ace68 LibJS/Bytecode: Make sure empty with statement results in undefined
2 new passes on test262. :^)
2023-07-02 10:54:28 +02:00
kleines Filmröllchen 8ba4036bba Base: Add accept(2) man page
This man page was referenced from some places. This is mostly a
condensed version of the POSIX behavior that the system call
implementation already has, only documenting the obviously visible
errors (in source code) we do actually report.
2023-07-02 02:29:09 +02:00
kleines Filmröllchen 6cddee98a9 LibAudio: Don't overread MP3 granule samples if big_values is too large
There are at most 576 granule samples/frequency lines, but the side data
can specify that the big_values granule type take up to 1024 samples.
The spec says in 2.4.3.4.6 that we should always stop reading Huffman
data once we have 576 samples, so that is what this change does. I also
add some useful spec comments while I'm here.
2023-07-02 02:15:32 +02:00
kleines Filmröllchen 53785a9206 LibAudio: Handle bitstream errors in MP3 Huffman decode 2023-07-02 02:15:32 +02:00
MacDue 40fa07a6e1 LibWeb: Force paintable to exist for SVG <g> elements
This (along with the previous commit) fixes the missing tears on the
sad Duolingo owl.
2023-07-02 01:31:18 +02:00
MacDue 7d26383426 LibWeb: Remove SVGContext
The SVGContext is a leftover from when SVG properties were more ad-hoc.
All properties are now (for better or worse) treated as CSS properties
(or handled elsewhere). This makes the SVGContext's fill/stroke
inheritance handling unnecessary.
2023-07-02 01:31:18 +02:00
Liav A 23a7ccf607 Kernel+LibCore+LibC: Split the mount syscall into multiple syscalls
This is a preparation before we can create a usable mechanism to use
filesystem-specific mount flags.
To keep some compatibility with userland code, LibC and LibCore mount
functions are kept being usable, but now instead of doing an "atomic"
syscall, they do multiple syscalls to perform the complete procedure of
mounting a filesystem.

The FileBackedFileSystem IntrusiveList in the VFS code is now changed to
be protected by a Mutex, because when we mount a new filesystem, we need
to check if a filesystem is already created for a given source_fd so we
do a scan for that OpenFileDescription in that list. If we fail to find
an already-created filesystem we create a new one and register it in the
list if we successfully mounted it. We use a Mutex because we might need
to initiate disk access during the filesystem creation, which will take
other mutexes in other parts of the kernel, therefore making it not
possible to take a spinlock while doing this.
2023-07-02 01:04:51 +02:00
kleines Filmröllchen b4fbd30b70 AudioServer+Userland: Decouple client sample rates from device rate
This change was a long time in the making ever since we obtained sample
rate awareness in the system. Now, each client has its own sample rate,
accessible via new IPC APIs, and the device sample rate is only
accessible via the management interface. AudioServer takes care of
resampling client streams into the device sample rate. Therefore, the
main improvement introduced with this commit is full responsiveness to
sample rate changes; all open audio programs will continue to play at
correct speed with the audio resampled to the new device rate.

The immediate benefits are manifold:
- Gets rid of the legacy hardware sample rate IPC message in the
  non-managing client
- Removes duplicate resampling and sample index rescaling code
  everywhere
- Avoids potential sample index scaling bugs in SoundPlayer (which have
  happened many times before) and fixes a sample index scaling bug in
  aplay
- Removes several FIXMEs
- Reduces amount of sample copying in all applications (especially
  Piano, where this is critical), improving performance
- Reduces number of resampling users, making future API changes (which
  will need to happen for correct resampling to be implemented) easier

I also threw in a simple race condition fix for Piano's audio player
loop.
2023-07-01 23:27:24 +01:00
Sebastian Zaha d52a2ff10e LibGfx: Fix error & crash in Rect::closest_to
Assertion fails if the point is outside of the rect. This was introduced
in introduced in #18970 and causes serenity to crash when changing to 2x
resolution for a monitor, if the cursor after resizing is outside of
the new screen.

Added test to reproduce.
2023-07-01 23:27:00 +02:00
Andreas Kling 0cb9c9e81e LibJS: Add fast paths for bitwise ops on 2x Int32 JS::Value
~9% speed-up on Kraken/stanford-crypto-aes.js :^)
2023-07-01 20:29:12 +01:00
Andreas Kling 1efe4b58aa LibJS/Bytecode: Store current interpreter register window as a Span
This avoids a bunch of indirections on every single register access.

~17% speed-up on Kraken/stanford-crypto-aes.js :^)
2023-07-01 20:29:12 +01:00
Shannon Booth e7435d68b0 LibJS: Extract named vm variables in ArrayBufferPrototype::slice 2023-07-01 16:55:17 +01:00
Shannon Booth 3781948f0c LibJS: Add initial implementation for SharedArrayBuffer
None of the actual sharing is implemented yet, but this is enough for
most basic functionality.

Diff Tests:
    +260     -262    +2 💀
2023-07-01 16:55:17 +01:00
Ali Mohammad Pur 1c1aa2c0d0 Shell: Handle (most) errors in the parsers
This turns all errors into either "OOM" or a proper shell error (if
propagation is impossible or meaningless).
Fixes `echo -en '\xfe\x4a' | $SHELL` crashing.
2023-07-01 17:01:54 +03:30
Andreas Kling 3f022f4040 LibWeb: Treat non-finite containing block width as zero for percentages
Fixes an assertion when loading https://bun.sh/
2023-07-01 09:06:49 +02:00
Haikal Zain bf16618fba LibWeb: Add vertical border heights to tr
tr y offset is not being computed correctly.
This is causing errors in hit testing since
td and tr are misaligned.
2023-07-01 08:07:49 +02:00
Andi Gallo 6b649af447 LibWeb: Fix inset shadow with zero offset and blur
Before this change, we only blurred the shadows which would've been
generated without blur. This meant that we didn't generate a shadow when
the offset was zero, even with blur. However, other browsers generate a
shadow when blur is set.

Instead, always generate a rectangular contour of sufficient thickness,
blur it if needed and blit it into the right position at the very end.
Thanks to the blur radius, we'll have a shadow even when the offset is
zero.
2023-07-01 07:48:33 +02:00
Andrew Kaster 31440687a3 LibJS: Check the ASAN fake stack for heap pointers when ASAN is enabled
This is a similar strategy to what v8 does. Use the ASAN API function
__asan_addr_is_in_fake_stack to check any fake stack frames associated
with each stack address we scan. This fully allows running test-js -g
with the option detect_stack_use_after_return turned on.
2023-07-01 07:03:11 +02:00
Daniel Bertalan 96b197ef46 LibJS/Temporal: Perform floating point arithmetic in RoundTime
The valid range for temporal values (`nsMinInstant`/`nsMaxInstant`)
means performing nanosecond-valued integers could lead to an overflow.

NB: Only the `roundingMode: "day"` case was affected, as all others were
already performing the division on floating-point `fractional_second`
values. I'm adding `.0` suffixes everywhere to make this fact clearer.

This adds a few local tests as well, as those are tested with sanitizers
enabled by default, unlike test262.
2023-07-01 06:51:25 +02:00
Daniel Bertalan 1dce1994eb LibJS: Make the options arg of InterpretTemporalDateTimeFields nullable
This fixes "reference binding to null pointer" UBSan warnings.
2023-07-01 06:51:25 +02:00
PrestonLTaylor 850c252b3e LibJS: Implement ArrayBuffer.prototype.transfer & transferToFixedLength 2023-06-30 23:23:15 +02:00
PrestonLTaylor 34c5d34b95 LibJS: Show when an ArrayBuffer is detached when printing 2023-06-30 23:23:15 +02:00
PrestonLTaylor 286bf307d2 LibJS: Don't crash when calling byte_length for a detached ArrayBuffer 2023-06-30 23:23:15 +02:00
Sam Atkins 8c50d5d248 LibWeb: Remove misleading log message about unimplemented functions
`parse_a_calc_function_node()` only detects math functions, but
regularly encounters unrelated functions like `rgba()`. Since we now
support all the math functions, this message is just misleading spam.
2023-06-30 14:39:36 +01:00
Sam Atkins d0808e5d94 LibWeb: Correct @font-face debug log messages 2023-06-30 14:39:36 +01:00
PrestonLTaylor bd0ccbe3c8 LibJS: Implement the ArrayBuffer.prototype.detached getter 2023-06-30 12:47:15 +01:00
Zaggy1024 8157bb601b LibWeb: Place the unique task source used by media elements last
In the merging of an extremely large navigables PR, a task queue source
was added after the unique task source start value that was supposed to
remain last in the enum.
2023-06-30 12:52:46 +02:00
Andreas Kling 854b114c04 LibWeb: Use the script's own URL as filename for fetched classic script
This makes JS backtraces actually show the filename of scripts correctly
again (instead of the URL of the document that loaded them).
2023-06-29 12:07:11 +02:00
Daniel Bertalan 18c735429f LibJS: Fix incorrect is_function() check in NewPromiseCapability
I introduced this copy-paste mistake in c21255d.

Gets rid of 7 assertion failures on test262.
2023-06-29 08:43:28 +02:00
Aliaksandr Kalenik 1550e7c421 LibJS: Stop using execute_ast_node in NewClass instruction
This change replaces usage of `execute_ast_node` to evaluate super
expression in NewClass by generating instructions instead.
2023-06-29 07:14:14 +02:00
Andi Gallo d33b99dd24 LibWeb: Check whether table box width is auto when resolving cell width
Computing the table width algorithm bifurcates based on whether
table-root width is auto. We only adjust the used table width based on
cell percentage widths on the auto branch, thus the same check is needed
when we initialize cell widths.
2023-06-29 05:37:34 +02:00
Hendiadyoin1 37067cf3ca LibJS: Use the IdentifierTable for NewFunction and NewClass lhs names
This makes them trivially copyable, which is an assumption multiple
optimizations use when rebuilding the instruction stream.

This fixes most optimized crashes in the test262 suite.
2023-06-29 05:32:08 +02:00
Daniel Bertalan c21255da7f LibJS: Align NewPromiseCapability with spec changes
See https://github.com/tc39/ecma262/commit/874ecf9

After this refactoring, we now correctly handle non-function /
non-undefined objects being passed multiple times: instead of skipping
assignment to promiseCapability altogether and failing with a
NotAFunction error in the end; on the second time the executor closure
is called, we return GetCapabilitiesExecutorCalledMultipleTimes.

This fixes the 7 `capability-executor-called-twice.js` test262 tests.
2023-06-28 23:36:15 +01:00
Shannon Booth 0748e755d8 LibJS: Implement SetValueInBuffer closer to spec
No functional changes intended, mostly just adding spec comments, along
with some asserts.
2023-06-28 23:18:39 +01:00
Shannon Booth fe479ffd66 LibJS: Add spec comment for [[ArrayBufferData]]
I have found myself needing to grep around for this one a bunch.
2023-06-28 23:18:39 +01:00