Commit graph

57508 commits

Author SHA1 Message Date
Timothy Flynn
507a5d8a07 AK: Add an option to zero-fill ByteBuffer data upon growth
This is to avoid UB in cases where we need to be able to read from the
buffer immediately after resizing it.
2023-12-27 19:30:39 +01:00
Kenneth Myhra
759c8ccc55 Ports: Update checksum for stpuzzles 2023-12-27 19:30:23 +01:00
Lucas CHOLLET
f389c1cdba LibGfx+LibPDF: Use LibCompress' implementation of the PackBits decoder
No need to have these three copies :^)
2023-12-27 17:40:11 +01:00
Lucas CHOLLET
d748edd994 LibCompress: Add a PackBits decoder
This compression scheme was quite popular during the 80's, and we can
still find it in use inside file formats such as TIFF or PDF.
2023-12-27 17:40:11 +01:00
Shannon Booth
5d0fb4bac3 LibJS: Do not inherit TypedArray constructors from TypedArrayConstructor
In: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object

The spec says:
> is a constructor function object that all of the TypedArray
> constructor objects inherit from.

From what I understand from this, it effectively just means is that the
prototype for the constructor should simply be set to
TypedArrayConstructor. We _were_ doing that, but also inheriting from
it in C++.

This meant we were invoking TypedArrayConstructor::initialize for each
of the typed arrays. This is not actually what we want, since it means
that the 'of' and 'from' functions were being defined as native
properties in both the concrete typed array (e.g Uint8Array), and the
abstract TypedArray. Instead, the properties should only be defined and
inherited from the abstract TypedArray class.

Diff Tests:
    +4     -4 

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-12-27 10:57:16 -05:00
Bastiaan van der Plaat
009729d5e3 LibWeb: Use resources to find internal HTML template paths 2023-12-27 10:54:07 -05:00
Bastiaan van der Plaat
f8feca5d21 LibWeb: Use directory page when viewing a resource schemed directory URL 2023-12-27 10:54:07 -05:00
Bastiaan van der Plaat
b39d99cf2f LibWeb: Use resource scheme for icons in internal pages 2023-12-27 10:54:07 -05:00
Mr.UNIX
44d623d588 CrashReporter: Port CrashReporter to GML Compiler 2023-12-27 15:29:50 +01:00
Mr.UNIX
4cb2ff1428 LibGUI: Add set_text(String) method to ProgressBar 2023-12-27 15:29:50 +01:00
Nico Weber
3c39c18440 LibGfx/JPEG: Add spec comment to read_start_of_frame() 2023-12-27 13:38:25 +00:00
Andreas Kling
89da988da1 LibWeb: Honor User-Agent spoofing in Fetch headers
This makes spoofing consistent between legacy ResourceLoader loads,
Fetch loads, and the JavaScript `navigator` APIs.
2023-12-27 11:43:14 +01:00
Andreas Kling
a30d263522 LibGfx: Don't clone fonts in FontCascadeList::extend()
This was create a completely avoidable explosion of BitmapFont clones
when running on SerenityOS.
2023-12-27 11:42:05 +01:00
Andreas Kling
bd9989b08a LibWeb: Don't pass StringView to RecordingPainter, to avoid copy
Instead, we now pass String if we have one. In particular, this fixes an
issue where image elements with a data: URL src would copy the entire
URL string every time we painted (before the image had been decoded).
This was very noticeable on "fully downloaded" web pages where every
single image has been turned into a data: URL.
2023-12-27 11:41:15 +01:00
Andreas Kling
0c7b1d27b4 LibWeb: Remove incomplete attempt to avoid repaints outside viewport
This code didn't account for position:fixed elements, which meant that
we'd swallow repaints for such elements when the viewport wasn't
scrolled to the top of the page.

We replace the incomplete optimization with a FIXME noting that this
needs to be handled correctly when reintroduced.
2023-12-27 09:46:06 +01:00
Shannon Booth
1f9942fede BindingsGenerator: Use get_attribute_value for reflected strings
Per:

https://dom.spec.whatwg.org/#concept-reflect

We should be calling `get_attribute_value` for reflected IDL strings.
No functional change as nowhere is performing a reflect on a nullable
type, and just ends up simplifying the code.
2023-12-27 09:23:44 +01:00
Shannon Booth
462f97b28a LibWeb: Port Element::get_attribute_value from ByteString 2023-12-27 09:23:44 +01:00
tetektoza
2751f32a18 HexEditor: Move drawing cursor under a lambda and reuse it
This is a cleanup patch dones for paint event for HexEditor, moving
repeated chunks of code under a common lambda.
2023-12-27 09:22:09 +01:00
tetektoza
017dea2993 HexEditor: Don't initialize background/text colors twice
This is a cleanup patch, moves a chunk of repeated code to one place
instead of assigning variables with the same values twice in two
different places of code.
2023-12-27 09:22:09 +01:00
tetektoza
bd1d384cf6 HexEditor: Remove moving cursor outside bounds if selecting with mouse
Currently if users select last bytes in HexEditor with mouse in either
Hex or Text mode, they will be able to move cursor on the byte outside
bounds. If then they try to write something in either of those modes,
app will crash.

This patch moves the recently added "replace" cursor to always be on the
last byte of the selection instead of being on the byte after the last
selected byte.
2023-12-27 09:22:09 +01:00
tetektoza
c4c9971ed0 HexEditor: Change cursor type from caret to black box
This patch changes cursor type from caret to black box for both Hex and
Text modes, because right now the way how blinking caret looks like is
more closer to "insert" mode in similar editors, whereas the real
behavior of this cursor is more of a "replace" mode seen in similar
editors like GHex.
2023-12-27 09:22:09 +01:00
tetektoza
1ea675a9ec HexEditor: Remove blinking of the cursor 2023-12-27 09:22:09 +01:00
MacDue
daecf741d4 LibWeb: Ensure DocumentObserver document_completely_loaded() is called
This stopped being called for anything without a navigable container
after 76a97d8, due to the early return. This broke SVG <use> elements
that reference elements defined later in the document.
2023-12-26 21:37:04 +01:00
Idan Horowitz
785c9d5c2b Kernel: Add support for TCP window size scaling
This should allow us to eventually properly saturate high-bandwidth
network links when using TCP, once other nonoptimal parts of our
network stack are improved.
2023-12-26 21:36:49 +01:00
Idan Horowitz
2c51ff763b Kernel: Properly report receive window size in sent TCP packets
Instead of lying and claiming we always have space left in our receive
buffer, actually report the available space.

While this doesn't really affect network-bound workloads, it makes a
world of difference in cpu/disk-bound ones, like git clones. Resulting
in a considerable speed-up, and in some cases making them work at all.
(instead of the sender side hanging up the connection due to timeouts)
2023-12-26 21:36:49 +01:00
Sam Atkins
69f88c9a64 LibWeb: Parse grid property using TokenStream 2023-12-26 19:58:20 +00:00
Sam Atkins
5f99edad3b LibWeb: Parse grid-template property using TokenStream 2023-12-26 19:58:20 +00:00
Sam Atkins
b8c6c75ae1 LibWeb: Parse grid-template-[columns,rows] properties using TokenStream 2023-12-26 19:58:20 +00:00
Sam Atkins
ee5b00d1ee LibWeb: Parse grid-auto-[columns,rows] properties using TokenStream 2023-12-26 19:58:20 +00:00
Idan Horowitz
519214697b Kernel: Mark sys$getsockname as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
ed5406e47d Kernel: Mark sys$getpeername as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
24a60c5a10 Kernel: Mark sys$ioctl as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
d63667dbf1 Kernel: Mark sys$kill_thread as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
b44628c1fb Kernel: Mark sys$join_thread as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
82e6090f47 Kernel: Mark sys$detach_thread as not needing the big process lock
This syscall does not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
b49a0e2c61 Kernel: Mark sys$create_thread as not needing the big process lock
Now that the master TLS region is spinlock protected, this syscall does
not access any big process lock protected resources.
2023-12-26 19:20:21 +01:00
Idan Horowitz
6a4b93b3e0 Kernel: Protect processes' master TLS with a fine-grained spinlock
This moves it out of the scope of the big process lock, and allows us
to wean some syscalls off it, starting with sys$allocate_tls.
2023-12-26 19:20:21 +01:00
Aliaksandr Kalenik
cd56ec6e5c LibWeb: Redo "tracks maximize" if initial run is over max-size in GFC
Implements missing "redo" step defined in the spec.
2023-12-26 19:19:50 +01:00
Mr.UNIX
467faee1b8 Calendar: Add a link to the Manual in Help Menu 2023-12-26 18:37:35 +01:00
Idan Horowitz
863e8c30ad Kernel: Ensure sockets_by_tuple table entry is up to date on connect
Previously we would incorrectly handle the (somewhat uncommon) case of
binding and then separately connecting a tcp socket to a server, as we
would register the socket during the manual bind(2) in the sockets by
tuple table, but our effective tuple would then change as the result of
the connect updating our target peer address. This would result in the
the entry not being removed from the table on destruction, which could
lead to a UAF.

We now make sure to update the table entry if needed during connects.
2023-12-26 18:36:43 +01:00
Idan Horowitz
da2f33df82 Kernel: Stop modifying peer address/port in sendto on a TCP socket
POSIX (rightfully so) specifies that the sendto address argument is
ignored in connection-oriented protocols.

The TCPSocket also assumed the peer address may not change post-connect
and would trigger a UAF in sockets_by_tuple() when it did.
2023-12-26 18:36:43 +01:00
Idan Horowitz
8bb423daf7 LibC: Implement siginterrupt()
This is just a simple wrapper around the more-modern sigaction.
2023-12-26 18:36:43 +01:00
Sam Atkins
5e2fc52b25 LibWeb: Remove old ad-hoc document-loading code
This also removes the code for displaying `gemini://` documents. We
currently don't load documents from that protocol anyway - we hit
`attempt_to_create_a_non_fetch_scheme_document()` in `Navigable.cpp`
which is just a stub. It looks like we should be handling those
separately from regular "fetch" documents, so that's a task for a
future person.
2023-12-26 18:35:29 +01:00
Sam Atkins
9733524f8a LibWeb: Load markdown documents using the spec mechanism
This basically just means it now goes through the
`create_document_for_inline_content()` function.
2023-12-26 18:35:29 +01:00
Sam Atkins
c5223ae77f LibWeb: Adjust create_document_for_inline_content() for future use
(Apologies for bad commit title, it's hard to explain in such a short
space!)

We're going to need to call this for producing markdown and gemini
documents, both of which need a Document and Realm to fetch the entire
response body, so that they can then generate their HTML. So this
commit modifies `create_document_for_inline_content()` to take a lambda
instead of a fixed HTML string, to support these uses.

Also, we always return a nonnull pointer, so make that the return type.

This is a move and change in the same commit, (Sorry!) but all the
changes are to the function signature and step 6.
2023-12-26 18:35:29 +01:00
Sam Atkins
ae8e040287 LibWeb: Bring media-document loading closer to spec
There's an unfortunate hack here. We have to load the media file's data
before we call `HTML::HTMLParser::the_end()` with our generated
document, otherwise the media element (`<img>`/`<audio>`/`<video>`)
never loads and that blocks the document's load event. The previous code
path also did this, which is perhaps why the bug was never noticed.
2023-12-26 18:35:29 +01:00
Sam Atkins
91d82ae17a LibWeb: Bring text-document parsing to spec 2023-12-26 18:35:29 +01:00
Sam Atkins
4dbca3e14a LibWeb: Bring XML-document loading to spec 2023-12-26 18:35:29 +01:00
Sam Atkins
6c74069c1e LibWeb: Bring HTML-document loading to spec 2023-12-26 18:35:29 +01:00
Sam Atkins
6ffda5f271 LibWeb: Make HTMLParser::the_end() callable from outside
This is a little awkward: The spec requires when loading media documents
or ones that don't have a DOM, that we "act as if the user agent had
stopped parsing document" which means following this algorithm. Only a
few steps require an HTMLParser, but those that do, involve reaching
into its internals. The simplest solution I could think of (other than
duplicating this fairly hefty function) is making it static and taking
a Document and optional HTMLParser as parameters.
2023-12-26 18:35:29 +01:00