Commit graph

2453 commits

Author SHA1 Message Date
Ali Mohammad Pur a60ecea16a LibWasm+LibWeb+test-wasm: Refcount Wasm::Module for function references
Prior to funcref, a partial chunk of an invalid module was never needed,
but funcref allows a partially instantiated module to modify imported
tables with references to its own functions, which means we need to keep
the second module alive while that function reference is present within
the imported table.
This was tested by the spectests, but very rarely caught as our GC does
not behave particularly predictably, making it so the offending module
remains in memory just long enough to let the tests pass.

This commit makes it so all function references keep their respective
modules alive.
2024-08-22 09:36:40 +02:00
Andreas Kling aabad3b94e LibGfx: Remove a bunch of no-longer-used OpenType font code
We're not quite ready to remove the old OpenType implementation yet,
but let's carve off some unused stuff.
2024-08-20 09:30:05 +02:00
Andrew Kaster 804729fe37 Libraries+Ladybird: Rename LibProtocol -> LibRequests
The identifier "Protocol" is claimed by Objective-C and Swift for use
by the language's built-in protocol conformance feature, which is
similar to Rust traits or Java interfaces.

Rename LibProtocol -> LibRequests, and its namespace from Protocol to
Requests to accomodate this.
2024-08-19 12:56:55 +02:00
Diego Frias 4e7d3026d2 LibWasm+LibWeb: Allow tables to have externrefs in the JS API 2024-08-18 23:35:02 +02:00
Diego Frias a58704296c LibWasm: Remove type information from Value
Gets fib(30) from 380ms to 340ms.
2024-08-07 01:10:20 +02:00
Shannon Booth cc55732332 LibURL+Everywhere: Only percent decode URL paths when actually needed
Web specs do not return through javascript percent decoded URL path
components - but we were doing this in a number of places due to the
default behaviour of URL::serialize_path.

Since percent encoded URL paths may not contain valid UTF-8 - this was
resulting in us crashing in these places.

For example - on an HTMLAnchorElement when retrieving the pathname for
the URL of:

http://ladybird.org/foo%C2%91%91

To fix this make the URL class only return the percent encoded
serialized path, matching the URL spec. When the decoded path is
required instead explicitly call URL::percent_decode.

This fixes a crash running WPT URL tests for the anchor element on:

https://wpt.live/url/a-element.html
2024-08-05 09:58:13 +02:00
Diego Frias 23cfee2205 LibWasm: Clean up module sections API
Remove `for_each_section_of_type` in favor of making the module's
sections defined as distinct fields. This means it is no longer possible
to have two of the same section (which is invalid in WebAssembly, for
anything other than custom sections).
2024-08-01 11:44:07 +02:00
Timothy Flynn 5f8d852dae LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
2024-08-01 11:38:42 +02:00
Ali Mohammad Pur d3f089dc26 Utilities/js: Make it possible to exit via two consecutive ^C's
Apparently this is common in the js repl world.
Fixes #743.
2024-07-27 11:49:45 +01:00
circl 3adfdd3257 UI: Rename s_serenity_resource_root to s_ladybird_resource_root 2024-07-21 15:59:25 -06:00
Aliaksandr Kalenik 3627329bed Everywhere: Use Skia painter by default
Skia painter is visibly faster than LibGfx painter and has more complete
CSS transforms support. With this change:
- On Linux, it will try to use Vulkan-backend with fallback to
  CPU-backend
- On macOS it will try to use Metal-backend with fallback to
  CPU-backend
- headless-browser always runs with CPU-backend in layout mode
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik 9851176c25 headless-browser: Disable screenshot tests on macOS
LibGfx's output is consistent across different platforms, which allows
us to have one set of expectations for screenshot tests. This
consistency will not hold for Skia, where features like antialiasing and
gradient color interpolation vary slightly depending on the platform. In
upcoming changes, we are going to switch to using Skia as the default
painter, which leaves us with the following options:

- Have per-platform screenshot test expectations.
- Limit screenshot tests to run only on one platform and maintain a
  single set of expectation files.

For now, I have decided to choose the latter option, using Linux as it
seems to be the most popular platform among developers.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik 715f033007 Tests+headless-browser: Move screenshot ref-tests into own directory
This change will make it easier to disable screenshot comparison tests
on a specific platform or have per-platform expectations.

Additionally, it's nice to be able to tell if a ref-test uses a
screenshot as an expectation by looking at the test path.
2024-07-19 13:52:00 +02:00
Ali Mohammad Pur 16dd8d4d3b LibWasm/WASI+wasm: Make WASI exit() "noreturn" instead of making it exit
This makes it so exit() traps with a known error; an embedder (wasm.cpp)
can simply match this format and handle the request accordingly.
2024-07-18 14:54:50 +02:00
Andrew Kaster 1529f5469c LibGfx+icc: Prefix AK::FixedPoint with AK Namespace 2024-07-18 09:43:38 +01:00
Aliaksandr Kalenik 2f515827c0 Everywhere: Rename Gfx::OpenType::Font to Gfx::OpenType::Typeface
It's a leftover from VectorFont -> Typeface renaming
2024-07-13 09:31:02 +02:00
Diego e8fd8982f8 LibWasm: Give names to functions exported to JS via ref.func
https://webassembly.github.io/spec/js-api/index.html#name-of-the-webassembly-function
2024-07-10 00:37:18 +02:00
Aliaksandr Kalenik 067bb64eb5 headless-browser: Add CLI argument to enable Skia painter
Useful to check what ref-tests are currently broken with Skia painter.
2024-07-08 19:46:33 +01:00
Andrew Kaster 4cc3d598f9 LibWebView+LibCore: Manage process lifecycle using a SIGCHLD handler
This large commit also refactors LibWebView's process handling to use
a top-level Application class that uses a new WebView::Process class to
encapsulate the IPC-centric nature of each helper process.
2024-07-01 18:10:56 +02:00
Andrew Kaster 4b5541e1b7 Everywhere: Transition ImageDecoder to be single-instance, owned by UI
This is the same behavior as RequestServer, with the added benefit that
we know how to gracefully reconnect ImageDecoder to all WebContent
processes on restart.
2024-06-26 16:09:33 -06:00
circl e5018d2a7a Utilities: Remove zip and unzip
They are not even being compiled
2024-06-24 09:45:41 -06:00
circl 84ed7e0a63 Userland: Remove unused CMakeLists.txt files
Seems that Meta/Lagon/CMakeLists.txt does their job instead, and that
this is a leftover from the SerenityOS build system.
2024-06-24 09:45:41 -06:00
Timothy Flynn ebdb92eef6 LibUnicode+Everywhere: Merge LibLocale back into LibUnicode
LibLocale was split off from LibUnicode a couple years ago to reduce the
number of applications on SerenityOS that depend on CLDR data. Now that
we use ICU, both LibUnicode and LibLocale are actually linking in this
data. And since vcpkg gives us static libraries, both libraries are over
30MB in size.

This patch reverts the separation and merges LibLocale into LibUnicode
again. We now have just one library that includes the ICU data.

Further, this will let LibUnicode share the locale cache that previously
would only exist in LibLocale.
2024-06-23 19:52:45 +02:00
Zaggy1024 7c10e1a08d LibMedia: Rename LibVideo to LibMedia
This change is in preparation for implementing audio codecs into the
library and using audio as timing for video playback.
2024-06-19 07:51:55 +02:00
Andreas Kling 1039acca8c LibGfx: Remove JPEG2000 image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling 681a2ac14e LibGfx: Remove support for the various "portable" image formats
These formats are not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling 4b4254c3d0 LibGfx: Remove QOI image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling 2a888ca626 LibGfx: Remove home-grown JPEG codec in favor of libjpeg-turbo 2024-06-17 17:59:54 +02:00
circl c169e43e13 Userland: Remove some SerenityOS checks 2024-06-10 13:53:01 +02:00
Andrew Kaster aef6ece9e6 Meta: Remove shred utility 2024-06-06 09:43:51 -06:00
Timothy Flynn 8362c073f3 Everywhere: Remove LibSQL, SQLServer, and the sql REPL :^)
It is now entirely unused and replaced by sqlite3.
2024-06-06 11:27:03 -04:00
Timothy Flynn 30e745ffa7 LibWebView: Replace usage of LibSQL with sqlite3
This makes WebView::Database wrap around sqlite3 instead of LibSQL. The
effect on outside callers is pretty minimal. The main consequences are:

1. We must ensure the Cookie table exists before preparing any SQL
   statements involving that table.
2. We can use an INSERT OR REPLACE statement instead of separate INSERT
   and UPDATE statements.
2024-06-06 11:27:03 -04:00
Andrew Kaster 90af26e309 Meta+CMake: Remove unused CMake functions and features
Goodbye, serenity_components and Jakt.
2024-06-05 12:23:54 -04:00
Aliaksandr Kalenik 5285e22f2a LibWeb+WebContent: Move scrollbar painting into WebContent
The main intention of this change is to have a consistent look and
behavior across all scrollbars, including elements with
`overflow: scroll` and `overflow: auto`, iframes, and a page.

Before:
- Page's scrollbar is painted by Browser (Qt/AppKit) using the
  corresponding UI framework style,
- Both WebContent and Browser know the scroll position offset.
- WebContent uses did_request_scroll_to() IPC call to send updates.
- Browser uses set_viewport_rect() to send updates.

After:
- Page's scrollbar is painted on WebContent side using the same style as
  currently used for elements with `overflow: scroll` and
  `overflow: auto`. A nice side effects: scrollbars are now painted for
  iframes, and page's scrollbar respects scrollbar-width CSS property.
- Only WebContent knows scroll position offset.
- did_request_scroll_to() is no longer used.
- set_viewport_rect() is changed to set_viewport_size().
2024-06-05 07:03:42 +02:00
Andreas Kling 30a92911fa WebContent: Remove update_system_fonts() IPC message
This was no longer doing anything. We'll eventually want a way to pass
system default fonts to each WebContent process, but we don't need to
squeeze everything through this API that was really meant for Serenity's
very idiosyncratic font system.
2024-06-04 18:45:30 +02:00
Andreas Kling f78ed0600a LibGfx: Remove FontDatabase "default queries"
At last, nothing depends on these anymore.
2024-06-04 18:45:30 +02:00
Andreas Kling f2fd8fc928 Everywhere: Remove LibGemini
This hasn't been maintained (or worked at all) for a long time,
and it's not a widely supported protocol, so let's drop it.
2024-06-04 09:19:39 +02:00
Andreas Kling e70d96e4e7 Everywhere: Remove a lot more things we don't need 2024-06-03 10:53:53 +02:00
Tim Ledbetter 5863ef852d Meta: Remove references to unused utilities 2024-06-03 10:53:53 +02:00
Andrew Kaster dd1fbd3513 Meta: Remove SerenityOS components not needed for Ladybird 2024-06-03 10:53:53 +02:00
Liav A. a7aa843bcc Utilities/tar: Open archive file before changing directory
Otherwise the utility will fail to open the archive file because it's
presumably not in the chosen directory.
2024-06-01 18:35:31 +02:00
Nico Weber 8a21992030 image: Add a --webp-allowed-transforms switch
This is mainly useful for testing.
2024-05-31 22:39:25 +02:00
Romain Chardiny f5cacf25e1 Utilities: Add shred utility 2024-05-31 13:49:34 +01:00
Matthew Olsson 9ea6ab0ad4 LibJS+LibWeb: Fix a ton of JS_CELL-like macro issues 2024-05-30 09:29:20 -06:00
Daniel Bertalan 9d3b73743e sql: Work around Clang 17/18 run-time call to consteval function
There was an issue with Clang that causes `consteval` function calls
from default initializers of fields to be made at run-time. This
manifested itself in the case of `ByteString::formatted` as an undefined
reference to `check_format_parameter_consistency` once format string
checking was enabled for Clang builds. The workaround is simple (just
move it to the member initializer list), and unblocks a useful change.
2024-05-29 13:34:15 -06:00
Timothy Flynn 168d28c15f LibProtocol+Userland: Support unbuffered protocol requests
LibWeb will need to use unbuffered requests to support server-sent
events. Connection for such events remain open and the remote end sends
data as HTTP bodies at its leisure. The browser needs to be able to
handle this data as it arrives, as the request essentially never
finishes.

To support this, this make Protocol::Request operate in one of two
modes: buffered or unbuffered. The existing mechanism for setting up a
buffered request was a bit awkward; you had to set specific callbacks,
but be sure not to set some others, and then set a flag. The new
mechanism is to set the mode and the callbacks that the mode needs in
one API.
2024-05-26 18:29:24 +02:00
Matthew Olsson a98ad191c7 Userland: Add ESCAPING annotations to a bunch of places
This isn't comprehensive; just a result of a simple grep search.
2024-05-22 21:55:34 -06:00
Lucas CHOLLET bee8dd76ee LibGfx/GIF: Write the netscape extension block
This allows us to encode the required number of loops in the file.
2024-05-22 13:29:05 -04:00
Lucas CHOLLET 777e84b09b LibGfx+animation: Support writing animated GIF files 2024-05-21 09:47:46 +02:00
Liav A 40a8b009db DynamicLoader: Add an option to list all ELF loaded dependencies
This actually allows us to re-introduce the ldd utility as a symlink to
our dynamic loader, so now ldd behaves exactly like on Linux - it will
load all dynamic dependencies for an ELF exectuable.

This has the advantage that running ldd on an ELF executable will
provide an exact preview of how the order in which the dynamic loader
loads the executable and its dependencies.
2024-05-14 15:42:42 -06:00