Commit Graph

59786 Commits

Author SHA1 Message Date
Nico Weber
77850f06dc Tests: Remove logspam from TestPainter 2024-03-14 10:56:13 -04:00
Jan200101
466f1f5bf3 Ports: Update lite-xl to 2.1.3 2024-03-14 15:42:58 +01:00
Andreas Kling
0c76c7ee36 LibWeb: Make Element::is_document_element() slightly nicer
By following the spec more closely, we can actually make this function
a bit more efficient (by comparing the parent against the document
instead of looking for the first element child of the document).
2024-03-14 12:42:08 +01:00
Andreas Kling
bbf67faa95 LibWeb: Add CSS rule buckets for pseudo elements, and for :root
If a selector must match a pseudo element, or must match the root
element, we now cache that information in the MatchingRule struct.
We also introduce separate buckets for these rules, so we can avoid
running them altogether if the current element can't possibly match.

This cuts the number of selectors evaluated by 32% when loading our
GitHub repo page https://github.com/SerenityOS/serenity
2024-03-14 12:42:08 +01:00
Andreas Kling
c6e37d0c44 LibWeb: Give Vector<MatchingRule> some inline capacity in StyleComputer
We frequently end up matching hundreds or even thousands of rules. By
giving this vector some inline capacity, we avoid a lot of the
repetitive churn from dynamically growing it all the way from 0
capacity.
2024-03-14 12:42:08 +01:00
Andreas Kling
d125a76f85 AK: Make FlyString-to-FlyString comparison inline & trivial
This should never boil down to more than a machine word comparison.
2024-03-14 12:42:08 +01:00
Timothy Flynn
bc23c5b9fe LibWeb: Append the bytes of File objects in submitted form data
This is required to upload files to GitHub. Unfortunately, this is not
currently testable with our test infrastructure. This path is only hit
from HTTP/S uploads, whereas all of our tests are limited to file://.
2024-03-14 10:10:33 +01:00
Timothy Flynn
c0d18e976e LibWeb: Use string literals as format strings during form serialization
Passing a StringView bypasses compile-time format string validation.
2024-03-14 10:10:33 +01:00
Timothy Flynn
bb38cc1010 LibWeb: Do not blindly create File objects when adding FormData entries
We were unconditionally creating new File objects for all Blob-type
values passed to `FormData.append`. We should only do so if the value is
not already a File object (or if the `filename` attribute is present).

We must also carry MIME type information forward from the underlying
Blob object.
2024-03-14 10:10:33 +01:00
Timothy Flynn
f55471333b LibWeb: Set the MIME type when creating an <input> element's File list
We were passing the MIME type to the underlying Blob, but the factory
for creating a File only checks an explicit options structure.
2024-03-14 10:10:33 +01:00
Timothy Flynn
0cc8698a62 LibWeb: Reverse check for whether a FilesList index is supported
This fixes for..of iteration of a FilesList object.
2024-03-14 10:10:33 +01:00
Timothy Flynn
c2ef506b4a LibWeb: Add an empty DataTransfer IDL implementation
This does not implement any of the IDL methods, but GitHub requires the
interface exists to upload files via an <input type="file"> element.
Their JS handles uploads via this element and via drag-and-drop in one
function, and check if the uploaded file is `instanceof DataTransfer` to
decide how to handle it.
2024-03-14 10:10:33 +01:00
Timothy Flynn
7681772b9f LibWeb: Log failed Fetch responses when WEB_FETCH_DEBUG is enabled
We do the same for successful responses. Very useful for debugging
issues on live websites.
2024-03-14 10:10:33 +01:00
mrkubax10
eb0d56a4ed Kernel/Net: Implement support for RTL8168C
Please be aware that I only have NIC with chip version 6 so
this is the only one that I have tested. Rest was implemented
via looking at Linux rtl8169 driver. Also thanks to IdanHo
for some initial work.
2024-03-13 22:09:54 -06:00
Cubic Love
15d6b3017a Snake: Set Snake as default skin
Set 'Snake' as the default skin for its aesthetic appeal and color
harmony with the game's icon.
2024-03-13 22:05:31 -06:00
Nico Weber
7740aeca29 LibGfx/JBIG2: Fix size bound in scan_for_immediate_generic_region_size()
The memmem() call passes `data.size() - 19 - sizeof(u32)` for big_len,
(18 prefix bytes skipped, the flag byte, and the trailing u32), so the
buffer needs to be at least that large.

Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=67332
2024-03-13 22:01:06 -06:00
Liav A
ec6e7077fe Tests/Kernel: Add tests for verifying proper loop device support 2024-03-13 15:33:47 -06:00
Liav A
0734de9f9a Kernel+Userland: Add mount MS_SRCHIDDEN option
Either we mount from a loop device or other source, the user might want
to obfuscate the given source for security reasons, so this option will
ensure this will happen.
If passed during a mount, the source will be hidden when reading from
the /sys/kernel/df node.
2024-03-13 15:33:47 -06:00
Liav A
0739b5df11 Utilities/mount: Automatically mount regular files with loop devices
Check if the source fd is not a block device file using the fstat
syscall and if that's the case, try to mount the file using a temporary
loop device.
2024-03-13 15:33:47 -06:00
Liav A
e14c571916 Tests/Kernel: Add test for /dev/loop directory structure 2024-03-13 15:33:47 -06:00
Liav A
d14a0a454a SystemServer: Mount DevLoopFS on /dev/loop
Let's use the new DevLoopFS filesystem on /dev/loop to see the loop
devices immediately as they're created or deleted.
2024-03-13 15:33:47 -06:00
Liav A
0d2e4a7e67 Kernel/FileSystem: Add the DevLoopFS filesystem
Similarly to DevPtsFS, this filesystem is about exposing loop device
nodes easily in /dev/loop, so userspace doesn't need to do anything in
order to use new devices immediately.
2024-03-13 15:33:47 -06:00
Liav A
11ead5c84f Kernel: Get RefPtr<Device> from the DeviceManagement::get_device method
Instead of returning a raw pointer, which could be technically invalid
when using it in the caller function, we return a valid RefPtr of such
device.

This ensures that the code in DevPtsFS is now safe from a rare race
condition in which the SlavePTY device is gone but we still have a
pointer to it.
2024-03-13 15:33:47 -06:00
Liav A
5dcf03ad9a Kernel/Devices: Introduce the LoopDevice device
This device is a block device that allows a user to effectively treat an
Inode as a block device.

The static construction method is given an OpenFileDescription reference
but validates that:
- The description has a valid custody (so it's not some arbitrary file).
  Failing this requirement will yield EINVAL.
- The description custody points to an Inode which is a regular file, as
  we only support (seekable) regular files. Failing this requirement
  will yield ENOTSUP.

LoopDevice can be used to mount a regular file on the filesystem like
other supported types of (physical) block devices.
2024-03-13 15:33:47 -06:00
Andrew Kaster
a9d240c647 LibWeb: Implement SubtleCrypto.generateKey for RSA-OAEP
This patch implements and tests window.crypto.sublte.generateKey with
an RSA-OAEP algorithm. In order for the types to be happy, the
KeyAlgorithms objects are moved to their own .h/.cpp pair, and the new
KeyAlgorithms for RSA are added there.
2024-03-13 15:31:00 -06:00
Andrew Kaster
008c89edde LibCrypto: Add observers for the *byte* length of UnsignedBigInteger
When calling the export_data method, it's a bit of a hassle to remember
that the caller's buffer needs to be the length() * Word.
2024-03-13 15:31:00 -06:00
Andrew Kaster
139ff3552c LibCrypto: Allow callers to pass exponent to RSA::generate_key_pair 2024-03-13 15:31:00 -06:00
Andrew Kaster
0b4858e589 LibWeb: Implement SubtleCrypto.generateKey skeleton
We don't have any algorithms defined that actually support generateKey,
but now all the scaffolding is there.
2024-03-13 15:31:00 -06:00
Andrew Kaster
810be6af07 LibWeb: Add CryptoKeyPair object for use in upcoming SubtleCrypto APIs 2024-03-13 15:31:00 -06:00
Andrew Kaster
0a6f195a71 LibWeb: Implement usages property for CryptoKey
And set it from the only place we currently create a CryptoKey, in
importKey.
2024-03-13 15:31:00 -06:00
Andrew Kaster
2d59d6c98c LibWeb: Refactor SubtleCrypto to allow adding more algorithms easier
This patch throws away some of the spec suggestions for how to implement
the normalize_algorithm AO and uses a new pattern that we can actually
extend in our C++.

Also update CryptoKey to store the key data.
2024-03-13 15:31:00 -06:00
Timothy Flynn
644e764620 RequestServer: Use Core::System::pipe2 for creating the request FDs
This causes a behavior change in which the read FD is now non-blocking.
This is intentional, as this change avoids a deadlock between RS and
WebContent, where WC could block while reading from the request FD,
while RS is blocked sending a message to WC.
2024-03-13 12:52:07 -04:00
Timothy Flynn
a973fe13cb LibCore: Use Core::System::pipe2 for creating the event loops waking FDs 2024-03-13 12:52:07 -04:00
Timothy Flynn
40beebca71 LibCore: Apply the flags provided to System::pipe2 on all systems
We currently drop the flags on the floor for systems that do not have a
pipe2 syscall. Instead, use fcntl to set the flags.
2024-03-13 12:52:07 -04:00
Timothy Flynn
dd271adcf5 RequestServer: Do not defer establishing a TCP/TLS connection
The underlying issue here isn't quite understood yet, but for some
reason, when we defer this connection, we ultimately end up blocking
indefinitely on macOS when a subsequent StartRequest message tries to
send its request FD over IPC. We should continue investigating that
issue, but for now, this lets us use RequestServer more reliably on
macOS.
2024-03-13 12:52:07 -04:00
Timothy Flynn
d5ce45b016 Meta: Port recent changes to the GN build
163b6bb401
3b4230e0b0
2024-03-13 12:52:07 -04:00
Bastiaan van der Plaat
16fdb005f0 Ladybird/Qt: Allow CR inside of elements title attributes 2024-03-13 07:58:36 -04:00
Andreas Kling
72e6581585 LibWeb: Store copy of MutationObserver set in a MarkedVector
While iterating over MutationObservers in the microtask callback, we
need to keep them in a MarkedVector to ensure they don't get GC'd.
2024-03-13 09:41:55 +01:00
Tim Ledbetter
fc1f037cd1 LibWeb: Implement the window.opener attribute
This returns a reference to the window that opened the current window.
2024-03-13 08:06:00 +00:00
Timothy Flynn
5713c2ffdd CI: Work around a libasan bug seen on Ubuntu with the Linux 6.5 kernel
We are recently seeing SEGV crashes during the build (while running code
generators) from within libasan itself. Turns out this is libasan bug
seen with the Linux 6.5 kernel on Ubuntu.
2024-03-12 21:45:25 -04:00
MacDue
4c15c87d0c LibGfx/TinyVG: Fix decoding green channel of graphics RGB565 colors
The division was missed here, so this would produce overly bright greens
(or overflow).
2024-03-12 21:53:23 +00:00
MacDue
633f0067c1 LibGfx: Remove suspicious const& in TinyVGLoader
`decode_color_table()` returns a vector by value (not reference), so
assigning it to a const reference (while legal), seems odd.
2024-03-12 21:53:23 +00:00
Aliaksandr Kalenik
bf11f4f73f LibWeb: Visit m_when_defined_promise_map in CustomElementRegistry 2024-03-12 18:18:10 +01:00
Aliaksandr Kalenik
90112468ac LibWeb: Visit custom element definitions in CustomElementRegistry 2024-03-12 18:18:10 +01:00
Aliaksandr Kalenik
bf8bbea209 LibWeb: Visit constructor callback in CustomElementDefinition 2024-03-12 18:18:10 +01:00
Aliaksandr Kalenik
3b4230e0b0 LibWeb: Visit custom element's lifecycle callbacks
...instead of using JS::Handle which causes leaks when object holding
the callback can be reached by visiting the callback's dependencies.
2024-03-12 18:18:10 +01:00
Sönke Holz
3d48c55e50 Ports: Add missing dependency on glu to sdl12-compat 2024-03-12 17:44:14 +01:00
Ali Mohammad Pur
5a40ce442b LibWasm: Remove uses of AK::Result
Closes #23500.
2024-03-12 17:10:47 +01:00
Ali Mohammad Pur
8003bde03d AK+LibRegex+LibWasm: Remove the non-const COWVector::operator[]
This was copying the vector behind our backs, let's remove it and make
the copying explicit by putting it behind COWVector::mutable_at().
This is a further 64% performance improvement on Wasm validation.
2024-03-12 17:10:47 +01:00
Ali Mohammad Pur
cced555879 LibWasm: Avoid pointless vector copies in Validator::Context
These vector copies accounted for more than 50% of the current runtime
of the validator on a large wasm file, this commit makes them
copy-on-write to avoid the copies where possible, gaining nearly a 50%
speedup.
2024-03-12 17:10:47 +01:00