Commit graph

56737 commits

Author SHA1 Message Date
Shannon Booth
af7df1dbbf LibWeb: Port CSSStyleDeclaration from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Shannon Booth
629f661e3b LibWeb: Port supported property names from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Shannon Booth
66ac0d88a3 LibWeb: Port AvailableSpace from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Shannon Booth
6e48d9f2e6 LibWeb: Port Dump from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Shannon Booth
d400291ad9 LibWeb: Port CSSRule::serialized from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Andrew Kaster
890cce6fbb headless-browser: Centralize test timeouts and up default to 30 seconds
We're seeing timeouts for WebWorker based tests in some CI runs. It's
possible that these are legitimate timeouts, so bump the default timeout
to 30sec. When porting the test runner to run on CI, Andreas had to bump
the test timeout from 5 seconds to 10, to 15. It's likely that loading
our ASAN/UBSAN binaries on slow CI machines takes a significant amount
of time. Tests that use the new WebWorker process are spawning yet
another process that needs to load LibWeb and all its dependencies.
2023-11-28 16:38:51 +01:00
Timothy Flynn
6aa334767f AK: Ensure assigned-to Strings are dereferenced if needed
If we assign to an existing non-short string, we must dereference its
StringData object to prevent leaking that data.
2023-11-28 16:38:18 +01:00
Timothy Flynn
82398e5724 Meta: Silence warnings from optional CMake packages
These can be quite verbose on the command line if the packages aren't
found. As they do not break the build, let's not spam warnings.

The OpenGL package is also now skipped on macOS, where there's no point
in looking for the package anyways.
2023-11-28 06:54:16 -05:00
Lucas CHOLLET
9090290d11 LibGfx/TIFF: Rename BitPerSample => BitsPerSample
This is the proper name used in the spec.
2023-11-28 10:53:06 +01:00
Nico Weber
b2302ed23f LibGfx: Unbreak building with Python 3.9
Unbreaks building with macOS 13 system python, and is less code too.
No behavior change.
2023-11-27 21:58:16 -05:00
Aliaksandr Kalenik
1b3223dd9e LibWeb: Rename painter() to recording_painter() in PaintContext
Using recording_painter() as a name is less misleading, indicating
the painter in stacking context traversal doesn't perform actual
painting commands.
2023-11-27 21:53:38 +01:00
Liav A
c3d28d7f5a Kernel: Switch init boot argument to "/init"
This doesn't affect system functionality, but somewhat reduces the
reliance on complicated hardcoded paths. It also allows the user to
simply link /init (which is normally a symbolic link) to another program
to run it instead of SystemServer as the default option.
2023-11-27 09:29:05 -07:00
Liav A
4a50c01c50 Kernel: Print to the log what is the first user process & its arguments 2023-11-27 09:29:05 -07:00
Liav A
9254ed4f08 Meta: Create symbolic link from /init to /bin/SystemServer
This is a preparation before we could switch the kernel init boot
argument to "/init" in a future commit.
2023-11-27 09:29:05 -07:00
Liav A
5dba1dedb7 Kernel: Don't warn when running dynamically-linked ELF without PT_INTERP
We could technically copy the dynamic loader to other path and run it
from there, so let's not assume paths.
If the user is so determined to do such thing, then a warning is quite
meaningless.
2023-11-27 09:27:34 -07:00
Liav A
a8601b4ac7 DynamicLoader: Make heuristic for running directly actually correct
When we run directly the dynamic loader, we shouldn't rely on the passed
program path to be run, but rather on whether the main program fd number
is not -1, because the kernel will set it to a non-negative number if it
exists.

To test that the heuristic is working correctly, the /usr/lib/Loader.so
file can be copied to /tmp/Loader.so and then be invoked from that path.
2023-11-27 09:27:34 -07:00
Liav A
69b97fe318 LibELF: Disallow the DynamicLinker from linking a static-pie ELF object
The dynamic loader can't reasonably run static-pie ELF. static-pie ELFs
might run executable code that invokes syscalls outside of the defined
syscall memory executable (code) region security measure we implement.

Known examples of static-pie ELF objects are ELF packers, and the actual
system-provided dynamic loader itself.
2023-11-27 09:27:34 -07:00
Aliaksandr Kalenik
0ff977bd04 LibWeb: Add fixed position stacking context support in GPU painter 2023-11-27 17:26:39 +01:00
Liav A
93e172895a Kernel: Add /sys/kernel/request_panic node to simulate a kernel panic
When writing to /sys/kernel/request_panic it will do a kernel panic.
Trying to truncate the node will result in kernel panic with a slightly
different message.
2023-11-27 09:24:52 -07:00
Lucas CHOLLET
9836a9ad0e LibGfx/TIFF: Introduce a code generator
This will allow us to generate code that handle and provide easy access
to metadata stored in TIFF's tags. The generator is a Python script, and
it output both TIFFMetadata.h and TIFFTagHandler.cpp files.

The generator will definitely need some update to support all TIFF and
EXIF tags, but that will still be easier than writing everything
ourselves.

Some small modifications are needed in TIFFLoader.cpp to make it
compatible with the new `Metadata` class.
2023-11-27 09:07:16 -07:00
Stephan Vedder
8c65cc185a Meta: Add a minimal SDL2 based videoplayer for Lagom 2023-11-27 09:04:47 -07:00
dependabot[bot]
7510fa1598 CI: Bump mymindstorm/setup-emsdk from 12 to 13
Bumps [mymindstorm/setup-emsdk](https://github.com/mymindstorm/setup-emsdk) from 12 to 13.
- [Release notes](https://github.com/mymindstorm/setup-emsdk/releases)
- [Commits](https://github.com/mymindstorm/setup-emsdk/compare/v12...v13)

---
updated-dependencies:
- dependency-name: mymindstorm/setup-emsdk
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 09:02:30 -07:00
Michiel Visser
4ab75bd138 LibTLS: Add comment to cipher suite list about Mozilla recommended order 2023-11-27 15:02:04 +01:00
Michiel Visser
dde1e8ccf5 LibTLS: Modernize the TLS cipher suite list 2023-11-27 15:02:04 +01:00
Michiel Visser
bc9cdd4394 LibCrypto+LibTLS: Switch to the generic SECPxxxr1 implementation 2023-11-27 09:43:07 +03:30
Michiel Visser
59c22c0349 Tests/LibCrypto: Add tests for SECP384r1 curve 2023-11-27 09:43:07 +03:30
Michiel Visser
8a487f2c26 LibCrypto: Add generic SECPxxxr1 elliptic curve implementation
This implementation can be used to provide the SECP256r1 and SECP384r1
elliptic curves, while only requiring a single implementation.
2023-11-27 09:43:07 +03:30
Michiel Visser
51fe8f820f AK: Fix compile error when using div_mod_internal<513, 256, true> 2023-11-27 09:43:07 +03:30
Michiel Visser
e785172290 LibTLS: Implement the extended_master_secret TLS extension 2023-11-27 09:37:25 +03:30
Michiel Visser
5ab64320b2 LibTLS: Compute the master secret in a single place
Before we were computing the master secret in the different
`build_*_pre_master_secret` methods, but this can be simplified to a
single call.
2023-11-27 09:37:25 +03:30
Michiel Visser
0db6e0449e LibCrypto: Add method to copy Crypto::Hash::Manager 2023-11-27 09:37:25 +03:30
Nico Weber
f34da6396f LibPDF: Update font size after getting font from cache
Page 1 of 0000277.pdf does:

    BT 22 0 0 22  59  28 Tm /TT2 1 Tf
        (Presented at Photonics West OPTO, February 17, 2016) Tj ET
    BT 32 0 0 32 269 426 Tm /TT1 1 Tf
        (Robert W. Boyd) Tj ET
    BT 22 0 0 22 253 357 Tm /TT2 1 Tf
        (Department of Physics and) Tj ET
    BT 22 0 0 22 105 326 Tm /TT2 1 Tf
        (Max-Planck Centre for Extreme and Quantum Photonics) Tj ET

Every line begins a text operation, then updates the font matrix,
selects a font (TT2, TT1, TT2, TT1), draws some text and ends the text
operation.

`Tm` (which sets the font matrix) contains a scale, and uses that
to update the font size of the currently-active font (cf #20084).
But in this file, we `Tm` first and `Tf` (font selection) second,
so this updates the size of the old font. So when we pull it out
of the cache again on line 3, it would still have the old size
from the `Tm` on line 2.

(The whole text scaling logic in LibPDF imho needs a rethink; the
current approach also causes issues with zero-width glyphs which
currently lead to divisions by zero. But that's for another PR.)

Fixes another regression from c8510b58a3 (which I've accidentally
referred to by 2340e834cd in another commit).
2023-11-26 19:05:13 -05:00
Aliaksandr Kalenik
17fb82d49b LibAccelGfx+LibWeb: Discard painting of commands outside of viewport 2023-11-26 21:26:26 +01:00
Aliaksandr Kalenik
c68a9b2cfe LibAccelGfx: Skip glyph atlas rebuild if all needed glyphs are present
Before this change, every repaint required a glyph atlas update, which
took 10-20% of the total painting time according to my testing on
different websites. This change improves that significantly by skipping
atlas updated when all glyphs are already present in the texture.
2023-11-26 21:26:26 +01:00
Aliaksandr Kalenik
28723d8be1 LibAccelGfx+LibWeb: Move glyph atlas into a singleton class
This is going to allow us reuse glyph texture across painters and page
repaints.
2023-11-26 21:26:26 +01:00
Aliaksandr Kalenik
4b23046a22 LibWeb: Add missing nullptr check in HTMLImageElement::bitmap()
Fixes crashing on https://discord.com/login
2023-11-26 21:26:09 +01:00
Andreas Kling
b2a1f39400 LibJS/JIT: Add fast path for JumpConditional where accumulator is Int32 2023-11-26 19:32:51 +01:00
Andreas Kling
cb46a7fd65 LibJS: Add specialized fast paths for 8/16/32-bit integer TypedArrays
By checking a few conditions up front, we can do a very specialized
direct access into the underlying byte storage for 8/16/32-bit typed
arrays. This relies on the fact that typed arrays are guaranteed to
be type-appropriately aligned within the underlying array buffer.
2023-11-26 19:32:51 +01:00
Andreas Kling
4cce181ece LibJS: Devirtualize Object::is_typed_array() 2023-11-26 19:32:51 +01:00
Andreas Kling
d154a758fa LibJS: Devirtualize TypedArrayBase::kind()
Let's put this in a member variable to avoid the virtual call.
2023-11-26 19:32:51 +01:00
Timothy Flynn
3fcb07597b LibWeb: Remove now-unneeded TypedArray OOM propagation
No longer throws after abcf71a8ca.
2023-11-26 08:23:37 -05:00
Aliaksandr Kalenik
a1c8fb10fa LibAccelGfx+LibWeb: Add texture cache for immutable bitmaps
This change introduces a texture cache for immutable bitmaps in the
GPU painter. The cache is persisted across page repaints, so now, on
page scroll repaint, in many cases, we won't need to upload any new
textures. Also, if the same image is painted more than once on a page,
its texture will only be uploaded once.

Generally, the GPU painter works much faster with this change on all
pages that have images.
2023-11-26 12:55:43 +01:00
Aliaksandr Kalenik
f4a5c136c3 LibGfx+LibWeb: Add ImmutableBitmap for images bitmap caching in painter
Before this change, we used Gfx::Bitmap to represent both decoded
images that are not going to be mutated and bitmaps corresponding
to canvases that could be mutated.

This change introduces a wrapper for bitmaps that are not going to be
mutated, so the painter could do caching: texture caching in the case
of GPU painter and potentially scaled bitmap caching in the case of CPU
painter.
2023-11-26 12:55:43 +01:00
Andreas Kling
abcf71a8ca LibJS: Remove unnecessary ThrowCompletionOr return types in TypedArray
We used to need these because we worried about tiny OOM errors.

Work towards #20449
2023-11-26 10:33:56 +01:00
Andreas Kling
1bc58333f8 LibJS: Add common fast path for GetByValue from TypedArray
Same exact idea as the previous commit, just for GetByValue. :^)
2023-11-26 10:14:55 +01:00
Andreas Kling
51ac0d8821 LibJS: Add common fast path for PutByValue into TypedArray
When putting to a numeric indexed property, we can skip a lot of the
ceremony and go directly to IntegerIndexedElementSet. :^)
2023-11-26 10:14:55 +01:00
Idan Horowitz
743a9e9ebf Kernel: Stop including the ethernet header in LoopbackAdapter's mtu
The networking subsystem currently assumes all adapters are Ethernet
adapters, including the LoopbackAdapter, so all packets are pre-pended
with an Ethernet Frame header. Since the MTU must not include any
overhead added by the data-link (Ethernet in this case) or physical
layers, we need to subtract it from the MTU.

This fixes a kernel panic which occurs when sending a packet that is at
least 65523 bytes long through the loopback adapter, which results in
the kernel "receiving" a packet which is larger than the support MTU
out the other end. (As the actual final size was increased by the
addition of the ethernet frame header)
2023-11-25 16:34:38 +01:00
Idan Horowitz
16a53c811e Kernel: Treat a backlog argument of 0 to listen() as if it was 1
As per POSIX, the behavior of listen() with a backlog value of 0 is
implementation defined: "A backlog argument of 0 may allow the socket
to accept connections, in which case the length of the listen queue may
be set to an implementation-defined minimum value."
Since creating a socket that can't accept any connections seems
relatively useless, and as other platforms (Linux, FreeBSD, etc) chose
to support accepting connections with this backlog value, support it as
well by normalizing it to 1.
2023-11-25 16:34:38 +01:00
Aliaksandr Kalenik
afe24883b7 LibWeb: Remove exit for javascript urls in anchor activation_behavior()
This early return is no longer needed because Navigable::navigate()
can process `javascript:` urls.

Fixes https://github.com/SerenityOS/serenity/issues/22052
2023-11-25 16:33:54 +01:00
Dan Klishch
80d1c93edf AK+Applications: Return value from JsonObject::get_double more often
Previously, we were returning an empty optional if key contained a
numerical value which was not stored as double. Stop doing that and
rename the method to signify the change in the behavior.

Apparently, this fixes bug in an InspectorWidget in Ladybird on
Serenity: it showed 0 for element's boxes with integer sizes.
2023-11-25 11:02:17 +01:00