Commit Graph

60485 Commits

Author SHA1 Message Date
Timothy Flynn
c7ea710b55 AK: Return a constant reference from JsonValue::as_string
Rather than making a copy of the held string, this returns a reference
so that expressions like the following:

    do_something(json.as_string().view());

are not disallowed once `ByteString::view() &&` is deleted.
2024-04-04 11:23:21 +02:00
Andrew Kaster
6d38d55fc8 LibWebView: Collect memory and cpu usage for helpers on Linux 2024-04-04 09:41:01 +02:00
0x4261756D
a005aae497 LibJS: Add missing Base::visit_edges() in FetchAlgorithms and Navigable
These are empty calls since `Base` is JS::Cell  but they *are* missing
and LibJSGCVerifier complains otherwise.
2024-04-04 07:50:13 +02:00
0x4261756D
f489c3d9c2 LibJSGCVerifier: Fix false positives in HeapFunction::visit_edges()
clang doesn't make all `Base::visit_edges()` calls CXXMemberCallExprs
This would lead to false positives like in HeapFunction,
where the matcher would fail to match and report a warning.
Also previously the matcher would succeed
if the visited class is missing the call to `Base::visit_edges()`
but an included class has a correct method.

The new matcher checks the current class for `visit_edges`-overrides
and matches all `visit_edges`-memberExprs inside,
checking those for starting with `Base::`.
This seems to get rid of the false positives
and should be more correct detecting missing calls.
2024-04-04 07:50:13 +02:00
0x4261756D
7743dcf4a9 LibJSGCVerifier: Fix dangling-reference errors
When building, clang would throw errors about dangling references.
Extracting `template_args` to a variable before the loop and
indexing into that seems to fix the errors.
2024-04-04 07:50:13 +02:00
Andrew Kaster
bf722d49b0 LibWeb: Remove WebContent include from SVGDecodedImageData
This is a layering violation, and is not used. Caught by the gn build.
2024-04-04 07:47:16 +02:00
Timothy Flynn
69b5d7c0e6 LibWeb: Avoid UAF when encoding a fetch request body via URLSearchParams 2024-04-03 17:14:01 -04:00
Andreas Kling
d91d6ee205 LibWeb: Stop leaking entire realms via Blob URLs
This patch implements the File API spec's supplemental steps for
document's "unloading document cleanup steps" so that we now remove blob
URLs associated with the document's relevant settings object when the
document is being unloaded.

Fixes two realm leaks when running our test suite.
2024-04-03 22:20:50 +02:00
Aliaksandr Kalenik
696cf7b9fb LibWeb: Fix "destroy the child navigable" to call Document::destroy()
f66d33423b was not sufficient to ensure
document destruction when a child navigable is destroyed. This is
because a navigable was remove from the set of all navigables too early
which led to `Navigable::navigable_with_active_document()` being unable
to find a navigable that is still in the process of destruction.

This change solves that by making all steps of a navigable destruction
to happen in afterAllDestruction callback.

Unfortunately, writing a test to verify document destruction is
challenging because no events are emitted to indicate that it has
happened.
2024-04-03 21:17:57 +02:00
stelar7
35676491ec LibWeb: Implement ED25519 verify for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7
9ad10566b2 LibWeb: Implement ED25519 sign for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7
ec015034bd LibWeb: Implement ED25519 generateKey for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7
069295d132 LibWeb: Improve NotSupported error message for normalize_an_algorithm 2024-04-03 13:10:01 -06:00
stelar7
54a3ffcd42 LibCrypto: Add early exit to SECP.verify if signature is invalid 2024-04-03 13:10:01 -06:00
stelar7
ae230c9150 LibWeb: Implement most of ECDSA verify for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7
6906b7c1e6 LibWeb: Implement skeleton of SubtleCrypto.verify 2024-04-03 13:10:01 -06:00
stelar7
bc2a5e24bc LibWeb: Implement skeleton of ECDSA sign for SubtleCrypto 2024-04-03 13:10:01 -06:00
stelar7
41449814db LibWeb: Implement generateKey for ECDSA 2024-04-03 13:10:01 -06:00
stelar7
cfae6523be LibWeb: Implement skeleton of SubtleCrypto.sign 2024-04-03 13:10:01 -06:00
Andrew Kaster
d1fdfead54 LibWebView+Browser: Collect memory and cpu usage for helpers on Serenity 2024-04-03 20:56:33 +02:00
Timothy Flynn
d6c8218089 Ladybird/Qt: Show the tab bar by default
We currently only show the tab bar when we have more than one tab open.
This has caused confusion in the past, as it's a bit less obvious that
the browser supports tabs. For example:

https://hackaday.com/2023/10/10/jennys-daily-drivers-serenityos-and-in-particular-ladybird/
"it’s a single window with no tabs"
2024-04-03 20:56:04 +02:00
Timothy Flynn
ecce4ad426 Ladybird/Qt: Set the tab tooltip to its full title
If a tab's title is cut off due to its size, setting a tool tip will
allow for viewing the full title.
2024-04-03 20:56:04 +02:00
Timothy Flynn
2713d4651d Ladybird/Qt: Specify a minimum and maxium tab width
By default, Qt will grow the width of a tab button to fit the title text
of the tab. For long titles or file:// URLs, this looks rather bad. This
sets a min/max tab width to prevent such infinite growth.

To do this, we have to subclass both QTabWidget and QTabBar, because the
functions to be called/overridden are protected.
2024-04-03 20:56:04 +02:00
Timothy Flynn
0234add5fa Ladybird/Qt: Replace the default tab close icon with a vector icon
The default icon used by Qt is a bit jarring. Replace it with an icon
that resembles our other homemade icons.
2024-04-03 20:56:04 +02:00
Timothy Flynn
b577782247 Ladybird/Qt: Move the TVG icon loader to a utility file
It will be needed outside of Tab.
2024-04-03 20:56:04 +02:00
Timothy Flynn
1fc995d4aa Ladybird/Qt: Add a hover effect to the audio play state button
By default, a flat QPushButton does not have a hover effect. Add a small
subclass to provide such an effect to make it clearer it is a button.
2024-04-03 20:56:04 +02:00
Timothy Flynn
22ab12e4a1 Meta: Port recent changes to the GN build
ccebc7a905
2024-04-03 20:56:04 +02:00
Andreas Kling
fb263e232a LibWeb: Fix typo: covert_number_to_string => convert_number_to_string 2024-04-03 18:17:24 +02:00
Andreas Kling
ffac32d20e LibWeb: Use JS::HeapFunction for WebIDL promise reaction steps
Switching away from SafeFunction immediately backfired here, as we're
dealing with two layers of captures, not one.

Let's do the correct fix, which is to use HeapFunction. This makes the
API and its behavior explicit, and keeps captures alive as long as the
HeapFunction is alive.

Fixes #23819.
2024-04-03 18:14:33 +02:00
Andreas Kling
f1eb837c3d LibWeb: Remove unnecessary JS::Handle in AbortSignal::timeout()
This fixes yet another GC reference cycle.
2024-04-03 18:14:33 +02:00
Andreas Kling
32d065011b LibWeb: Use Core::Timer in AnimationFrameCallbackDriver
There was no need to use a Platform::Timer here since we're not making
use of the automatic SafeFunction behavior anyway.
2024-04-03 18:14:33 +02:00
Andreas Kling
518cedc8f3 LibWeb: Don't store root as JS::Handle in IntersectionObserver
Instead, use a JS::GCPtr and visit it, to prevent GC reference cycles.
2024-04-03 18:14:33 +02:00
Andreas Kling
52fa415779 LibWeb: Use JS::SafeFunction for ResourceLoader callbacks
This is one of the cases where SafeFunction actually makes sense.
Since every resource load will always either succeed, fail, or time out,
it's okay to use a SafeFunction since we know it will eventually get
destroyed.

Until it does, this allows it to keep any captures alive.
2024-04-03 18:14:33 +02:00
Andreas Kling
a9842ebe48 LibWeb: Use JS::HeapFunction in Fetch::Fetching::PendingResponse
This fixes a long-standing realm leak.
2024-04-03 18:14:33 +02:00
Andreas Kling
338dde70a1 LibJS: Don't create Handles in Promise.finally()
Capturing Handles like this was creating unbreakable GC reference cycles
and causing us to leak entire realms.
2024-04-03 18:14:33 +02:00
Andrew Kaster
12fce55caf LibWeb: Don't load favicons twice for non-SVG documents
This seems to be a rebase mishap in bdb8af94ee.
2024-04-03 09:56:53 -06:00
Stanisław Wiśniewski
5f7745641d LibC: Precompute directory_name length in ttyname_r_for_directory() 2024-04-03 09:48:05 -06:00
Stanisław Wiśniewski
72911cd006 LibC: Verify pointer returned by malloc() 2024-04-03 09:48:05 -06:00
mobounya
bdb8af94ee LibWeb: Don't load fallback icon for SVG documents
Skip loading a fallback favicon if Document represents a decoded SVG.

Issue: #23405
2024-04-03 09:45:31 -06:00
Nico Weber
44d3fd0546 Tests/JBIG2: Add tests for transposed non-topleft text reference corners
This needed the same `jbig2` changes as for the non-transposed ones,
and the changes to it mentioned on #23780.

I used the same .ini files as for the non-transposed ones, except
that I added `-txt -Param -Transposed 1` as last line to each of them.

All three new files display fine in Chrome.
They all look busted in Firefox.
I think this is likey a bug in pdf.js that I'll report upstream.
(Reportedly they look fine in Acrobat on Android.)
2024-04-03 11:40:25 -04:00
Nico Weber
7b5852bf91 LibGfx/JBIG2: Fix rendering of transposed text
The current code was incorrect for non-TopRight reference corners.
Fixes rendering of ghostpdl/tests/jbig2/042_19.jb2.
2024-04-03 11:40:25 -04:00
Nico Weber
67875ecb6f Tests/JBIG2: Add tests for non-topleft text segment reference corners
This already worked fine. Now it's tested.

I did have to teach `jbig2` to correctly generate test files for this.
See the PR adding these tests for local changes.

I used the script from #23659 to create these images, but I replaced
these lines:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `bottomleft`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 137 50 -ID 3 294 60 -ID 1 199 135 -ID 0 319 232
-txt -Param -RefCorner 0
```

For `bottomright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232
-txt -Param -RefCorner 2
```

For `topright`, I replaced them with:

```
-txt -Param -numInst 4
    -ID 2 108 79 -ID 3 265 89 -ID 1 100 234 -ID 0 70 351
-txt -Param -RefCorner 3
```

All three new files display fine in Chrome.
The bottomleft one displays fine in Firefox, while the other two
look compressed in X. I think this is a bug in pdf.js that I'll
report upstream.
(Reportedly they look fine in Acrobat on Android.)
2024-04-03 11:40:25 -04:00
Nico Weber
b31e3fe573 LibGfx/JBIG2: Add some debug logging for text segments 2024-04-03 11:40:25 -04:00
Nico Weber
b130e36330 LibGfx/JBIG2: Add spaces to some spec comments 2024-04-03 11:40:25 -04:00
Andreas Kling
c10f9856a4 LibWeb: Don't use JS::SafeFunction for WebIDL promise reaction steps
SafeFunction was causing massive GC reference cycles here and leaking
entire realms as a result.

Since we end up storing these reaction steps in a JS::NativeFunction
(which uses JS::HeapFunction internally) there should be no need to
protect the captures with SafeFunction.

This dramatically shrinks our memory footprint while running tests.
2024-04-03 12:41:59 +02:00
Andreas Kling
3881717103 LibJS+AK: Register GC memory as root regions for LeakSanitizer
This should fix the gigantic list of false positives dumped by
LeakSanitizer on exit .
2024-04-03 12:41:02 +02:00
Shannon Booth
ccebc7a905 LibWeb: Add stubs for the Screen Orientation API
As defined in: https://w3c.github.io/screen-orientation
2024-04-03 10:09:58 +01:00
Aliaksandr Kalenik
7fb09bf95b LibWeb: Skip not runnable in spin_processing_tasks_with_source_until()
Fixes https://github.com/SerenityOS/serenity/issues/23801
2024-04-03 10:25:38 +02:00
Aliaksandr Kalenik
f66d33423b LibWeb: Fix spec bug in "destroy child navigable"
See for more details:
https://github.com/whatwg/html/issues/10242

Before this change it only worked because of another bug in
`EventLoop::spin_processing_tasks_with_source_until()`
where we execute tasks regardless of whether they are runnable or not.
2024-04-03 10:25:38 +02:00
Luke Wilde
facece1a2a LibWeb: Implement PerformanceObserver.supportedEntryTypes 2024-04-03 07:55:51 +02:00