Commit graph

56251 commits

Author SHA1 Message Date
Tim Schumacher a2f60911fe AK: Rename GenericTraits to DefaultTraits
This feels like a more fitting name for something that provides the
default values for Traits.
2023-11-09 10:05:51 -05:00
Andreas Kling ac23ab42b3 LibJS/JIT: Add fast path for cached GetById 2023-11-09 16:02:14 +01:00
Andreas Kling 55e467c359 LibJS/JIT: Add fast path for cached PutById 2023-11-09 16:02:14 +01:00
Andreas Kling b1b2ca1485 LibJS: Add basic monomorphic caching for PutById property access
This patch makes it possible for JS::Object::internal_set() to populate
a CacheablePropertyMetadata, and uses this to implement a basic
monomorphic cache for the most common form of property write access.
2023-11-09 16:02:14 +01:00
Aliaksandr Kalenik 28118623f5 LibAccelGfx+LibWeb: Add basic line painting support
For now only solid line style is supported.
2023-11-09 10:47:31 +01:00
Aliaksandr Kalenik f1824a524d LibAccelGfx: Add 1px padding between glyphs in prepare_glyph_texture()
This fixes bug when tiny slice of another glyph appearing along with
the required glyph.
2023-11-09 07:56:45 +01:00
Aliaksandr Kalenik fd3411c868 LibWeb: Ignore document's box during overflow clip rect calculation
Reduction of bug:
```html
<!DOCTYPE html><style>
html {
    overflow-x: hidden;
    overflow-y: scroll;
}
div {
    background: orange;
    height: 1000px;
    width: 500px;
}
</style><body><div>
```

Fixes https://github.com/SerenityOS/serenity/issues/21690 and painting
on many other websites (null.com, servo.org).
2023-11-09 07:56:34 +01:00
Timothy Flynn a098b6e371 LibGfx: Ensure const-correctness when reading from the GPOS byte stream
Otherwise, the call to `read_in_place` gives the following error:

    Tried to obtain a non-const span from a read-only FixedMemoryStream
2023-11-08 22:26:36 +00:00
Timothy Flynn e576bf975c AK: Define traits for the const-variant of BigEndian and LittleEndian 2023-11-08 22:26:36 +00:00
Todderod bb9230bbcd LibJS: Remove redundant Store op
If the property for GetByValue in Generator::load_from_reference
is a calculated value this would be stored in an allocated
register and returned from the function. Not all callers want
this information however, so now only give it out when asked for.

Reduced the instruction count for Kraken/ai-astar.js function
"neighbours" from 214 to 192.
2023-11-08 22:18:28 +01:00
Stephan Vedder 13726fd3b7 LibJS/JIT: Add fast path for decrement
Generate jitted code for the decrement opcode.
2023-11-08 21:09:44 +01:00
Stephan Vedder 0e69f744df LibJS/JIT: Add increment instruction
Instead of using `Add` with an immediate of 1 use the `Inc` instruction
2023-11-08 21:09:44 +01:00
Timothy Flynn e122039c99 LibRegex: Support non-ASCII case-insensitive character comparisons
Specifically, when the Unicode flag is set, use Unicode-aware case
folding to case-insensitively compare code points.
2023-11-08 12:54:26 -05:00
Timothy Flynn 3fbf33bd37 LibRegex: Change a couple function parameters to east-const
Automatically done by clang-format-17 (and clang-format-16 leaves these
alone afterwards).
2023-11-08 12:54:26 -05:00
Timothy Flynn 6070df40f3 LibUnicode: Define case-insensitive string comparison more generically
The only user is currently String::equals_ignoring_case, but LibRegex
will need to do the same case-folded comparison with UTF-32 data. As it
turns out, the comparison works with all Unicode view types without much
fuss.
2023-11-08 12:54:26 -05:00
Timothy Flynn 370ea9441c AK: Define an alias for Utf16View's iterator type
Utf8View and Utf32View do so already. This allows using these views more
readily in generic code.
2023-11-08 12:54:26 -05:00
Lucas CHOLLET 5e2b049de8 LibCompress/LZW: Use a LittleEndianBitStream
No need to manually implement bit stream logic when we have a helper for
this task.
2023-11-08 18:19:34 +01:00
Lucas CHOLLET b00476abac AK: Use an enum to specify the open mode instead of a bool
Let's replace this bool with an `enum class` in order to enhance
readability. This is done by repurposing `MappedFile`'s `OpenMode` into
a shared `enum` simply called `Mode`.
2023-11-08 18:19:34 +01:00
Lucas CHOLLET 00ad8419cf LibGfx+LibCompress: Extract the LZW decoder and move it to LibCompress
Let's put this state-of-the-art decoder from the 80's in its own file in
order to reuse it with other formats, such as TIFF or PDF.
2023-11-08 18:19:34 +01:00
Lucas CHOLLET a86c0ac003 LibGfx/GIF: Use east-side const 2023-11-08 18:19:34 +01:00
Strawby 387decbb01 Spider: Add Manual link to the help-context-menu 2023-11-08 16:26:23 +00:00
Strawby df6668ff5b Calculator: Add Manual link to the help-context-menu 2023-11-08 16:26:23 +00:00
Strawby 056070ff85 3DFileViewer: Add Manual link to the help-context-menu 2023-11-08 16:26:23 +00:00
Sebastian Bernauer 8eb9c2dc54 LibJS/JIT: Add fast path for number comparisons
So far only less_than was using a fast path. This commits uses the same
path for less_than_equals, greater_than and greater_than_equals.
2023-11-08 14:11:51 +01:00
Tim Ledbetter ff81513634 Shell: Avoid infinite loop when parsing heredoc entry in POSIX mode
Previously, the shell would enter an infinite loop when attempting to
parse a heredoc entry within a `$(` command substitution.
2023-11-08 15:04:08 +03:30
Aliaksandr Kalenik c170dd323e LibJS: Make eval() prevent GetGlobal usage less aggressively
Before usage of GetGlobal was prevented whenever eval() is present in
the scope chain.

With this change GetGlobal is emitted for `g` in the following program:
```js
function screw_everything_up() {
    eval("");
}

var g;
g;
```

It makes Octane/mandreel.js benchmark run 2x faster :)
2023-11-08 10:07:56 +01:00
Matthew Olsson 1ca46afa2f LibWeb: Add the Animation IDL object 2023-11-08 09:58:18 +01:00
Matthew Olsson 0df06ce273 LibWeb: Add the AnimationEffect IDL object 2023-11-08 09:58:18 +01:00
Matthew Olsson e03e710d1b IDLGenerators: Support nullable dictionary members with default values
When wrapping dictionary members, generate_wrap_statement was called
with the pattern "auto {} = ...", where "..." was determined based on
the variable's type. However, in generate_wrap_statement, if a type is
nullable it generates an if statement, so this would end up generating
something along the lines of

    if (!retval.member.has_value()) {
    	auto wrapped_member0_value = JS::js_null();
    } else {
    	auto wrapped_member0_value = JS::Value(...);
    }

...which makes the declaration inaccessible. It now generates the same
code, but the "auto" declaration (now an explicit JS::Value declaration)
is outside of the if-statement.
2023-11-08 09:58:18 +01:00
Matthew Olsson 111e0159ff IDLGenerators: Allow specifying default non-empty string values 2023-11-08 09:58:18 +01:00
Luke Wilde fc42c75a0c LibWeb: Make Window.postMessage closer to the spec
The main issues are using Structured{Serialize,Deserailize} instead of
Structured{Serialize,Deserialize}WithTransfer and the temporary
execution context usage for StructuredDeserialize.

Allows Discord to load once again, as it uses a postMessage scheduler
to render components, including the main App component. The callback
checked the (previously) non-existent source attribute of the
MessageEvent and returned if it was not the main window.

Fixes the Twitch cookie consent banner saying "failed integrity check"
for unknown reasons, but presumably related to the source and origin
attributes.
2023-11-08 09:55:24 +01:00
Luke Wilde 464cc55b16 LibWeb: Default initialize strings in MessageEventInit 2023-11-08 09:55:24 +01:00
Luke Wilde 1607b2c978 LibWeb: Add MessageEvent.source 2023-11-08 09:55:24 +01:00
Luke Wilde eaa3b85864 LibWeb: Fix "ParameterizedTypeType" -> "ParameterizedType" typo for IDL 2023-11-08 09:55:24 +01:00
Luke Wilde 34cd69e623 LibWeb: Add support for WindowProxy in IDL -> CPP, unions, constructors 2023-11-08 09:55:24 +01:00
Luke Wilde 280199fb08 LibWeb: Recognise MessagePort as a platform object in IDL generator 2023-11-08 09:55:24 +01:00
Tim Ledbetter e510d81567 Assistant: Prioritize results which exactly match a query 2023-11-08 09:52:24 +01:00
Tim Ledbetter e1099a1757 Fuzzers: Use a single fuzzer to test all LibTextCodec encodings
This commit replaces the 5 fuzzers that previously tested LibTextCodec
with a single fuzzer. We now rely on the fuzzer to generate the
encoding and separate it from the encoded data with a magic separator.
This increases the overall coverage of LibTextCodec and eliminates the
possibility of the same error being generated by multiple fuzzers.
2023-11-08 09:39:49 +01:00
Tim Ledbetter 7d717986de Lagom: Copy fuzzer dictionary files to Oss-Fuzz $OUT directory
When building fuzzers for Oss-Fuzz using `BuildFuzzers.sh --oss-fuzz`,
fuzzer dictionary files are now copied to the `$OUT` directory. This
allows them to be used automatically by the corresponding fuzzer.
2023-11-08 09:39:49 +01:00
Tim Ledbetter 33ad384a7d Fuzzers: Add a DNS packet fuzzer 2023-11-08 09:38:36 +01:00
Tim Ledbetter 2fbaeb9694 LibDNS: Prevent malformed DNS packets from causing buffer overflows 2023-11-08 09:38:36 +01:00
Tim Ledbetter 4e3b59a4bb LibDNS: Prefer spans over raw pointers when parsing DNS packets
This means we don't have to keep track of the pointer and size
separately.
2023-11-08 09:38:36 +01:00
Tim Ledbetter c1d7a51391 LibGfx/ICC: Avoid buffer overrun when creating TextDescriptionTagData
We now validate that the offsets used cannot overflow, preventing
possible buffer overruns.
2023-11-08 09:37:30 +01:00
Tim Ledbetter 4b995542c4 LibIMAP: Make parsing of atom data fallible
We now return an error where `parse_atom()` would have previously
returned an empty StringView. This is consistent with RFC3501, which
says that an atom consists of one or more characters.

This prevents a few cases where parsing an invalid atom could lead to
an infinite loop.
2023-11-08 09:36:37 +01:00
Tim Ledbetter b96a5f4265 LibGfx/ILBM: Avoid overflow when creating bitplane data buffer 2023-11-08 09:36:01 +01:00
Tim Ledbetter 5e1017bcf1 LibGfx/ILBM: Avoid buffer overrun when reading bitplane data 2023-11-08 09:36:01 +01:00
Tim Ledbetter f56ae8c0e9 LibGfx/ILBM: Ensure CMAP chunk size matches expected value
The color map should be 3 bytes per pixel and should contain
`2^nPlanes` pixels. We now return an error if the color map isn't the
size we expect.
2023-11-08 09:36:01 +01:00
Tim Ledbetter 61eb754f63 LibGfx/ILBM: Add validation for header fields
We now exit early if a header field is set to a value that we don't
currently support.
2023-11-08 09:36:01 +01:00
Tim Ledbetter bed7b33daa LibGfx/ILBM: Don't attempt to decode a BODY chunk without a color map
While this isn't disallowed by the specification, it is not something
we currently support. Instead of crashing we now return an error in
this case.
2023-11-08 09:36:01 +01:00
Tim Ledbetter 75731f9c50 LibGfx/ILBM: Avoid buffer overruns when decompressing data 2023-11-08 09:36:01 +01:00