Commit graph

3525 commits

Author SHA1 Message Date
Ali Mohammad Pur 7f39142f0f Meta: Show GML formatting issues after lint 2024-04-30 17:46:41 -06:00
Ali Mohammad Pur f3a4118aee GMLCompiler+LibGUI: Add support for object properties and undo hack
Previously the GML compiler did not support object properties such as
`content_widget: @GUI::Widget{}` for GUI::ScrollableContainerWidget;
this commit adds support for such properties by simply calling
`set_<key>(<TProperty>&)` on the object.
This commit also removes the previous hack where
ScrollableContainerWidget was special-cased to have its singular child
used as the content widget; the only GML file using this behaviour was
also changed to be in line with 'proper' GML as handled by the GML
Playground.
2024-04-30 17:46:41 -06:00
Ali Mohammad Pur 5c17b61378 GMLCompiler: Use synthetic widget definition when original is missing
This makes it possible to use externally defined toplevel widgets that
have no C++ header defining them.
Note that this only allows widget-native properties on the object, as
the actual original definition is not available.
2024-04-30 17:46:41 -06:00
Andrew Kaster 37a0466285 CMake: Resolve FIXMEs related to CMake < 3.20
We already have required this version for quite a while for Lagom,
Ladybird and Serenity. Now that we require it in all of our CMakeLists,
let's scrub for better ways of writing things.
2024-04-30 07:14:17 -06:00
Andrew Kaster 65bfd2ca2d CMake: Bump Superbuild CMake requirement to 3.20
This more closely matches the serenity requirement (3.25), the Lagom
requirement (3.21) and the Ladybird requirement (3.23)
2024-04-30 07:14:17 -06:00
Timothy Flynn 1b859bac64 Meta: Port recent changes to the GN build
cd07249482
acd5369774
7d05fe84bc
2024-04-30 06:02:15 -06:00
Idan Horowitz c96730c984 Meta: Enable networking by default on RISC-V 2024-04-30 06:01:26 -06:00
Andrew Kaster bc976fe7e1 LibWebView: Create plumbing for a single UI process
This allows main UI processes created while there is a currently
running one to request a new tab or a new window with the initial urls
provided on the command line. This matches (almost) the behavior of
Chromium and Firefox.

Add a new IPC protocol between two UI processes. The main UI process
will create an IPC server socket, while secondary UI processes will
connect to that socket and send over the URLs and action it wants the
main process to take.
2024-04-27 20:32:12 -04:00
Shannon Booth 22705e3065 LibWeb: Don't generate Bindings/Forward.h
This is no longer used.
2024-04-27 18:29:35 -04:00
Shannon Booth bad44f8fc9 LibWeb: Remove Bindings/Forward.h from LibWeb/Forward.h
This was resulting in a whole lot of rebuilding whenever a new IDL
interface was added.

Instead, just directly include the prototype in every C++ file which
needs it. While we only really need a forward declaration in each cpp
file; including the full prototype header (which itself only includes
LibJS/Object.h, which is already transitively brought in by
PlatformObject) - it seems like a small price to pay compared to what
feels like a full rebuild of LibWeb whenever a new IDL file is added.

Given all of these includes are only needed for the ::initialize
method, there is probably a smart way of avoiding this problem
altogether. I've considered both using some macro trickery or generating
these functions somehow instead.
2024-04-27 18:29:35 -04:00
Shannon Booth de2cad02aa LibWeb: Factor out a function to generate IDL enumerations
The prototype header generation was getting a bit long.

This is also a step towards generating code for IDL files only
containing an enum definition without any interface. In that case we
can't put the enum definitions alongside the prototype - there is no
prototype to speak of.
2024-04-27 07:11:02 +02:00
Shannon Booth 4a62268d73 LibWeb: Do not handle an invalid enum in idl_enum_to_string
We should never hit this case - so don't generate code for it, and
instead put in a VERIFY_NOT_REACHED.

Also improve the formatting of the generated code to closer match the
serenity code style.
2024-04-27 07:11:02 +02:00
Shannon Booth 10add8aa8a LibWeb: Improve error message for IDL generation with missing interface
Instead of a cryptic error that occurs due to an interface with no name,
fail early on by explicitly checking that an interface was parsed with a
name.
2024-04-27 07:11:02 +02:00
Dan Klishch be9ca65179 Meta: Use stripped-down version of LibELF on Lagom 2024-04-26 19:08:13 -06:00
Tim Ledbetter 1127fa1e01 IDLGenerators: Set namespace object prototype to Object.prototype
Previously, namespace objects were constructed with no prototype, so
calling methods like `toString()` on them would unexpectedly throw an
exception.
2024-04-26 20:02:42 +02:00
Tim Ledbetter 3eb07a9b8b IDLGenerators: Don't duplicate include statements for each import
Previously, all `#import` statements generated two identical includes
in the generated C++ source code.
2024-04-26 08:00:32 -04:00
Tim Ledbetter ddd1ac1e36 LibWeb: Add a custom extended attribute for namespace-level finalization
This change adds the `WithFinalizer` extended attribute, which allows
namespaces to call a custom function at the point they are finalized.
2024-04-26 13:56:39 +02:00
Tim Ledbetter 6d4b8bde55 LibWeb: Isolate WebAssembly cache by global object
This change moves WebAssembly related data that was previously globally
accessible into the `WebAssemblyCache` object and creates one of these
per global object. This ensures that WebAssembly data cannot be
accessed across realms.
2024-04-26 13:56:39 +02:00
Tim Ledbetter 5e75afd549 LibWeb: Fix typo in extended WithGCVisitor extended attribute name 2024-04-26 13:56:39 +02:00
Idan Horowitz 8a86218e25 Meta: Support debugging the riscv64 kernel 2024-04-26 09:52:56 +02:00
Idan Horowitz 904ebb74a9 Kernel: Use NVME polling by default on RISC-V
Since we don't support the RISC-V PLIC yet, we can't actually use
interrupt-based NVME handling.
2024-04-26 09:52:56 +02:00
Idan Horowitz 6d255fb92b Meta: Enable graphics by default on RISCV64 2024-04-26 09:52:56 +02:00
Andrew Kaster ce9eed918f ImageDecoder: Schedule decode jobs on the LibThreading background thread
This allows the ImageDecoder service to handle new IPC requests while
decoding in parallel.
2024-04-26 09:41:24 +02:00
Timothy Flynn 1560d6ad62 LibCore: Remove the now-obsolete SingletonProcess helper files 2024-04-24 15:51:58 -06:00
Timothy Flynn ec492a1a08 Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-18 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.mm" -o -name "*.h")

There are a couple of weird cases where clang-format now thinks that a
pointer access in an initializer list, e.g. `m_member(ptr->foo)`, is a
lambda return statement, and it puts spaces around the `->`.
2024-04-24 16:50:01 -04:00
Timothy Flynn 823fdb83db Meta: Switch to clang-format-18 as the standard formatter 2024-04-24 16:50:01 -04:00
Timothy Flynn 891c4ac68e CI: Bust the toolchain ccache when the toolchain's major version changes
The build will be entirely clean anyways, so no need to preserve the
previous version's ccache.
2024-04-24 16:49:50 -04:00
Timothy Flynn 4cc8266727 CI: Do not prune the toolchain ccache
Currently, if the prebuilt toolchain cache gets used, we will not try to
build the toolchain. Thus, the toolchain's ccache does not get used, and
is then pruned entirely at the end of the run.

So for now, let's just not prune the toolchain ccache. After a few years
it only reached 0.8 GB in size. And now that we are starting from empty
again, it would likely be a few more years before we reach 0.8 GB again.
2024-04-24 16:49:50 -04:00
Timothy Flynn 90fcfca6f6 CI: Configure ccache before modifying its contents (if any)
If there is a cache miss while downloading the ccache from GitHub/Azure,
the .ccache directory won't exist when we try to update the modification
time of its contents. Configure the ccache size first, which will create
the .ccache directory if it doesn't exist.
2024-04-24 09:16:41 -04:00
Andrew Kaster 7b06417ccf CI: Test using Clang for ASAN+UBSAN on Linux, add nightly GCC job
Clang builds of ASAN+UBSAN on Linux take significantly less time on the
Azure CI runners. Measured times were 82 minutes for Clang 18 and
112 minutes for GCC 13, with no cache.

To keep our coverage of Ladybird builds + testing with GCC, add a
nightly job to run through the full test cycle on GCC 13.
2024-04-23 21:16:53 -06:00
Tim Schumacher 5f088f3233 Meta: Trim the CI ccache down to files used in the current build 2024-04-23 22:00:07 -04:00
Andrew Kaster 0555650387 CI: Use macOS 13 x86_64 runner in Azure DevOps
Sadly the Apple Silicon runners GitHub Actions has now are not yet
available in ADO. However, we can still bump the version to Ventura.
2024-04-23 15:37:07 -06:00
Andrew Kaster 2e385e4c12 CI: Bump Lagom CI builds to gcc-13 and clang-18
This includes Lagom Tools for Serenity builds, and the Lagom builds on
Azure.
2024-04-23 15:37:07 -06:00
Timothy Flynn f16f89eb32 Ladybird+LibWebView: Move SQLServer launcher to Ladybird
It previously resided in LibWebView to hide the details of launching a
singleton process. That functionality now lives in LibCore. By moving
this to Ladybird, we will be able to register the process with the task
manager.
2024-04-22 14:46:10 -06:00
Timothy Flynn bf50881e61 LibCore+LibSQL+LibWebView: Move launching a singleton process to LibCore
This just moves the code to launch a single process such as SQLServer to
LibCore. This will allow re-using this feature for other processes, and
will allow moving the launching of SQLServer to Ladybird.
2024-04-22 14:46:10 -06:00
Timothy Flynn 5dd3b91f0e LibCore+LibWebView: Move process statistics to LibCore
This will be needed to collect statistics from processes that do not
have anything to do with LibWebView. The ProcessInfo structure must be
virtual to allow callers to add application-specific information.
2024-04-22 14:46:10 -06:00
Timothy Flynn ac594fae5e Meta: Port recent changes to the GN build
376427380e
2024-04-22 14:46:10 -06:00
Daniel Bertalan 2f43b4ff15 Meta: Enable HVF acceleration on x86_64 macOS 2024-04-22 14:04:02 -06:00
Shannon Booth 1ec6399c00 Everywhere: Remove uneeded short option argument where possible 2024-04-22 08:10:08 +02:00
Dan Klishch d8119c4b4a LibLocale: Statically link LibLocaleData into LibLocale 2024-04-21 13:34:04 -06:00
Andreas Kling 1068518bdf LibLocale: Use String::from_utf8_without_validation() in generated code
The unnecessary UTF-8 validation performed here was actually visible
while profiling navigation between pages on GitHub.
2024-04-21 19:32:49 +02:00
Jess f4c8f1a346 Meta: Add ASAN option allocator_may_return_null=1 to CI
This stops ASAN from complaining about massive allocations.
2024-04-20 19:23:46 -04:00
Andrew Kaster 5e1d678bae Ladybird+Userland: Remove use of unnecessary fd passing socket concept
Now that LibIPC is using SCM_RIGHTS properly, we can go back to only
having one socket laying around when needing to transfer fds to peers.
2024-04-19 16:38:55 -04:00
Andrew Kaster cb87725ec8 LibIPC+LibWeb: Transfer IPC::Files using sendmsg/recvmsg directly
This refactor eliminates the need for a second "fd passing socket" on
Lagom, as it uses SCM_RIGHTS in the expected fashion, to send fds along
with the data of our Unix socket message.
2024-04-19 16:38:55 -04:00
Timothy Flynn 5a3efb8842 LibLocale: Update to CLDR version 45.0.0
https://cldr.unicode.org/index/downloads/cldr-45
2024-04-19 11:00:31 +02:00
Timothy Flynn 7e51d6e07d Meta: Port recent changes to the GN build
e487f70bbf
f4f4f7781d
2024-04-19 11:00:31 +02:00
Nico Weber ea441fea95 LibGfx: Move QMArithmeticDecoder to its own file
It will be used by the JPEG2000 decoder as well.

Pure code move, no behavior change.
2024-04-19 10:59:11 +02:00
Dan Klishch b8c3e75573 Meta+Userland: Fix more instances of bad lambda-Variant interaction
These don't cause compilation to fail but they still crash crashd.
2024-04-18 13:14:33 -06:00
Andrew Kaster c87e32154a Ladybird+headless-browser: Make RequestServer single instance on Lagom
Co-Authored-By: Timothy Flynn <trflynn89@pm.me>
2024-04-17 10:09:49 -04:00
Andrew Kaster 336b661835 Ladybird: Move QApplication class to its own file
We'll attach some global data to it in an upcoming commit, so it needs
to be accessible outside of main.cpp.
2024-04-17 10:09:49 -04:00
Jamie Mansfield 2d90317c20 LibWeb: Implement <desc> SVG element 2024-04-17 07:17:27 +02:00
Andreas Kling f4f4f7781d Ladybird+LibWeb: Add optional IDL call tracing
When launched with the new --enable-idl-tracing option, we now log
every call to web platform APIs declared via IDL, along with the
arguments passed.

This can be very helpful when trying to figure out what a site is
doing, especially if it's not doing what you'd expect.
2024-04-16 16:57:06 +02:00
Space Meyer 5d89d3090e Kernel: Add KCOV recursion debugging 2024-04-15 21:16:22 -06:00
Space Meyer 8050ef24a6 Meta: Correct kaddr2line example in serenity.sh 2024-04-15 21:16:22 -06:00
Aryan Baburajan d6ca054935 GMLCompiler: GML compile compatibility for ScrollableContainerWidget 2024-04-15 14:01:13 +02:00
Aliaksandr Kalenik ccb363c443 LibWeb: Add hashchange event support 2024-04-15 01:02:51 -07:00
Timothy Flynn 6eb2052d40 LibWebView: Remove now-unused history object 2024-04-14 18:53:58 -07:00
Nico Weber 3b89a187ac Meta/gn: Port #23933 2024-04-13 19:30:53 -06:00
Timothy Flynn 3ab5ecb671 Ladybird/AppKit: Implement a simple TaskManager window
Unlike the Inspector window, this is owned by the ApplicationDelegate as
there should be only a single task manager for the entire application.
2024-04-12 09:08:16 +02:00
Timothy Flynn 058dd225dd Meta: Port recent changes to the GN build
f3d3454976
8fa636d8d5
2024-04-11 18:41:57 +02:00
Timothy Flynn b5ebbe6159 Meta: Port recent changes to the GN build
676fc5e8c6
b873e5bc1d
2024-04-10 07:46:42 +02:00
Andrew Kaster 8c5e64e686 Ladybird+LibWebView: Add mechanism to get Mach task port for helpers
On macOS, it's not trivial to get a Mach task port for your children.
This implementation registers the chrome process as a well-known
service with launchd based on its pid, and lets each child process
send over a reference to its mach_task_self() back to the chrome.

We'll need this Mach task port right to get process statistics.
2024-04-09 16:43:27 -06:00
Andrew Kaster 77f18cf062 LibCore: Add a rough abstraction class around Mach port rights 2024-04-09 16:43:27 -06:00
Matthew Olsson abb4b6d117 LibJSGCVerifier: Detect missing JS_CELL() calls 2024-04-09 09:13:06 +02:00
Matthew Olsson 312bc94ac9 LibJSGCVerifier: Detect missing JS_DECLARE_ALLOCATOR() calls
C++ classes that inherit from JS::Cell and are leaf classes should have
their own type-specific allocator. We also do this for non-leaf classes
that are constructable from JS.

To do this, JSON messages are passed to communicate information about
each class the Clang tool comes across. This is the only message we have
to worry about for now, but in the future if we want to transmit
different kinds of information, we can make this message format more
generic.
2024-04-09 09:13:06 +02:00
Matthew Olsson dfce95ab0f LibJSGCVerifier: Support message passing between Clang processes
This allows each Clang process to send JSON messages to the
orchestrating Python process, which aggregates the message and can do
something with them all at the end. This is required because we run
Clang multithreaded to speed up the tool execution.

I did try to add a second frontend tool that accepts all the files at
once, but it was _extremely_ slow, so this is the next best thing.
2024-04-09 09:13:06 +02:00
Matthew Olsson 76fa127cbf LibJSGCVerifier: Detect stack-allocated ref captures in lambdas
For example, consider the following code snippet:

    Vector<Function<void()>> m_callbacks;
    void add_callback(Function<void()> callback)
    {
    	m_callbacks.append(move(callback));
    }

    // Somewhere else...
    void do_something()
    {
    	int a = 10;
    	add_callback([&a] {
            dbgln("a is {}", a);
    	});
    } // Oops, "a" is now destroyed, but the callback in m_callbacks
      // has a reference to it!

We now statically detect the capture of "a" in the lambda above and flag
it as incorrect. Note that capturing the value implicitly with a capture
list of `[&]` would also be detected.

Of course, many functions that accept Function<...> don't store them
anywhere, instead immediately invoking them inside of the function. To
avoid a warning in this case, the parameter can be annotated with
NOESCAPE to indicate that capturing stack variables is fine:

    void do_something_now(NOESCAPE Function<...> callback)
    {
    	callback(...)
    }

Lastly, there are situations where the callback does generally escape,
but where the caller knows that it won't escape long enough to cause any
issues. For example, consider this fake example from LibWeb:

    void do_something()
    {
    	bool is_done = false;
    	HTML::queue_global_task([&] {
            do_some_work();
            is_done = true;
        });
    	HTML::main_thread_event_loop().spin_until([&] {
            return is_done;
        });
    }

In this case, we know that the lambda passed to queue_global_task will
be executed before the function returns, and will not persist
afterwards. To avoid this warning, annotate the type of the capture
with IGNORE_USE_IN_ESCAPING_LAMBDA:

    void do_something()
    {
   	IGNORE_USE_IN_ESCAPING_LAMBDA bool is_done = false;
    	// ...
    }
2024-04-09 09:10:44 +02:00
Andrew Kaster e5415f6d86 Documentation: Add more specific instructions on how to use the GN build 2024-04-08 18:49:41 -06:00
Lucas CHOLLET 94128fe027 LibWeb: Make CanvasImageSource also be an ImageBitmap 2024-04-08 14:25:36 +02:00
Shannon Booth b873e5bc1d LibWeb: Implement the PointerEvent interface
As defined in: https://w3c.github.io/pointerevents

With the exception of the getCoalescedEvents and getPredictedEvents
APIs.

There are still many other parts of that spec (such as the event
handlers) left to implement, but this does get us at least some of the
way.
2024-04-08 14:25:08 +02:00
Andreas Kling e67f6343f7 LibJSGCVerifier: Warn on missing visit of JS::Value members
A JS::Value can refer to a GC-allocated object, so let's ensure they
are visited when necessary.
2024-04-07 18:01:50 +02:00
Shannon Booth 80658743d3 LibWeb: Generate Optional<NonnullGCPtr<T>> as GCPtr<T>
This is the general pattern which has been adopted in LibWeb, so let's
generate our IDL like this too.
2024-04-07 18:01:05 +02:00
Tim Ledbetter 8324a82409 IPCCompiler: Give a useful error if parameter is unnamed
Previously, parsing would continue if a parameter wasn't given a name
and malformed code would be generated, leading to hard to diagnose
compiler errors.
2024-04-07 07:17:31 +02:00
Tim Ledbetter 076904a59b IPCCompiler: Allow generic parameter types to contain spaces
Previously, a parameter type containing any spaces would cause parsing
to fail.
2024-04-07 07:17:31 +02:00
Matthew Olsson aac873fcec LibWeb: Fix a few "missing visit_edges" warnings from the GC verifier 2024-04-07 07:03:13 +02:00
Matthew Olsson 164db73bdc IDLGenerators: Fix a GCVerifier warning 2024-04-07 07:03:13 +02:00
Matthew Olsson f3096bd4a1 LibJSGCVerifier: Define the NULL constant
Not sure why this throws warnings, but its a simple fix
2024-04-07 07:03:13 +02:00
Idan Horowitz 945c58c7c1 LibUnicode: Generate and use code point composition mappings
These allow us to binary search the code point compositions based on
the first code point being combined, which makes the search close to
O(log N) instead of O(N).
2024-04-06 14:21:04 -04:00
Torben Virtmann 6207405f3d Base: Add and Rework Emoji
- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB

Base: Add and Rework Emoji

- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB

Base: Add and Rework Emoji

- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB

Base: Add and Rework Emoji

- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB

Base: Add and Rework Emoji

- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB

Base: Add and Rework Emoji

- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB

Base: Add and Rework Emoji

- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB

Base: Add and Rework Emoji

- 🛳 - U+1F6F3 PASSENGER SHIP

- 🕷️ - U+1F577 SPIDER
- 🕸️ - U+1F578 SPIDER WEB
2024-04-06 13:40:45 -04:00
Idan Horowitz 9f31a83c2e LibJSGCVerifier: Assume MarkedVector wrapped members are valid
These are effectively heap roots, so they don't need to be visited.
2024-04-06 06:59:36 +02:00
Idan Horowitz f921952cc3 LibJSGCVerifier: Warn about missing visit_edges impls with GC members
Previously we would only warn about missing calls to visit inside
visit_edges implementations, now we warn as well when there's no
visit_edges implementation at all.
2024-04-06 06:59:36 +02:00
Idan Horowitz c84cd1d668 LibJSGCVerifier: Support marking GCPtr members as raw references
This lets us avoid false positives when a GCPtr-wrapped member is only
a weak reference which is automatically updated by the GC when the
member's gc state is updated.
2024-04-06 06:59:36 +02:00
Shannon Booth 0090b916dd LibJS: Make ParserError::to_string infallible 2024-04-05 20:01:37 -04:00
Idan Horowitz 1fd6673f87 LibJSGCVerifier: Support building & running with the Lagom build 2024-04-05 21:49:13 +02:00
Timothy Flynn 683c08744a Userland: Avoid some conversions from rvalue strings to StringView
These are all actually fine, there is no UAF here. But once e.g.
`ByteString::view() &&` is deleted, these instances won't compile.
2024-04-04 11:23:21 +02:00
Timothy Flynn b5f22b6e90 AK+Userland: Remove some needlessly explicit conversions to StringView 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 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 d1fdfead54 LibWebView+Browser: Collect memory and cpu usage for helpers on Serenity 2024-04-03 20:56:33 +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
Luke Wilde 316814988f LibIDL+LibWeb: Add support for static readonly attributes
Support for settable attributes is a FIXME.
2024-04-03 07:55:51 +02:00
Nico Weber 7fc4ea5495 Meta/jbig2_to_pdf.py: Read jbig2 dimensions from file
Since we're parsing segment headers for random-access jbig2 inputs
already, just always do that and get the image dimensions from the
PageInformation segment data. Not all that much more code, and it
makes this script much more pleasant to use.
2024-04-02 15:00:23 -04:00
Nico Weber 05844141bf Meta/jbig2_to_pdf.py: Write correct page contents stream length
The previoulsy hardcoded `25` worked only if the image had width and
height with three digits each (e.g. 399x400).
2024-04-02 15:00:23 -04:00
Nico Weber 2872c37993 Meta/jbig2_to_pdf.py: Allow jbig2 files with random-access organization
jbig2 data in PDFs is in the embedded organization, which is like the
sequential organization with the file header removed.

That means jbig2 files using the random-access organization need to
be transformed to be supported. A random-access jbig2 has all segment
headers at the start, followed by the data of all segments. Decode
all headers and rewrite them to the sequential organization, where
each segment header is followed by that segment's data.

The motivation is that almost all of the jbig2 files in
ghostpdl/test/jbig2 use the random-access organization.
2024-04-02 15:00:23 -04:00
Timothy Flynn de97497d26 Meta: Port recent changes to the GN build
31c0d00ab1
2024-04-02 15:00:15 -04:00
Andrew Kaster fa8b64d59a LibWebView+WebContent: Notify UI process about WebContent PID explicitly
On Serenity, it's not trivial to extract the peer pid from a socket that
is created by SystemServer and then passed to a forked service process.
This patch adds an API to let the WebContent process notify the UI
directly, which makes the WebContent process show up in the Serenity
port's TaskManagerWidget. It seems that we will need to do something of
this sort in order to properly gather metrics on macOS as well, due to
the way that self mach ports work.
2024-04-02 09:52:34 -06:00
Andrew Kaster 096feaaeb8 Ladybird+LibWebView: Add ProcessManager to track live processes
This model will be used to add a Processes tab to the inspector.
2024-04-02 09:52:34 -06:00
Timothy Flynn 51f5fa1437 Meta: Port recent changes to the GN build
3bab4fbae9
a6a40a5bc6
6d72f40d8d
1f59e21829
2024-04-02 07:50:17 +02:00
MacDue 59cd086199 LibWeb: Stub (and implement) SVGSVGElement methods and attributes
This implements trivial functions and stubs out the rest.

Implemented:

```
[SameObject] readonly attribute SVGAnimatedLength x;
[SameObject] readonly attribute SVGAnimatedLength y;
[SameObject] readonly attribute SVGAnimatedLength width;
[SameObject] readonly attribute SVGAnimatedLength height;

undefined deselectAll();

SVGLength createSVGLength();
DOMPoint createSVGPoint();
DOMMatrix createSVGMatrix();
DOMRect createSVGRect();
SVGTransform createSVGTransform();

Element getElementById(DOMString elementId);

unsigned long suspendRedraw(unsigned long maxWaitMilliseconds);
undefined unsuspendRedraw(unsigned long suspendHandleID);
undefined unsuspendRedrawAll();
undefined forceRedraw();
```

Stubbed:

```
attribute float currentScale;
[SameObject] readonly attribute DOMPointReadOnly currentTranslate;

NodeList getIntersectionList(
  DOMRectReadOnly rect, SVGElement? referenceElement);
NodeList getEnclosureList(
  DOMRectReadOnly rect, SVGElement? referenceElement);
boolean checkIntersection(SVGElement element, DOMRectReadOnly rect);
boolean checkEnclosure(SVGElement element, DOMRectReadOnly rect);
```
2024-04-01 21:10:35 +02:00
MacDue a6a40a5bc6 LibWeb: Stub out SVGTransform 2024-04-01 21:10:35 +02:00
Shannon Booth e590e92399 LibWeb: Add HTMLCollection as a platform object
It is returned by the IDL of HTMLAllCollection.
2024-04-01 14:41:00 +02:00
Shannon Booth a09849072e LibWeb: Pass through [EnforceRange] and [Clamp] extended attributes
To the 'convert to int' AO. Nothing actually makes use of the [Clamp]
attribute yet in our implementation, but we may as well add support for
it now since it is trivial to do do.
2024-03-30 21:21:23 +01:00
Idan Horowitz 56b0066485 Meta: Remove explicit default library type for lagom libraries
This partially reverts d1e2d2a4, which made us explicitly specify the
library type for lagom libraries. This broke the fuzzer build, which
relies on the BUILD_SHARED_LIBS cmake variable to enable static builds.
2024-03-30 14:42:15 -04:00
Kenneth Myhra 900a889eb1 LibWeb+LibIDL: Add support for overloading constructors 2024-03-30 19:29:14 +01:00
Kenneth Myhra 09779ab4a6 LibWeb: Add Uint8ClampedArray as supported parameter type
Adds Uint8ClampedArray as supported parameter type to our
BindingsGenerator.
2024-03-30 19:29:14 +01:00
Timothy Flynn 0df7f5bcfc Meta: Port recent changes to the GN build
5dce559ed8
c1b5fe61d1
2024-03-30 07:35:30 +01:00
Timothy Flynn f6ea4bbff8 LibCore: Turn LibCoreMinimal into a normal shared library
We were able to keep LibCoreMinimal a bit smaller as an object library,
but that is causing ODR violations in the fuzzer build (realistically,
should be an issue in all builds, but only the fuzzer actively complains
for some reason).

To make it a shared library, we have to add a couple more symbols to it,
and make LibCore publicly depend on it.
2024-03-29 16:23:34 -04:00
Timothy Flynn 8b1ad5c496 LibWeb+LibWebView+WebContent: Add a new IPC for modifying history state
Let's not re-invoke the "page did start loading" IPC when the history
state is pushed/replaced. It's a bit misleading (the change does not
actually load the new URL), but also the chromes may do more work than
we want when we change the URL.

Instead, add a new IPC for the history object to invoke.
2024-03-29 08:52:01 -04:00
Timothy Flynn cd73878d8c Meta: Port recent changes to the GN build
a1f4d1875e
2024-03-29 08:52:01 -04:00
Timothy Flynn 40c0dd81d2 LibWeb+LibWebView+WebContent: Inform chromes when audio is played/paused
Most browsers have some indicator when audio is playing in a tab, which
makes it easier to find that tab and mute unwanted audio. This adds an
IPC to allow the Ladybird chromes to do something similar.
2024-03-28 21:08:23 +01:00
Timothy Flynn 21a223845f Meta: Add the "paste" icon to the GN build 2024-03-28 21:08:23 +01:00
Timothy Flynn d74059580c LibWeb: Return the correct substring when parsing an HTTP quoted string
We were off-by-one when returning the result of parsing a quoted string
in Web::Fetch::Infrastructure::collect_an_http_quoted_string. Instead of
backtracking the lexer and consuming the backtracked string, do a simple
substring operation.
2024-03-26 19:19:13 +00:00
Timothy Flynn 576c2f4f4d LibURL+LibUnicode+LibWebView: Handle punycode directly in LibURL
We had defined punycode handling in LibUnicode when LibURL (AK at the
time) was unable to depend on LibUnicode. This is no longer the case.
2024-03-26 12:25:21 -04:00
Timothy Flynn 5ddfcfd07e LibCore+LibTimeZone: Move TZDB utilities from LibTimeZone to LibCore
We had weakly defined a couple utilities needed by Core::DateTime when
LibCore was unable to depend on LibTimeZone. This is no longer the case.
2024-03-26 12:25:21 -04:00
Timothy Flynn 9b1b91f98a LibFileSystem: Depend on the minimal LibCore source set 2024-03-26 12:25:21 -04:00
Timothy Flynn 6f65e188f0 Meta/Tools: Depend on the minimal LibCore source set 2024-03-26 12:25:21 -04:00
Timothy Flynn f7ddcb1f98 LibCore: Separate some LibCore sources into a minimal object library
We have been dancing around circular dependencies between LibCore and
generated sources. For example, LibURL currently cannot depend on
LibUnicode because the LibUnicode generators depend on LibCore, and
LibCore depends on LibURL. LibTimeZone is in a similar situation.

To alleviate this, we can define the minimal sources that the code
generators need as an object library. This will allow the generators to
depend on this library, rather than the full LibCore.
2024-03-26 12:25:21 -04:00
Timothy Flynn 4c08a1e0c0 Meta: Remove serenity_lib_static() CMake helper function
Its one user (LibMain) can now just specify a STATIC library type in an
invocation of serenity_lib().
2024-03-26 12:25:21 -04:00
Timothy Flynn d1e2d2a4df Meta: Allow specifying the library type when invoking serenity_lib()
This will allow creating object libraries with this function.
2024-03-26 12:25:21 -04:00
Andrew Kaster a0623a47de LibWeb: Implement importKey for RSA-OAEP 2024-03-25 17:01:23 -06:00
Andrew Kaster 562068e001 LibTLS: Implement ASN.1 parser function for PrivateKeyInfo
LibWeb wants to parse these for Web Crypto. In theory Certificate
parsing in LibTLS should use it as well.
2024-03-25 17:01:23 -06:00
Dan Klishch d99d66e358 JSSpecCompiler: Pave a way for representing compile-time objects 2024-03-25 14:28:52 -06:00
Dan Klishch 3077e516a2 JSSpecCompiler: Parse properties list clause title 2024-03-25 14:28:52 -06:00
Dan Klishch ec16556fea JSSpecCompiler: Add option to silence all diagnostics and use in tests
In the future, we will probably want to test regressions in diagnostics
too but let's not do that for now.
2024-03-25 14:28:52 -06:00
Dan Klishch 0e7c33b1be JSSpecCompiler: Let FunctionDeclaration know its name and category
This is achieved by moving ClauseHeader::{AbstractOperation,Accessor,
Method} to Function.h itself and storing them in FunctionDeclaration.

This commit also introduces QualifiedName class that is used to store
function's name split by '.' (just like it appear in the spec).
2024-03-25 14:28:52 -06:00
Nico Weber 2e142105c9 Fuzzers: Add JPEG2000 fuzzer 2024-03-25 20:35:00 +01:00
Nico Weber 1ab28276f6 LibGfx: Add the start of a JPEG2000 loader
JPEG2000 is the last image format used in PDF filters that we
don't have a loader for. Let's change that.

This adds all the scaffolding, but no actual implementation yet.
2024-03-25 20:35:00 +01:00
Nico Weber 65bd090815 LibGfx/ISOBMFF: Start creating JPEG2000 box types
`isobmff` can now dump the id in a JPEG2000SignatureBox.
Creates JPEG2000Boxes.{h,cpp} to house JPEG2000 box types.
2024-03-25 20:35:00 +01:00
Timothy Flynn 3b2f4a4041 CI: Revert ARCH_MMAP_RND_BITS libasan workaround
This reverts commit 5713c2ffdd.

This workaround is reportedly now applied in the base image.
2024-03-25 14:16:55 -04:00
Timothy Flynn 24ecf31ff5 LibURL+LibWeb: Move data URL processing to LibWeb's fetch infrastructure
This is a fetching AO and is only used by LibWeb in the context of fetch
tasks. Move it to LibWeb with other fetch methods.

The main reason for this is that it requires the use of other LibWeb AOs
such as the forgiving Base64 decoder and MIME sniffing. These AOs aren't
available within LibURL.
2024-03-25 08:13:27 +01:00
Timothy Flynn 2118cdfcaa Meta: Add LibWeb unit tests to the GN build 2024-03-25 08:13:27 +01:00
Timothy Flynn a88ee029d7 Meta: Add the base64 utility to the GN build 2024-03-25 08:13:27 +01:00
Nico Weber ce4396d6ff MacPDF: Fix capitalization of "Show Images" Debug menu entry 2024-03-24 08:25:31 +01:00
Timothy Flynn 7463b31754 Ladybird: Ensure emoji files are installed into the Ladybird bundle
Otherwise, we are unable to render emoji on websites.
2024-03-23 17:26:31 -04:00
Timothy Flynn 91cd43a7ac Meta: Add a file containing a list of all emoji file names
And add a verification step to the emoji data generator to ensure all
emoji are listed in this file. This file will be used as a sources list
in both the CMake and GN build systems.

It is probably possible to generate this list. But in a first attempt,
the CMake code to set the file as a dependency of a pseudo target, which
would then parse the file and install the listed emoji was getting quite
verbose and complicated. So for now, let's just maintain this list.
2024-03-23 17:26:31 -04:00
Timothy Flynn a729677561 Meta: Port recent changes to the GN build
6c26ff567e
e800605ad3
cf7c933312
2024-03-23 17:26:31 -04:00
Dan Klishch cab0cb5b13 JSSpecCompiler: Use AK::enumerate in CFGBuildingPass::on_entry 2024-03-23 09:02:58 -04:00
Tim Ledbetter 158d9a5921 LibWeb: Ensure enumerated attributes are always limited to known values
Previously, the invalid value default wasn't taken into account when
determining the value that should be returned from the getter of an
enumerated attribute. This caused a crash when an enumerated attribute
of type DOMString? was set to an invalid value.
2024-03-22 11:29:57 +01:00
Timothy Flynn d6884a5d6f Meta: Add the base64 utility to the Lagom build
Useful for profiling.
2024-03-21 15:53:46 +01:00
Andrew Kaster 6783a524d0 LibWeb: Make DOMExceptionPrototype's prototype %Error.prototype%
As mandated in the WebIDL spec:
https://webidl.spec.whatwg.org/#js-DOMException-specialness
2024-03-20 15:18:44 -04:00
Shannon Booth e800605ad3 AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of
the system, as LibCore depends on LibURL.

This change has two main benefits:
 * Moving AK back more towards being an agnostic library that can
   be used between the kernel and userspace. URL has never really fit
   that description - and is not used in the kernel.
 * URL _should_ depend on LibUnicode, as it needs punnycode support.
   However, it's not really possible to do this inside of AK as it can't
   depend on any external library. This change brings us a little closer
   to being able to do that, but unfortunately we aren't there quite
   yet, as the code generators depend on LibCore.
2024-03-18 14:06:28 -04:00
Space Meyer 14005f89a6 Meta: Correct gdb example in serenity.sh 2024-03-17 20:44:18 -06:00
Nico Weber 7d0e752590 Meta: Add a script that takes a JBIG2 file and writes a PDF embedding it
Most image viewers can't display JBIG2 files.
All PDF viewers can display JBIG2 files.

This is useful for checking that PDF viewers render JBIG2 files the
same way we do.
2024-03-17 17:38:30 +01:00
Timothy Flynn a68b134e6d Meta: Do not place headless-browser and WebDriver in libexec
These are standalone applications meant to be run by the user directly,
as opposed to other libexec processes which are programmatically forked
by the browser. To do this, we simply remove these processes from the
`ladybird_helper_processes` list. We must also explicitly list the
dependencies for these processes.
2024-03-16 19:44:40 -04:00
Nico Weber 21917e7b1e LibPDF+PDFViewer+MacPDF: Don't draw hidden text by default
Text can be rendered in various ways in PDFs: Filled, stroked,
both filled and stroked, set as clipping path, hidden, or
some combinations thereof.

We don't implement any of this at the moment except "filled".

Hidden text is used in scanned documents: The image of the scan is
drawn in the background, and then OCRd text is "drawn" as hidden
on top of the scanned bitmap. That way, the (hidden) text can be
selected and copied, and it looks like you're selecting text from
the scanned bitmap. Find-in-page also works similarly. (We currently
have neither text selection nor find-in-page, but one day we will.)

Now that we have pretty good support for CCITT and are growing some
support for JBIG2, we now draw both the scanned background image
as well as the foreground text. They're not always perfectly aligned.

This change makes it so that we don't render text that's marked as
hidden. (We still do most of the coordinate math, which will probably
come in handy at some point when we implement text selection.)

This makes these scanned documents appear as they're supposed to
appear (at least in documents where we manage to decode the background
bitmap).

This also adds a debug option to force rendering of hidden text.
2024-03-16 13:10:48 -04:00
Andreas Kling c0e0cb86e1 LibWeb: Make CSS::string_from_property_id() return FlyString const&
This avoids costly conversions from StringView to FlyString in CSS
parsing and variable expansion.
2024-03-16 14:27:59 +01:00
Timothy Flynn 3a8bde9ef2 Ladybird/AppKit: Implement <input type=file> file type filtering 2024-03-16 08:42:33 +01:00
Timothy Flynn 6760d236e4 Ladybird+LibWeb+WebContent: Parse the <input type=file> accept attribute
This parses the accept attribute value for file input types and passes
it along to the browser chromes.
2024-03-16 08:42:33 +01:00
Dan Klishch 73ba6d77ab JSSpecCompiler: Rename SpecParser.h to SpecificationParsing.h 2024-03-14 18:34:13 -06:00
Dan Klishch 211d20d389 JSSpecCompiler: Rename SpecFunction to SpecificationFunction
Over time, I converged on not abbreviating "specification". But this
class (and SpecParsingStep) predated the decision.
2024-03-14 18:34:13 -06:00
Dan Klishch 7ea2138b6c JSSpecCompiler: Split Parser/SpecParser.cpp into 8 files
This SpecParser.cpp had an ever increasing number of lines and contained
an implementation of 8 different classes. So I figured out it's about
the time to split it.

No behavior change.
2024-03-14 18:34:13 -06:00
Andrew Kaster 1521a60a67 LibWeb: Support SubtleCrypto.exportKey for RSA-OAEP in JsonWebKey format 2024-03-14 17:57:37 -06:00
Andrew Kaster 1d70306c41 Meta: Handle output directories for multi-config CMake generators
For Ninja Multi-Config, Xcode and Visual Studio, the way we set up our
output directories would result in exectuables that can't run from the
build directory. Add the same sauce that we added to Jakt to insert
``$<CONFIG>`` where appropriate.
2024-03-14 17:05:05 -06:00
Nico Weber d15785cccc MacPDF: Add "Show Images" debug menu entry
PDFViewer has this, and it's useful for PDFs that have the same
text both as a scanned bitmap in the background as well as using
vector text in the foreground.

xib changes: Added a new menu entry connected to `toggleShowImages:`,
and also toggled the initial state of two menu entries. (The latter
part has no effect when the program runs since we dynamically update
this state, but it makes the menu entries show their initial state
in Xcode's menu editor.)
2024-03-14 10:59:29 -04: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
Liav A ec6e7077fe Tests/Kernel: Add tests for verifying proper loop device support 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 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 d5ce45b016 Meta: Port recent changes to the GN build
163b6bb401
3b4230e0b0
2024-03-13 12:52:07 -04: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
Timothy Flynn 3a8c81a460 Meta: Port recent changes to the GN build
fceba6a257
8ce8697a66
2024-03-10 00:39:49 +01:00
Nico Weber dd593d16c4 Fuzzers: Add JBIG2 fuzzer 2024-03-09 16:01:22 +01:00
Nico Weber 58838db445 LibGfx: Add the start of a JBIG2 loader
JBIG2 is infamous for two things:

1. It's used in xerox scanners were it falsifies scanned numbers:

https://www.dkriesel.com/en/blog/2013/0802_xerox-workcentres_are_switching_written_numbers_when_scanning

2. It was allegedly used in an iOS zero day, in a very cool way:

https://googleprojectzero.blogspot.com/2021/12/a-deep-dive-into-nso-zero-click.html

Needless to say, we need support for it in Serenity. (...because it's
used in PDF files.)

This adds all the scaffolding, but no actual implementation yet.

It's enough for `file` to print the mime type of .jb2 files, but `image`
can't do anything with the files yet.
2024-03-09 16:01:22 +01:00
Timothy Flynn 33640c38d6 Meta: Port recent changes to the GN build
6dfb2f9dc8
2024-03-06 11:20:44 -05:00
Ali Mohammad Pur 6dfb2f9dc8 Everywhere: Merge the WebSocket service into RequestServer
This keeps the APIs separate as they are wildly different, a future
improvement could be to somehow unify the APIs (if possible).

Closes #23080.
2024-03-06 10:07:27 +01:00
Andreas Kling daf5484d6b Revert "Meta: Port recent changes to the GN build"
This reverts commit 285df77fb8.
2024-03-06 09:39:05 +01:00
Timothy Flynn baf359354b LibWebView+WebContent: Use Web::InputEvent for WebContent input IPC
Now that all input events are handled by LibWebView, replace the IPCs
which send the fields of Web::KeyEvent / Web::MouseEvent individually
with one IPC per event type (key or mouse).

We can also replace the ad-hoc queued input structure with a smaller
struct that simply holds the tranferred Web::KeyEvent / Web::MouseEvent.

In the future, we can also adapt Web::EventHandler to use these structs.
2024-03-06 07:46:18 +01:00
Timothy Flynn ea682207d0 LibWeb+LibWebView: Migrate Browser's input event handling to LibWebView
The Serenity chrome is the only chrome thus far that sends all input key
and mouse events to WebContent, including shortcut activations. This is
necessary for all chromes - we must give web pages a chance to intercept
input events before handling them ourselves.

To make this easier for other chromes, this patch moves Serenity's input
event handling to LibWebView. To do so, we add the Web::InputEvent type,
which models the event data we need within LibWeb. Chromes will then be
responsible for converting between this type and their native events.

This class lives in LibWeb (rather than LibWebView) because the plan is
to use it wholesale throughout the Page's event handler and across IPC.
Right now, we still send the individual fields of the event over IPC,
but it will be an easy refactor to send the event itself. We just can't
do this until all chromes have been ported to this event queueing.

Also note that we now only handle key input events back in the chrome.
WebContent handles all mouse events that it possibly can. If it was not
able to handle a mouse event, there's nothing for the chrome to do (i.e.
there is no clicking, scrolling, etc. the chrome is able to do if the
WebContent couldn't).
2024-03-06 07:46:18 +01:00
Andrew Kaster b5acc5f2df LibWeb: Serialize and pass to the WebWorker the current ESO
This allows the initial fetch() in the run a worker AO to use the proper
values from the outside settings.
2024-03-06 07:19:10 +01:00
Andrew Kaster 4d22358e05 LibWeb: Add facilities to serialize EnvironmentSettingsObjects
This will be used to transfer information about the parent context to
DedicatedWorkers and future out-of-process Worker/Worklet
implementations for fetching purposes. In order to properly check
same-origin and other policies, we need to know more about the outside
settings than we were previously passing to the WebWorker process.
2024-03-06 07:19:10 +01:00
Andrew Kaster 285df77fb8 Meta: Port recent changes to the GN build
5b29974bfa
c5860d1d706897f1534266c96ccd401c6376e0a4
2024-03-06 07:19:10 +01:00
Filiph Siitam Sandström fd694e8672 AK+Lagom: Make it possible to build for iOS
This commit makes it possible to build AK and most of Lagom for iOS,
based on the work for the Ladybird build demoed on discord:
https://discord.com/channels/830522505605283862/830525031720943627/1211987732646068314
2024-03-03 13:13:42 -07:00
Timothy Flynn 62596f3e43 CI: Reduce the ccache size for CI
We currently use 0.6GB for a clean build with sanitizers enabled. This
will allow us to have ~3 clean builds cached and save 3GB of disk space
on CI. (The effect is actually double, because Azure archives the cache
in a tar file before uploading).
2024-03-02 09:11:03 +01:00
Timothy Flynn ba67a0645e CI: Strip binaries and libraries during the installation step
This saves ~400MB of disk space.
2024-03-02 09:11:03 +01:00
Timothy Flynn 9c6c3fe0d8 Meta: Use correct helper process paths in the GN build
These changed to libexec in ea59bfaae7.
2024-02-29 22:16:39 -05:00
Timothy Flynn e1e42f5f58 Meta: Port recent changes to the GN build
f9e5b43b7a
b9dc2d7ebf
fa692ae3f6
2024-02-29 22:16:39 -05:00
Timothy Flynn 5a116a8f72 Meta: Alphabetize IDL files in the GN build 2024-02-29 22:16:39 -05:00
Timothy Flynn 3da6916383 CI: Remove the WPT directory after tests have completed
This directory is about 600MB. Remove it after running WPT as an attempt
to alleviate CI disk space issues.
2024-02-29 14:27:25 -05:00
Nico Weber 4e0fe9d9d0 MacPDF: Honor page rotation 2024-02-27 07:02:02 +01:00
Andrew Kaster 5a1944ce64 Meta: Link AK to libexecinfo on BSDs and Haiku
This requirement was missed when AK was split into its own library
in 5945cdc054
2024-02-26 16:04:39 -07:00
Sönke Holz 0dca6990b3 Meta: Disable network hardware in run.py for RISC-V
The e1000 driver tries to use interrupt handling functions, which
aren't implemented on RISC-V yet.
2024-02-26 13:22:27 -07:00
Andrew Kaster ea59bfaae7 Ladybird: Move helper processes to CMAKE_INSTALL_LIBEXECDIR
It aligns better with the Filesystem Heirarchy Standard[1] to put our
program-specific helper programs that are not intended to be executed by
the user of the application in $prefix/libexec or in whatever the
packager sets as the CMake equivalent. Namely, on Debian systems this
should be /usr/lib/Ladybird or similar.

[1] https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrlibexec
2024-02-26 13:16:27 -07:00
Andrew Kaster 1e0dd9aa8c Ladybird: Copy resources into the build directory
This will let us remove the dependence on SERENITY_SOURCE_DIR
2024-02-26 13:16:27 -07:00
Andrew Kaster 1f8a7db6db Meta: Port recent changes to the gn build
daaaaec2d0
5824916f8c
3a87c000c4
45a47cb32b
11d746a67f
cb97eef2cf
fb8edcea00
2024-02-26 13:16:27 -07:00
Timothy Flynn 108521a566 LibWeb+LibWebView+WebContent: Implement more <input type=file> behavior
We had previous implemented some plumbing for file input elements in
commit 636602a54e.

This implements the return path for chromes to inform WebContent of the
file(s) the user selected. This patch includes a dummy implementation
for headless-browser to enable testing.
2024-02-26 14:18:49 +01:00
Aliaksandr Kalenik 8a829be25c LibWeb: Handle scenario when Window property setter is called on global
This commit fixes a regression introduced in
1528e9109c.

Turns out that the type of `this_value` in the property setter of the
Window object depends on how the variable is accessed. If the property
is accessed as a global variable, then this_value is of type `Window`.
For example:
```js
performance = null
```

However, when it is accessed as a property of the window object,
`this_value` is of type `WindowProxy`. For example:
```js
window.performance = null
```

This commit updates the window property setters generator to handle
both scenarios.

With this change https://discord.com/login works again.
2024-02-25 12:55:30 +01:00
Shannon Booth f9e5b43b7a LibWeb: Rename URL platform object to DOMURL
Along with putting functions in the URL namespace into a DOMURL
namespace.

This is done as LibWeb is in an awkward situation where it needs
two URL classes. AK::URL is the general purpose URL class which
is all that is needed in 95% of cases. URL in the Web namespace
is needed predominantly for interfacing with the javascript
interfaces.

Because of two URLs in the same namespace, AK::URL has had to be
used throughout LibWeb. If we move AK::URL into a URL namespace,
this becomes more painful - where ::URL::URL is required to
specify the constructor (and something like
::URL::create_with_url_or_path in other places).

To fix this problem - rename the class in LibWeb implementing the
URL IDL interface to DOMURL, along with moving the other Web URL
related classes into this DOMURL folder.

One could argue that this name also makes the situation a little
more clear in LibWeb for why these two URL classes need be used
in the first place.
2024-02-25 08:54:31 +01:00
Shannon Booth 1b6346ee1c LibWeb: Add support for implementing an IDL class with a different name
Add support for the extended attribute "ImplementedAs" for IDL
interfaces too. This allows a class which implements an IDL interface to
have a different class name than the interface itself.
2024-02-25 08:54:31 +01:00
Dan Klishch 9966feab4d Meta: Allow collecting code coverage on Lagom 2024-02-24 17:13:16 -07:00
Hendiadyoin1 51b841b4b2 Meta: Enable serial_debug on riscv
This mirrors the currently hardcoded command line
2024-02-24 16:43:44 -07:00
Hendiadyoin1 0fa718ead8 Meta: Compile fdtdump on lagom 2024-02-24 16:43:44 -07:00
Ilya Hanov a16f0e9053 Meta: Prevent "serenity.sh gdb" to close other tmux sessions
"Meta/serenity.sh gdb" command opens tmux and
creates windows for GDB and emulator's logs.

The problem is that while it uses "trap" to close
just opened tmux session once debugging
is finished, it will close previously
opened session as well due to "trap" is
setup twice.

This commit tries to prevent touching
other tmux session.
2024-02-24 16:21:45 -07:00
implicitfield 84252db976 Utilities: Add mkfs.fat
This adds a basic `mkfs.fat` utility, which can format FAT12, FAT16
and FAT32 partitions.

This does have a few limitations, namely in that FAT12 formatting is
limited to a set known floppy disk sizes, and we can only generate
512-byte sectors.
2024-02-24 15:54:52 -07:00
implicitfield d3c6e31bf3 CMake: Build lagom with -D_FILE_OFFSET_BITS=64 on Linux
32-bit glibc limits off_t to 32 bits without this definition, which
makes working with large files rather difficult.
2024-02-24 15:54:52 -07:00
Dan Klishch f7c952f842 JSSpecCompiler: Ignore notes in algorithm steps 2024-02-24 15:03:08 -07:00
Dan Klishch ba61b61d67 JSSpecCompiler: Parse "NewTarget" in xspec mode 2024-02-24 15:03:08 -07:00
Dan Klishch 4d8f74c149 JSSpecCompiler: Parse method headers 2024-02-24 15:03:08 -07:00
Dan Klishch a35a751f9e JSSpecCompiler: Parse optional arguments groups 2024-02-24 15:03:08 -07:00
Dan Klishch 3e6a07154b JSSpecCompiler: Parse "the *this* value" in expressions 2024-02-24 15:03:08 -07:00
Dan Klishch ddf26a768c JSSpecCompiler: Parse "Perform <expression>." steps 2024-02-24 15:03:08 -07:00
Dan Klishch d1fc84c638 JSSpecCompiler: Parse accessor property headers 2024-02-24 15:03:08 -07:00
Dan Klishch a9f3a14a13 JSSpecCompiler: Simplify value handling in TextParser::parse_expression 2024-02-24 15:03:08 -07:00
Dan Klishch e1a1f4ed1a JSSpecCompiler: Parse lists in xspec mode 2024-02-24 15:03:08 -07:00
Dan Klishch d14bb7e91e JSSpecCompiler: Make function arguments parsing much simpler
In a nutshell, when we understand that the expression is a function
call (this happens at '(' after an expression), stop parsing expression
and start parsing function arguments. This makes
`FunctionCallCanonicalizationPass` and the workaround for zero argument
function calls obsolete.
2024-02-24 15:03:08 -07:00
Dan Klishch 990e30f458 JSSpecCompiler: Parse enumerators in xspec mode 2024-02-24 15:03:08 -07:00
Dan Klishch 3d365326af JSSpecCompiler: Parse '?' before function calls in xspec mode 2024-02-24 15:03:08 -07:00
Dan Klishch b800276347 JSSpecCompiler: Parse true, false, this, undefined, and null 2024-02-24 15:03:08 -07:00
Dan Klishch 86d54a8684 JSSpecCompiler: Parse arbitrarily large rational numbers in xspec mode 2024-02-24 15:03:08 -07:00
Dan Klishch bd26e5dce9 JSSpecCompiler: Parse <sup> as raising a number to a power in xspec mode 2024-02-24 15:03:08 -07:00
Dan Klishch 394c9b7006 JSSpecCompiler: Sort token types and operators alphabetically 2024-02-24 15:03:08 -07:00
Tim Ledbetter b0f57a2785 LibWeb: Add CSSStyleSheet constructor binding 2024-02-24 21:59:28 +01:00
Aliaksandr Kalenik 1528e9109c LibWeb: Add special handling for WindowProxy in [Replaceable] setters
Setters for Window object should consider WindowProxy wrapper by:
- Verifying `this_value` is `WindowProxy` (not `HTML::Window`)
- Defining properties on the underlying Window object instead of on
  the WindowProxy itself.
2024-02-24 08:05:55 +01:00
Sönke Holz bcb68eb632 Meta: Set the RAM size to 1G for aarch64 in run.py
The "raspi3b" QEMU machine doesn't like RAM sizes other than 1G.
2024-02-24 00:07:13 +01:00
Andreas Kling 4bbb0a5c35 LibJS: Add ConservativeVector<T>
This works very similarly to MarkedVector<T>, but instead of expecting
T to be Value or a GC-allocated pointer type, T can be anything.
Every pointer-sized value in the vector's storage will be checked during
conservative root scanning.

In other words, this allows you to put something like this in a
ConservativeVector<Foo> and it will be protected from GC:

    struct Foo {
        i64 number;
        Value some_value;
        GCPtr<Object> some_object;
    };
2024-02-22 16:44:54 +01:00
Nico Weber 24a469f521 Everywhere: Prefer {:#x} over 0x{:x} in format strings
The former automatically adapts the prefix to binary and octal
output, and is what we already use in the majority of cases.

Patch generated by:

    rg -l '0x\{' | xargs sed -i '' -e 's/0x{:/{:#/'

I ran it 4 times (until it stopped changing things) since each
invocation only converted one instance per line.

No behavior change.
2024-02-21 17:54:38 +01:00
Timothy Flynn 939779cad3 LibWeb: Support nullable integral IDL types
We currently support optional integral types, but not nullable types. So
if an IDL contains e.g. "long?", passing null will be coerced to 0.

This will be used by the Inspector, but will also eventually be used by
real IDL interfaces (e.g. HTMLInputElement's selectionStart).
2024-02-20 17:04:36 +01:00
Timothy Flynn 13ed003be1 LibWeb: Extract common integral IDL generators to a helper
We currently repeat the same generator code for all 7 integral types
that we generate C++ for. Extract it to a helper.
2024-02-20 10:20:29 +01:00
Andreas Kling 1d29f9081f LibJS: Remove JIT compiler
The JIT compiler was an interesting experiment, but ultimately the
security & complexity cost of doing arbitrary code generation at runtime
is far too high.

In subsequent commits, the bytecode format will change drastically, and
instead of rewriting the JIT to fit the new bytecode, this patch simply
removes the JIT instead.

Other engines, JavaScriptCore in particular, have already proven that
it's possible to handle the vast majority of contemporary web content
with an interpreter. They are currently ~5x faster than us on benchmarks
when running without a JIT. We need to catch up to them before
considering performance techniques with a heavy security cost.
2024-02-19 21:45:27 +01:00
Matthew Olsson 39f5e32ee9 IDLGenerators: Add support for custom attribute [ExplicitNull]
This can apply to optional, nullable parameters of platform types. This
will cause the generator to generate the type as
Optional<JS::GCPtr<T>> rather than JS::GCPtr<T>, allowing the
implementation to differentiate between the case where the argument was
not passed, and the case where null or undefined was passed.

Needing to differentiate these two cases is quite niche, hence why it is
an opt-in behavior.
2024-02-19 14:51:56 -05:00
Timothy Flynn b2104361cf Meta: Increase default VM RAM size to 2GiB
With 1GiB, we hit OOM loading GitHub in the browser. Increase the RAM
size to support normal use.
2024-02-19 10:41:03 -05:00
Matthew Olsson bb527c4351 LibWeb: Add Animations::Animation to IDLGenerators 2024-02-19 12:21:48 +01:00
Ali Mohammad Pur bc301b6f40 AK+LibXML+JSSpecCompiler: Move LineTrackingLexer to AK
This is a simple extension of GenericLexer, and is used in more than
just LibXML, so let's move it into AK.
The move also resolves a FIXME, which is removed in this commit.
2024-02-16 15:26:43 +01:00
Tim Ledbetter 89c0e3541e Fuzzers: Add PAM fuzzer 2024-02-14 19:58:46 +01:00
Jelle Raaijmakers 60bd458ed2 LibGL: Allow function name override in API definitions
Instead of limiting ourselves to the key of the property in the JSON,
allow overriding the function name so we can generate completely
different function signatures with very similar names to other existing
API methods (e.g. `glUniform*` vs `glUniform*v`).
2024-02-14 15:09:53 +01:00
Andrew Kaster aef188207c CI: Add debug logging to WPT run to see if we are overusing /tmp 2024-02-14 06:55:40 +01:00
Matthew Olsson 212a139292 LibWeb: Add a way to test if a CSS::PropertyID is animatable 2024-02-13 19:44:44 +01:00
Tim Ledbetter 4a7236cabf Everywhere: Prefer _string when constructing strings from literals 2024-02-08 11:01:10 -05:00
Andrew Kaster bc9c710904 LibWeb: Hide WebDriver::match_route debug behind its own flag
When enabling WEBDRIVER_DEBUG globally, this function's debug spam
overpowers the rest of the useful logs.
2024-02-08 15:53:46 +01:00
Dan Klishch 7945c9d808 JSSpecCompiler: Do not store XML::Node in tokens 2024-02-08 07:05:13 -07:00
Dan Klishch 94f5086b93 JSSpecCompiler: Remove ParseError 2024-02-08 07:05:13 -07:00
Dan Klishch 9a2337f7ad JSSpecCompiler: Get rid of ParseError in Lexer 2024-02-08 07:05:13 -07:00
Dan Klishch ed04aff1de JSSpecCompiler: Try to get section number even if header parsing failed 2024-02-08 07:05:13 -07:00
Dan Klishch 6b30c4d2f0 JSSpecCompiler: Issue meaningful errors in TextParser 2024-02-08 07:05:13 -07:00
Dan Klishch dee4978d67 JSSpecCompiler+LibXML: Store location for tokens 2024-02-08 07:05:13 -07:00
Dan Klishch d219c91ca9 JSSpecCompiler: Make fields in classes from SpecParser.h private 2024-02-08 07:05:13 -07:00
Dan Klishch cb6e75e890 JSSpecCompiler: Mostly get rid of ParseError in AlgorithmStep
And while on it, create proper logical scopes for algorithm steps.
2024-02-08 07:05:13 -07:00
Dan Klishch 1bd1187c92 JSSpecCompiler: Push ParseError out of AlgorithmStepList 2024-02-08 07:05:13 -07:00
Dan Klishch c7369f2f93 JSSpecCompiler: Push ParseError out of Algorithm 2024-02-08 07:05:13 -07:00
Dan Klishch d339ad01bb JSSpecCompiler: Push ParseError out of SpecFunction 2024-02-08 07:05:13 -07:00
vincent-rg a9df60ff1c AK: Update OptionParser::m_arg_index by substracting skipped args
On argument swapping to put positional ones toward the end,
m_arg_index was pointing at "last arg  index" + "skipped args" +
"consumed args" and thus was pointing ahead of the skipped ones.

m_arg_index now points after the current parsed option arguments.
2024-02-06 00:08:30 +01:00
Bastiaan van der Plaat 5a8e82e6ea Base: Create user default Music and Pictures directories 2024-02-05 16:30:52 +01:00
Andrew Kaster 9645daaf6c LibWeb: Remove RemoteBrowsingContext and AbstractBrowsingContext
With the transition to Navigables, and a working implementation of
window.open(), we no longer need this abstraction layer.
2024-02-05 08:05:48 -07:00
Timothy Flynn 3bf90fdab1 LibTimeZone: Update to TZDB version 2024a
https://mm.icann.org/pipermail/tz-announce/2024-February/000081.html
2024-02-04 08:14:06 +01:00
Timothy Flynn f30fd78d8d Meta: Port recent changes to the GN build
8e5410347b
2024-02-04 08:14:06 +01:00
Andrew Kaster 677bdc2a4f Ladybird: Add IPC call for creating a new child tab
This will be used for choosing a navigable that requires opening a new
tab or new window. Such as calls to window.open(), or specific WebDriver
calls.
2024-02-03 20:51:37 -05:00
Nico Weber 9c762b9650 LibPDF+Meta: Use a CMYK ICC profile to convert CMYK to RGB
CMYK data describes which inks a printer should use to print a color.
If a screen should display a color that's supposed to look similar
to what the printer produces, it results in a color very different
to what Color::from_cmyk() produces. (It's also printer-dependent.)

There are many ICC profiles describing printing processes. It doesn't
matter too much which one we use -- most of them look somewhat
similar, and they all look dramatically better than Color::from_cmyk().

This patch adds a function to download a zip file that Adobe offers
on their web site. They even have a page for redistribution:
https://www.adobe.com/support/downloads/iccprofiles/icc_eula_win_dist.html

(That one leads to a broken download though, so this downloads the
end-user version.)

In case we have to move off this download at some point, there are also
a whole bunch of profiles at https://www.color.org/registry/index.xalter
that "may be used, embedded, exchanged, and shared without restriction".

The adobe zip contains a whole bunch of other useful and fun profiles,
so I went with it.

For now, this only unzips the USWebCoatedSWOP.icc file though, and
installs it in ${CMAKE_BINARY_DIR}/Root/res/icc/Adobe/CMYK/. In
Serenity builds, this will make it to /res/icc/Adobe/CMYK in the
disk image. And in lagom build, after #23016 this is the
lagom res staging directory that tools can install via
Core::ResourceImplementation. `pdf` and `MacPDF` already do that,
`TestPDF` now does it too.

The final piece is that LibPDF then loads the profile from there
and uses it for DeviceCMYK color conversions.

(Doing file access from the bowels of a library is a bit weird,
especially in a system that has sandboxing built in. But LibGfx does
that in FontDatabase too already, and LibPDF uses that, so it's not a
new problem.)
2024-02-01 13:42:04 -07:00
Nico Weber 70eac0fbe8 pdf+MacPDF: Use new Build/Root/lagom/res directory 2024-01-30 18:43:06 -07:00
Nico Weber d1036c915d Meta: Create Build/lagom/Root/res with resources for lagom binaries
This way, build files can install things into
`${CMAKE_BINARY_DIR}/Root/res/` and it'll work in both serenity and
lagom builds.

It allows using a single `Core::ResourceImplementation::install()`
call to install both checked-in and generated files (as long as both
get copied into this new build-time staging dir).

No behavior change.
2024-01-30 18:43:06 -07:00
Nico Weber 90490d9fb8 Meta: Use extract_path() in extract_tzdb_file()
No behavior change.
2024-01-29 22:03:27 -05:00
Nico Weber ffcd5cf443 Meta: Remove extract_tar_path() function
It's identical to extract_path() after #23000.

No behavior change.
2024-01-29 22:03:27 -05:00
Nico Weber 125d92fe85 Meta: Remove "Extracting using cmake" messages
As requested on #23000.
2024-01-29 22:03:27 -05:00
Nico Weber 17f37cbd8c Meta: Remove some obsolete cmake version checks
We require CMake 3.25 nowadays.

No behavior change.
2024-01-29 20:09:12 -05:00
Nico Weber fd316728a0 Everywhere: Remove references to UserspaceEmulator 2024-01-29 20:20:55 +00:00
kleines Filmröllchen dec066fa5c GMLCompiler: Add common pattern for a user-defined fallible initializer
Many widget classes need to run substantial initialization code after
they have been setup from GML. With this change, an
initialize_fallibles() function is called if available, allowing the
initialization to be invoked from the GML setup automatically. This
means that the GML-generated creation function can now be used directly
for many more cases, and reduces code duplication.
2024-01-29 05:21:48 -07:00
Timothy Flynn 59716f807f Meta: Port recent changes to the GN build
187862ebe0
514af065a5
2024-01-29 07:21:59 +01:00
Timothy Flynn 9b957ead13 LibWebView+WebContent: Do not manually serialize cookie sources over IPC
LibIPC can serialize enumeration automatically (this was not the case
when these IPCs were added).
2024-01-26 20:22:39 +01:00
Timothy Flynn 2bb751eab9 Meta: Port recent changes to the GN build
b12541b286
2024-01-25 21:34:03 +01:00
Timothy Flynn 11d2e6101f Meta: Add AK and LibRIFF to macOS bundles in GN build 2024-01-23 14:07:46 -07:00
Timothy Flynn e7773f0f0a Meta: Port recent changes to the GN build
29396415d5
1aed465efe
2024-01-23 14:07:46 -07:00
stelar7 be8489fb04 LibWeb/IDL/Codegen: Handle BufferSource in union types 2024-01-23 14:07:06 -07:00
stelar7 3e0c0ce7ae LibWeb: Move dictionaries to separate file
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2024-01-23 14:07:06 -07:00
stelar7 02a85d8259 LibWeb/IDL/Codegen: Generate cpp_type for enums 2024-01-23 14:07:06 -07:00
stelar7 3f4ed782b4 LibWeb/IDL/Codegen: Fix indentation error due to else block 2024-01-23 14:07:06 -07:00
stelar7 a8ddf6c2a4 LibWeb: Add the CryptoKey interface 2024-01-23 14:07:06 -07:00
Tim Schumacher 5d9fa2b9a9 Meta: Use BXSHARE instead of a hardcoded Bochs directory
This allows using Bochs instances that are installed in non-standard
directories.
2024-01-22 20:18:38 -07:00
Timothy Flynn aa0a6d58b2 Userland: Remove LibCore dependency from libraries that do not use it 2024-01-22 08:48:34 -05:00
Timothy Flynn 5945cdc054 Ladybird+Meta: Extract AK into its own library on Lagom
We currently bundle AK with LibCore on Lagom. This means that to use AK,
all libraries must also depend on LibCore. This will create circular
dependencies when we create LibURL, as LibURL will depend on LibUnicode,
which will depend on LibCore, which will depend on LibURL.
2024-01-22 08:48:34 -05:00
Timothy Flynn 1e7b06aa11 Meta: Add a helper to create a Lagom utility
This helper can automatically link against libraries needed by all
utilities, such as LibCore. This is to make extracting AK into its own
library a bit easier.
2024-01-22 08:48:34 -05:00
Timothy Flynn b81a6cfe1d Meta: Port recent changes to the GN build
d125d16287
60c3a1a77b
4364a28d3d
271c9d1ae9
2024-01-22 08:48:34 -05:00
Dan Klishch b5f1a48a7c AK+Everywhere: Remove JsonValue APIs with implicit default values 2024-01-21 15:47:53 -07:00
Dan Klishch c49819cced AK+GMLCompiler+LibWeb: Remove JsonValue::is_double
This concludes a series of patches which remove the ability to observe
which arithmetic type is used to store number in JsonValue.
2024-01-21 15:47:53 -07:00
Dan Klishch faef802229 AK+GMLCompiler: Remove JsonValue::as_double()
Replace its single (non-test) usage with newly created as_number(),
which does not leak information about internal integer storage type.
2024-01-21 15:47:53 -07:00
Dan Klishch b74df136fe JSSpecCompiler: Always treat trailing MemberAccess as punctuation
Due to the way expression parser is written, we need to resolve the
ambiguity between member access operators and dots used for punctuation
during lexing. The lexer uses a (totally bulletproof) heuristic to do
that: whenever '.' is followed by ' ' or '\n', it is considered a dot
and member access otherwise. While it works fine for prettified test
cases, non-prettified files often lack enter after a trailing dot
character. Since MemberAccess will always be invalid at that position,
explicitly treat trailing dot as a part of punctuation.
2024-01-21 14:57:10 -07:00
Dan Klishch b4a9fde756 JSSpecCompiler: Recurse into the correct subtrees in RecursiveASTVisitor
RecursiveASTVisitor was recursing into the subtrees of an old root if it
was changed in on_entry callback. Fix that by querying root pointer just
after on_entry callback returns. While on it, also use
`AK::TemporaryChange` instead of setting `m_current_subtree_pointer`
manually.

As it turns out, `FunctionCallCanonicalizationPass` was relying on being
able to replace tree on entry, and the bug in RecursiveASTVisitor made
the pass to not fully canonicalize nested function calls.

The changes to GenericASTPass.cpp alone are enough to fix the problem
but it is canonical (for some definition of canonicity) to only change
trees in on_leave. Therefore, the commit also switches
FunctionCallCanonicalizationPass to on_leave callback.

A test for this fix and one from the previous commit is also included.
2024-01-21 14:57:10 -07:00
Dan Klishch 33b36476d9 JSSpecCompiler: Properly parse function calls with zero arguments
We cannot handle them normally since we need text between parenthesis to
be a valid expression. As a workaround, we now push an artificial value
to stack to act as an argument (it'll be later removed during function
call canonicalization).
2024-01-21 14:57:10 -07:00
Dan Klishch 14ee25b8ba JSSpecCompiler: Make -xspec capable of parsing the whole specification
... in theory. In practice, we fail to parse all of the functions.
2024-01-21 14:57:10 -07:00
Dan Klishch 483e195e48 JSSpecCompiler: Store arguments in declaration instead of definition
And create a struct encapsulating argument name in the preparation for
argument types and optional arguments.
2024-01-21 14:57:10 -07:00
Dan Klishch 0806ccaeec JSSpecCompiler: Start converting crashes to error messages
I got fed up with looking at error messages that tell me "VERIFICATION
FAILED: !is_error()". So this commit introduces DiagnosticEngine class
whose purpose is to accumulate and print more user-friendly errors.
2024-01-21 14:57:10 -07:00
Dan Klishch 3aec6952a2 JSSpecCompiler: Make TranslationUnit fields private
For some reason I was afraid to add trivial accessors to classes
in earlier PRs, so we now have dozens of classes with public fields. I'm
not exactly looking forward to refactoring them all at once but I'll
do so gradually.
2024-01-21 14:57:10 -07:00
Sam Atkins e4c7b9817b GMLCompiler: Sort enum_properties alphabetically and remove duplicate 2024-01-21 09:32:10 -05:00
Sam Atkins 3df3a85235 LibGfx+Userland: Move FontWeight enum into its own file
FontDatabase.h with its includes add up to quite a lot of code. In the
next commit, compiled GML files are going to need to access the
FontWeight enum, so let's allow them to do that without pulling in lots
of other things.

Also, change users to include FontWeight.h instead of FontDatabase.h
where appropriate.
2024-01-21 09:32:10 -05:00
Bastiaan van der Plaat ba8704243e LibWeb: Add short type to IDL generator 2024-01-20 08:57:37 +01:00
Nico Weber a0462f495c LibPDF+MacPDF: Clip text, and add a debug option for disabling it 2024-01-20 08:56:03 +01:00
Mr.UNIX f6c32ea45e GMLCompiler: Add enum initializer for background_role 2024-01-19 17:05:53 +01:00
Mr.UNIX 64e79a618b GMLCompiler: Add enum initializer for orientation 2024-01-19 17:05:53 +01:00
Mr.UNIX 0a1a081d8a GMLCompiler: Add OpacitySlider header to class file mappings 2024-01-19 17:05:53 +01:00
kleines Filmröllchen 14a99bb22d Calendar: Use new GML compiler 2024-01-19 10:50:15 +00:00
ronak69 d720fb8845 CMake: Set CMAKE_COLOR_DIAGNOSTICS to ON for colored diagnostics
This patch removes the explicit compile flag that only works for g++
(`-fdiagnostics-color=always`; clang++ needs `-fcolor-diagnostics`) and
uses CMake's built in variable that can control color output.

Now both compilers should output colored diagnostics.
2024-01-18 13:59:35 +01:00
Tim Ledbetter 45181e8eaf Fuzzers: Continue if frame is malformed in GIF fuzzer 2024-01-18 13:59:04 +01:00
Tim Ledbetter 4173a9880f Fuzzers: Don't disable debug logging in GIF fuzzer if GIF_DEBUG is set 2024-01-18 13:59:04 +01:00
Nico Weber b5aef8e404 MacPDF: Add Debug menu items to hook up Clip Images/Paths settings 2024-01-17 08:42:56 +00:00
Nico Weber aab3cd33f6 Meta/run.py: Fix grammar in method names
"Setup" is the noun, "to set up" is the verb.

No behavior change.
2024-01-16 09:55:42 -05:00
Sam Atkins fb644d08ac LibFileSystem+Everywhere: Return ByteString current_working_directory()
That is, return it *from* current_working_directory(), but I didn't have
room. :^)
2024-01-16 08:42:34 +00:00
Nico Weber a7fbb7fd0b MacPDF: Make Debug menu work when sidebar has focus 2024-01-15 23:24:07 -07:00
Nico Weber a4b5b9e82a MacPDF: Unbreak Go to Next/Previous Page after #22768 2024-01-15 23:24:07 -07:00
kleines Filmröllchen d125d16287 LibAudio+LibRIFF: Move general RIFF handling to LibRIFF
This splits the RIFFTypes header/TU into the WAV specific parts, which
move to WavTypes.h, as well as the general RIFF parts which move to the
new LibRIFF.

Sidenote for the spec comments: even though they are linked from a site
that explains the WAV format, the document is the (an) overall RIFF spec
from Microsoft. A better source may be used later; the changes to the
header are as minimal as possible.
2024-01-15 23:23:26 -07:00
Nico Weber 7fcce6b6c4 Meta/run.py: Move arguments_generator() out of class
@staticmethod decorators seem to not work in 3.9. Just move
arguments_generator() to the toplevel.
2024-01-15 23:15:30 -07:00
Nico Weber a659d7a4c2 Meta/run.py: Use if/elif instead of match
Less code, less indentation, and works with Py3.9.

(In return, the checked variable name is repeated in each conditional.)
2024-01-15 23:15:30 -07:00
Nico Weber 36bdf45f36 Meta: Port recent changes to the GN build
Ports de32b77ceb.
2024-01-15 12:15:16 -05:00
Nico Weber 2650e64bd4 MacPDF: Add a "Debug" menu with a "Show Clipping Paths" entry
...and hook it up.

I opened MainMenu.xib in Xcode, added a new "Submenu Menu Item"
from the Library (cmd-shift-l), added a User Defined
"toggleShowClippingPaths:" action on First Responder and connected
the menu item's action to that action.

(I first tried duplicating the existing Window menu and editing that,
but the Window menu is marked as `systemMenu="window"` in the xib and
I couldn't find a way to undo that in Xcode. So the Debug menu first
acted as a second Window menu.)

I made "Debug" a toplevel menu to make it consistent with Ladybird.app
for now, but I'll probably make it a submenu of "View" in the future.
2024-01-15 11:59:20 -05:00
Dan Klishch 5825eaa264 JSSpecCompiler: Save references to return value and function arguments 2024-01-14 16:05:51 -07:00
Dan Klishch 7f47340c82 JSSpecCompiler: Create FunctionDeclarations for all external functions 2024-01-14 16:05:51 -07:00
Dan Klishch 5338cdd153 JSSpecCompiler: Add bare-bones DCE pass
Right now the only dead code it eliminates is the unused phi nodes.
2024-01-14 16:05:51 -07:00
Nico Weber 5a47e71604 Utilities: Add test-jpeg-roundtrip
This creates a bitmap filled with a fixed color, then (in memory)
saves it as jpeg and loads it again, and repeats that until the
color of the bitmap no longer changes. It then reports how many
iterations that took, and what the final color was.

It does this for a couple of colors.

This is for quality assessment of the jpeg codec. Ideally, it should
converge quickly (in one iteration), and on a color not very far from
the original input color.
2024-01-14 11:35:40 +00:00
Bastiaan van der Plaat 05c0640474 Ladybird+LibWeb: Add about scheme support for internal pages 2024-01-13 13:41:09 -05:00
Bastiaan van der Plaat c0acb2918b Ladybird: Rename new-tab.html file to newtab.html 2024-01-13 13:41:09 -05:00
Bastiaan van der Plaat e3ad75d073 Ladybird: Move and format directory and error template files 2024-01-13 13:41:09 -05:00
Dan Klishch ccd701809f Everywhere: Add deprecated_ prefix to JsonValue::to_byte_string
`JsonValue::to_byte_string` has peculiar type-erasure semantics which is
not usually intended. Unfortunately, it also has a very stereotypical
name which does not warn about unexpected behavior. So let's prefix it
with `deprecated_` to make new code use `as_string` if it just wants to
get string value or `serialized<StringBuilder>` if it needs to do proper
serialization.
2024-01-12 17:41:34 -07:00
kleines Filmröllchen eada4f2ee8 AK: Remove ByteString from GenericLexer
A bunch of users used consume_specific with a constant ByteString
literal, which can be replaced by an allocation-free StringView literal.

The generic consume_while overload gains a requires clause so that
consume_specific("abc") causes a more understandable and actionable
error.
2024-01-12 17:03:53 -07:00
Dan Klishch fbdb1a3d61 JSSpecCompiler: Add SSA form building pass 2024-01-12 16:22:22 -07:00
Andrew Kaster 02edd240ae LibWeb+WebContent: Spawn Worker processes from the chrome
Instead of spawning these processes from the WebContent process, we now
create them in the Browser chrome.

Part 1/N of "all processes are owned by the chrome".
2024-01-12 15:53:11 -07:00
Timothy Flynn 7566ff90ee Meta: Port recent changes to the GN build
bc6eebb1d7
2024-01-12 07:09:54 -05:00
Andrew Kaster 521ed0e911 LibWeb: Delete LegacyPlatformObject and move behavior to PlatformObject
We have two known PlatformObjects that need to implement some of the
behavior of LegacyPlatformObjects to date: Window, and HTMLFormElement.

To make this not require double (or virtual) inheritance of
PlatformObject, move the behavior of LegacyPlatformObject into
PlatformObject. The selection of LegacyPlatformObject behavior is done
with a new bitfield of feature flags instead of a dozen virtual
functions that return bool. This change simplifies every class involved
in the diff with the notable exception of Window, which now needs some
ugly const casts to implement named property access.
2024-01-12 09:11:18 +01:00
Andrew Kaster 23600fd76e BindingsGenerator: Qualify calls to WebIDL::convert_to_int
And make sure that the header for AbstractOperations is included in all
the implementation files that call AOs from it.
2024-01-12 09:11:18 +01:00
Bastiaan van der Plaat 675b242e84 LibWeb: Add missing CSS Transforms Module Level 2 functions 2024-01-10 09:48:25 +01:00
Bastiaan van der Plaat c443f80137 LibWeb: Allow percentages on CSS transform scale functions 2024-01-10 09:48:25 +01:00
Nico Weber 822b7720e1 Meta: Let test_pdf.py be less dramatic about issue counts
For every issue string, json['issues'][issue_string] contains a list
of (page, count_of_issue_on_this_page) tuples.

To get the total number the issue appears in the current document,
we need to add up all the count_of_issue_on_this_page, not multiply the
page number with count_of_issue_on_this_page and add those (-‸ლ)
2024-01-10 09:36:33 +01:00
Andrew Kaster 480cbd9126 Meta: Update Fuzzili instructions and dockerfile since patch is upstream 2024-01-09 13:29:43 +01:00
Lucas CHOLLET 4e9e340d21 IPCCompiler: Make the connection shut down if the peer disconnected
If we know that the peer disconnected while receiving a message in the
generated code, let's shutdown the connection from here instead of
forcing each client to do so.
2024-01-07 20:10:22 +01:00
Bastiaan van der Plaat cf69fd0a09 LibWeb: Add input element valueAsDate property 2024-01-06 09:59:30 -07:00
Bastiaan van der Plaat c1ba3e5fa9 LibWeb: Add support for LegacyWindowAlias IDL extended attribute 2024-01-05 18:28:48 +01:00
Dan Klishch 0aeb7a26e9 JSSpecCompiler: Prepare for building SSA
This commit introduces NamedVariableDeclaration and
SSAVariableDeclaration and allows storing both of them in Variable node.
Also, it adds additional structures in FunctionDefinition and
BasicBlock, which will be used to store SSA form related information.
2024-01-04 12:06:56 -07:00
Dan Klishch 23164bc570 JSSpecCompiler: Replace all declarations with assignments
We assume that variable shadowing is impossible, so then there is no
reason to keep distinct Declaration and Assignment operators after
ReferenceResolvingPass.
2024-01-04 12:06:56 -07:00
Dan Klishch 12072dbac5 JSSpecCompiler: Add control flow graph simplification pass
It removes empty `BasicBlock`s with an unconditional jump continuation
and then removes unreferenced blocks from the graph.
2024-01-04 12:06:56 -07:00
Timothy Flynn 91558fa381 LibIPC+LibWeb: Add an IPC helper to transfer an IPC message buffer
This large block of code is repeated nearly verbatim in LibWeb. Move it
to a helper function that both LibIPC and LibWeb can defer to. This will
let us make changes to this method in a singular location going forward.

Note this is a bit of a regression for the MessagePort. It now suffers
from the same performance issue that IPC messages face - we prepend the
meessage size to the message buffer. This degredation is very temporary
though, as a fix is imminent, and this change makes that fix easier.
2024-01-03 10:17:00 +01:00
Shannon Booth 8ba3caf6ab LibWeb: Add support for generating FlyString parameters from IDL
We would previously always generate string parameters to pass through
to functions as a `String`. This works fine if the argument is a
`FlyString const&`, but falls apart for optional types where we need to
accept an `Optional<FlyString> const&`.

Support this by implementing a [FlyString] extended attribute which
if present results in the parameter for the function being generated
as a FlyString.
2024-01-03 10:13:47 +01:00
Nico Weber aa769d95df Meta/gn: Port f900957d26, d748edd994 2024-01-02 12:36:17 -05:00
Nico Weber 40138a4a3b Meta/gn: Build WebContent Qt bits only if enable_qt is set
With this, it's possible to build Ladybird without having Qt installed.
(Previously, the build required `moc` to exist.)

In fact, it's possible to build Ladybird without anything off `brew`
as long as you have `ninja` and `gn` (both of which don't have any
dependencies themselves and are easy to build).
2024-01-02 12:36:17 -05:00
Nico Weber 9621e77a31 Meta/gn: Move enable_qt arg into dedicated gni file
No behavior change.
2024-01-02 12:36:17 -05:00
Sönke Holz 5e8e14c378 Meta: Add riscv64 support to run.py 2024-01-02 06:16:25 -07:00
Sönke Holz 4a3dfe6517 Meta: Change !Arch.Aarch64 checks to Arch.x86_64 checks in run.py
This will make adding more architectures to run.py nicer.
2024-01-02 06:16:25 -07:00
Sönke Holz f214045d1a Meta: Set QEMU title and add QMP socket on non-x86 machines in run.py
aarch64 does an early return (except for CI), so this code wasn't
executed.
2024-01-02 06:16:25 -07:00
Shannon Booth e54f272024 LibWeb: Add support for unsigned long long parameters 2024-01-02 10:01:26 +01:00
Shannon Booth 9f5323e173 LibWeb: Use ConvertToInt for IDL integer conversion
This is how the spec tells us we should be converting to these integer
types.

Also leave around a FIXME to pass through information about the [Clamp]
and [EnforceRange] extended attributes, and port over these instances to
the new WebIDL integer typedefs.
2024-01-02 10:01:26 +01:00
Shannon Booth 11371acfaf LibWeb/WebIDL: Implement ConvertToInt and IntegerPart AOs
These are used when converting JS::Values to integers in IDL, as opposed
to our current AD-HOC solution.
2024-01-02 10:01:26 +01:00
Luke Wilde ddf601830a LibWeb: Implement SVGAnimatedString 2023-12-30 18:50:29 +01:00
kleines Filmröllchen c5a6214a3b Tests: Don't include LibWebView test if LibWeb is disabled
This unbreaks ENABLE_LAGOM_LIBWEB=OFF again.
2023-12-29 09:44:22 -05:00
Hendiadyoin1 16b14b0688 Meta: Add an isa-debugcon to the q35 machine
Otherwise we would not print debug output to the host console, which we
did in the old run.sh
2023-12-28 17:08:34 +01:00
Hendiadyoin1 5d7ce0343f Meta: Hook up the UHCI HCs up to the EHCI HCs in the q35 machine
Now devices connected to the EHCI controllers show up on the hooked up
UHCI companion controllers.
2023-12-28 17:08:34 +01:00
Jami Kettunen a768685d16 Meta: Add support for QEMU 8.2 audio
Still try parsing the now gone "-audio-help" output first, then attempt
the new "-audiodev help" if stdout was empty. This fixes support for
QEMU 8.2+ audio since "-audio-help" is now an invalid option.
2023-12-28 16:52:20 +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
Andreas Kling f900957d26 LibGfx+LibWeb: Move Gfx::ScaledFont caching from LibWeb into LibGfx
Before this change, we would only cache and reuse Gfx::ScaledFont
instances for downloaded CSS fonts.

By moving it into Gfx::VectorFont, we get caching for all vector fonts,
including local system TTFs etc.

This avoids a *lot* of style invalidations in LibWeb, since we now vend
the same Gfx::Font pointer for the same font when used repeatedly.
2023-12-26 18:15:55 +01:00
Timothy Flynn d053d6f7bb Meta: Add test262-runner to the GN build 2023-12-26 11:16:10 +01:00
Timothy Flynn 71222845bd Meta: Port recent changes to the GN build
3c74dc9f4d
2023-12-26 11:16:10 +01:00
Timothy Flynn 6f4d745452 CI: Lower the timeout for Lagom tests to 1 hour
We set the job-level timeout to 0, which means "max value" (6 hours). In
the Serenity build, we do the same, but then limit the Test step to just
1 hour to prevent hung tests from hogging CI resources. When a job-level
timeout was added to Lagom, the Test step timeout was forgotten.
2023-12-24 14:09:59 +01:00
Andreas Kling f4fa37afd2 LibJS+LibWeb: Add missing JS_DEFINE_ALLOCATOR() for a bunch of classes 2023-12-23 23:02:10 +01:00
Shannon Booth e2e7c4d574 Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as
to_number will handle something such as:

```
Optional<I> opt;
if constexpr (IsSigned<I>)
    opt = view.to_int<I>();
else
    opt = view.to_uint<I>();
```

For us.

The main goal here however is to have a single generic number conversion
API between all of the String classes.
2023-12-23 20:41:07 +01:00
Timothy Flynn 7d2172ff3d LibLocale: Update to CLDR version 44.1.0
https://cldr.unicode.org/index/downloads/cldr-44#h.nvqx283jwsx
2023-12-23 20:05:36 +01:00
Timothy Flynn ef6d1dbd4d Meta: Port recent changes to the GN build
5e1499d104
36f0499cc8
64912d4d02
809c5b0b03
2023-12-23 20:05:36 +01:00
Timothy Flynn 7233d5ed3e Meta: Alphabetically sort IDL files in the GN build 2023-12-23 20:05:36 +01:00
Timothy Flynn 697bb27c97 LibTimeZone: Update to TZDB version 2023d
https://mm.icann.org/pipermail/tz-announce/2023-December/000080.html
2023-12-23 20:05:16 +01:00
Andrew Kaster b4a8d2a19f Meta: Support -DCMAKE_BUILD_TYPE=DEBUG for Lagom builds
It's exhausting to have to do a full rebuild when stashing/unstashing
these changes locally.
2023-12-21 19:03:40 +01:00
Daniel Bertalan 19a2cc5634 CMake: Query Python interpreter with find_package
This lets us fail early at configure time if a suitable Python 3
interpreter is not present, instead of delaying the error until Ninja
attempts to run `embed_as_string_view.py` to generate a header in the
middle of the build.

Refs #21791
2023-12-20 12:54:08 -07:00
Andrew Kaster 08108ac579 Meta: Disable -fsanitize=function on macOS with clang 17 or higher
This seems to trip on calling file static functions through a function
pointer directly. Still need to reduce and report upstream.
2023-12-20 12:25:40 -07:00
Tim Schumacher 9e1df152d9 Meta: Assume virgl support to not be present if ldconfig isn't found
This mirrors the behavior of the old run.sh script.
2023-12-19 15:59:04 -07:00
Andrew Kaster d361221657 LibJS+LibWeb: Add JS::Value constructor for `JS::Handle<T>`
Similar to the constructors for ``JS::{Nonnull}GCPtr<T>``, this helper
avoids unnecessary .ptr() clutter when we want to construct Values.
2023-12-19 09:21:55 -07:00
Ali Mohammad Pur 5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Bastiaan van der Plaat b73ae80d8b LibWeb: Refactor WebContentServer mouse input message to DevicePixel 2023-12-16 11:08:51 +01:00
stelar7 d94543f964 LibWeb/IDL/Codegen: Support typedef (A or B) 2023-12-15 21:37:51 +01:00
Bastiaan van der Plaat c069ab1ca0 LibWeb: Refactor int types in WebContentServer to DevicePixels 2023-12-15 17:01:16 +01:00
kleines Filmröllchen 47b6030347 Meta: Replace run.sh by run.py
A Python script is much easier to maintain than the organically grown
variable mess that was run.sh.

For now, the script inherits most environment variable modifiability
from the shell script, but this is not a requirement.

While porting this script, a couple of improvements have been made:
- Spaces (especially in paths) cannot break most arguments anymore.
  Exceptions are environment variables specifying multiple arguments on
  purpose, these should be replaced in the future anyways.
- Force control over virtualization is now possible with
  SERENITY_VIRTUALIZATION_SUPPORT. If set to 0, this variable was
  sometimes ignored before.
- Handling Windows native QEMU is much more robust. Multiple incorrect
  checks for WSL, but not Windows native QEMU, were used before. This
  would also allow disabling native Windows QEMU much more easily in the
  future, which is necessary for GDB.
- Various machine types had wrong or outdated arguments, such as qn.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2023-12-15 00:11:50 +01:00
Dan Klishch 8126e76e59 JSSpecCompiler: Compare CFG when running regression tests 2023-12-14 09:06:05 -07:00
Dan Klishch ce6b987330 JSSpecCompiler: Add --dump-cfg option 2023-12-14 09:06:05 -07:00
Dan Klishch ff44aea917 JSSpecCompiler: Add control flow building pass 2023-12-14 09:06:05 -07:00
Sönke Holz f04a2b81be Meta: Disable -Wcast-align warning on RISC-V
Also explicitly specify `-mstrict-align` (The current default `-mcpu`
on gcc doesn't support unaligned accesses, so aligned memory accesses
are already implicitly required).
The `-Wcast-align` warning seems to oversensitive as it flags code like
this: https://godbolt.org/z/c8481o8aa

This used to be added for aarch64 in a473cfd71b, but was later removed
in 11896868d6.
2023-12-14 09:02:15 -07:00
Sönke Holz 7768f97333 Meta: Force signed char on all architectures 2023-12-14 09:02:15 -07:00
Andrew Kaster db7eff582e Meta: Update cacert.pem to 2023-12-12 2023-12-14 08:36:25 -07:00
Andrew Kaster 6e4d5b310f Meta: Port recent changes to gn build
299d35aadc
7d9fe44039
58f08107b0
2cb0039a13
bc70144df1
48a9d0ede8
149e382735
2023-12-13 10:51:27 -07:00
Andrew Kaster e0f990f1cb CMake: Don't download IDNA files when ENABLE_NETWORK_DOWNLOAD is OFF
Also tweak the debug message for the Emoji test file.
2023-12-13 10:51:27 -07:00
Dan Klishch 8dfca6c464 LibWebView: Do not treat prefix of public suffix as valid public suffix 2023-12-12 06:44:54 -05:00
stelar7 479c48643e LibWeb: Move common date microsyntax to a separate file 2023-12-11 14:04:27 -07:00
Andrew Kaster 0052f9e895 CMake: Don't try to enable install options if no languages are enabled
This removes a CMake dev warning when building serenity via the
Superbuild.
2023-12-11 11:03:32 -07:00
Kyle Pereira 8191f2b47a LibPDF: Add parameter for background color of render 2023-12-10 16:44:24 +01:00
Timothy Flynn 43e9dc0500 LibUnicode: Use weak symbols to provide default IDNA defintions
Rather than using #ifdef blocks, update the fallback IDNA definitions to
use weak symbols to match the rest of LibUnicode / LibLocale.
2023-12-10 10:19:14 -05:00
Simon Wanner 7d9fe44039 LibUnicode: Download and parse IDNA data 2023-12-10 08:04:58 -05:00
Bastiaan van der Plaat 466153e680 Ladybird+LibWeb: Add basic select element support 2023-12-09 22:06:20 +01:00
tetektoza bcec05a7cb GMLCompiler: Add enum initializer for button_style property
This patch adds missing enum initializer for button_style property in
enum initializer generator in GML compiler.
2023-12-08 01:06:09 +01:00
tetektoza c583888cc9 GMLCompiler: Add enum initializer for checkbox_position property
This patch adds a enum initializer for checkbox_position property
used in .gml files which are parsed by GML compiler.
2023-12-08 01:06:09 +01:00
tetektoza 0be70ed97a GMLCompiler: Add enum initializer for opportunistic_resizee property
This patch adds a enum initializer for opportunistic_resizee and
makes the method that uses this property public so it's available for
GML compiler.
2023-12-08 01:06:09 +01:00
Tim Schumacher 35d4b36201 GMLCompiler: Fully qualify child class names
If we don't do this, and there a class in a namespace with the same
name, type resolution gets confused between `<namespace>::<class>` and
`<class>::<constructor>`.
2023-12-08 01:06:09 +01:00
Dan Klishch 96d44b1572 Userland: Make bit-fields compatible with MSVC C++ ABI 2023-12-07 10:28:19 -07:00
Dan Klishch 00928764e9 JSSpecCompiler: Add our first test :^) 2023-12-07 10:13:21 -07:00
Dan Klishch 107a3b44fa JSSpecCompiler: Add regression test runner 2023-12-07 10:13:21 -07:00
Dan Klishch 610fe28115 Meta: Add option to specify custom test names for Lagom 2023-12-07 10:13:21 -07:00
Dan Klishch dbd624e875 JSSpecCompiler: Allow dumping AST after specified passes 2023-12-07 10:13:21 -07:00
Bastiaan van der Plaat 4966c083df LibWeb: Remove progress element custom paintable use shadow dom instead 2023-12-07 11:37:01 +01:00
Timothy Flynn d81c531322 Meta: Explicitly list the Ladybird-related HTML files to bundle
As noted in the comment added here, we cannot just list the directory
containing these files.
2023-12-04 19:46:35 -05:00
Timothy Flynn 4d5d282e6a Meta: Port recent changes to the GN build
64ffae9c55
2023-12-04 12:03:48 -07:00
Timothy Flynn 4cfeb41c4b LibWebView+WebContent: Add APIs to manipulate DOM nodes
This adds APIs to allow Ispector clients to:
* Change a DOM text or comment node's text data.
* Add, replace, or remove a DOM element's attribute.
* Change a DOM element's tag.
2023-12-04 01:33:57 +01:00
Andreas Kling 8b7d27b349 LibJS+LibWeb: More bringing module loading closer to spec
In particular, this patch removes three host hooks on JS::VM in favor
of the new JS-side module loading stuff.
2023-12-03 20:46:55 +01:00
Timothy Flynn d6df13af6a LibWebView: Remove the now-unused ConsoleClient
It is superseded by the Inspector's console.
2023-12-02 10:34:22 +01:00
Timothy Flynn dc04385465 Ladybird/AppKit: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn c4daaa9902 Ladybird/Qt: Remove the standalone JavaScript console 2023-12-02 10:34:22 +01:00
Timothy Flynn 97665fa92f Meta: Port recent changes to the GN build
fbfb70f81a
2023-12-02 10:34:22 +01:00
Timothy Flynn 8504d8f588 Meta: Support GPU painting in the GN build 2023-12-01 20:07:27 -05:00
Timothy Flynn a7073c3f1f LibJS: Skip test262 tests with the CanBlockIsFalse flag
From test262 documentation, this flag means:

    The test file should only be run when the [[CanBlock]] property of
    the Agent Record executing the file is `false`.

This patch stubs out the accessor for that internal slot and skips tests
with the CanBlockIsFalse if that internal slot is true.
2023-11-30 09:51:46 -05:00
Timothy Flynn 5913efbb45 LibWeb: Add a visit_edges() override to AbstractBrowsingContext
AbstractBrowsingContext has a subclass RemoteBrowsingContext without a
visit_edges() override (and it doesn't really need one). But currently,
we rely on subclasses visiting AbstractBrowsingContext's opener BC.

This adds a visit_edges() to AbstractBrowsingContext to explicitly visit
the opener BC itself.
2023-11-30 08:49:15 +00:00
Timothy Flynn b54786ee95 LibJSGCVerifier: Use more general shebang line and clarify instructions
My system's python3 is not in /bin/.

The README did not indicate that a clang-toolchain build of Serenity is
required, so this patch adds that explicit instruction.
2023-11-30 08:49:15 +00:00
Timothy Flynn 6eadf4a778 LibWebView: Remove now-unused PropertyTableModel 2023-11-29 13:56:35 +01:00
Timothy Flynn 2891633877 Meta: Port recent changes to the GN build
9836a9ad0e
bc9cdd4394
28723d8be1
f4a5c136c3
2023-11-29 13:56:35 +01:00
Shannon Booth 96af80acd1 LibWeb: Port Intrinsics from DeprecatedString 2023-11-28 17:15:27 -05: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
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 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
Stephan Vedder 8c65cc185a Meta: Add a minimal SDL2 based videoplayer for Lagom 2023-11-27 09:04:47 -07:00
Timothy Flynn 778f10fb26 Revert "Meta: Port recent changes to GN build"
This reverts commit 754ecc56dd.

This was handled by: 49b7539290.
2023-11-24 11:24:58 -05:00
Timothy Flynn 754ecc56dd Meta: Port recent changes to GN build
a6106ca221
04c094343f
2023-11-24 11:22:17 -05:00
Andrew Kaster 49b7539290 Meta: Port recent changes to gn build
b7f8d7e357
048e179572
6d1a1daff9
04c094343f
a6106ca221
2023-11-24 08:43:01 -07:00
Andreas Kling a6106ca221 AK: Use __builtin_offsetof() + -Wno-invalid-offsetof to silence ASAN
ASAN was crying way too much when running the LibJS JIT since the old
OFFSET_OF implementation was too wild for its liking.

By turning off the invalid-offsetof warnings, we can use the offsetof
builtin instead. However, I'm leaving this as a wrapper macro, since
we may still want to do something different for other compilers.
2023-11-24 12:49:15 +01:00
Shannon Booth 04c094343f LibWeb+Meta: Add wrapper for the BufferSource/ArrayBufferView IDL types
These wrappers will make it much easier to do various operations on the
different ArrayBuffer-related classes in LibWeb compared to the current
solution, which is to just accept a Handle<Object> everywhere (and use
"any" in the *.idl files).

Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
2023-11-24 08:43:35 +01:00
Timothy Flynn c03b69e664 LibWebView+Ladybird: Remove now-unused WebView TreeModel
This was used to provided base functionality for model-based chromes for
viewing the DOM and accessibility trees. All chromes now use the WebView
inspector model for those trees, thus this class is unused.
2023-11-24 08:37:19 +01:00
Timothy Flynn 84c4eef565 Ladybird/AppKit: Port the Inspector to the WebView InspectorClient 2023-11-24 08:37:19 +01:00
Timothy Flynn 1fe486cebe LibWebView: Implement a WebView-based Inspector client
This is modeled after a similar implementation for the JS console.

This client takes over an inspector WebView (created by the chrome) to
create the inspector application. Currently, this application includes
the DOM tree and accessibility tree as a first pass. It can later be
extended to included the style tables, the JS console itself, etc.
2023-11-24 08:37:19 +01:00
Timothy Flynn ffdc2d8add LibWeb+LibWebView+WebContent: Add an Inspector IDL object to the Window
This is an internal object that must be explicitly enabled by the chrome
before it is added to the Window. The Inspector object will be used by a
special WebView that will replace all chrome-specific inspector windows.
The IDL defines methods that this WebView will need to inform the chrome
of various events, such as the user clicking a DOM node.
2023-11-24 08:37:19 +01:00
Timothy Flynn 16ac2089e3 Meta: Port recent changes to GN build
4ab2903e25
70353b79af
2023-11-24 08:37:19 +01:00
Nico Weber ec190baa55 MacPDF: Replace newlines with spaces in outline titles
Else, outline items that have newlines in them end up with a weird
vertical offset.

(This does affect the outline item's tooltip, which shows the whole
title. But not having a newline there seems alright, arguably
preferable.)
2023-11-21 10:07:41 +01:00
Nico Weber e13954410a MacPDF: Show tooltip with full title on elided outline titles 2023-11-21 10:07:41 +01:00
Nico Weber fac0a456e6 MacPDF: Use correct encoding for outline titles
The title of an OutlineItem is already in UTF-8.

This is currently done in LibPDF's Parser::parse_string(). I think
that's not quite the right place (it shouldn't be done for all strings)
and not done quite right (text strings should convert from
PDFDocEncoding to UTF-8 unless prefixed by an UTF-8 BOM), but even if
that changes, I think we'll keep OutlineItem.title in UTF-8.
2023-11-21 10:07:41 +01:00
Sam Atkins 148f873321 LibWeb: Merge background-position parsing into position code
Implemented by adding the extra 3-value syntax as its own case and only
running it when parsing background-position. I'm sure it could be
implemented in a smarter way but this is still a bunch less code than
before. :^)
2023-11-21 01:29:26 +01:00
Sam Atkins 26d6ba6f58 LibWeb: Parse the CSS position type automatically
This means `object-position` will no longer incorrectly accept the
3-value background-position syntax.

Remove the now-ambiguous and unused `position` enum while we're at it.
(This enum only existed as a hack.)
2023-11-21 01:29:26 +01:00
Andreas Kling bfd354492e LibWeb: Put most LibWeb GC objects in type-specific heap blocks
With this change, we now have ~1200 CellAllocators across both LibJS and
LibWeb in a normal WebContent instance.

This gives us a minimum heap size of 4.7 MiB in the scenario where we
only have one cell allocated per type. Of course, in practice there will
be many more of each type, so the effective overhead is quite a bit
smaller than that in practice.

I left a few types unconverted to this mechanism because I got tired of
doing this. :^)
2023-11-19 22:00:48 +01:00
Sam Atkins b74f5b1ca1 Meta: Publish dumped ref-test images as an Azure CI artifact
Whenever the tests produce a `test-dumps` directory, publish the files
in it as an artifact. This lets us peek at the screenshots and see
what's mismatched, instead of just having to guess.
2023-11-18 07:49:59 -05:00
Martin Janiczek b56e022ce8 AK: Add roundtrip fuzzer for Base64 2023-11-18 10:01:29 +01:00
Martin Janiczek 0465ba242b LibCompress: Upgrade compression fuzzer into a roundtrip fuzzer 2023-11-18 10:01:29 +01:00
Timothy Flynn 6e928e426a Meta: Add test-js to the GN build 2023-11-18 01:16:05 -07:00
Timothy Flynn 3c5909f47e Meta: Update GN build to use CLDR version 44.0.1
See: 38dd284915
2023-11-18 01:16:05 -07:00
Timothy Flynn 19d50ee2c2 Meta: Extract .zip file directories in an encoding-agnostic manner
The current implementation fails if a file in the archive is not valid
UTF-8. The CLDR 44.0.1 package unfortunately contains such files (it
errantly has .DS_Store files).
2023-11-18 01:16:05 -07:00
Timothy Flynn b65c07082b Meta: Properly handle GN unit tests which define their own deps
If a unit tests defines a `deps` array, the unit test template would
have tried to overwrite it (and it is actually an error to overwrite
a non-empty list with another non-empty list).
2023-11-18 01:16:05 -07:00
Timothy Flynn 6a73e027a0 Meta: Remove explicit setting of output_dir in GN unit test template
This is causing unit tests to be linked in //Build/obj/Tests rather than
//Build/bin. Note that object files are not affected by this change.
2023-11-18 01:16:05 -07:00
Timothy Flynn 392d9d080d Meta: Port recent changes to GN build
80071b1d48face038a60b98fc8c3414de1cb9633
3f6a26d07d1536eb5e4e39eedfd4e0135eabf536
2023-11-18 01:16:05 -07:00
Simon Wanner 86b85aa68b LibJS: Introduce Builtins
Builtins are functions that can be detected during bytecode generation
and enable fast-paths in the JIT.
2023-11-17 19:06:25 +01:00
Dan Klishch 2dba79bc6b Meta: Globally disable floating point contraction
FP contraction is a standard-conforming behavior which allows the
compiler to calculate intermediate results of expressions containing
floating point numbers with a greater precision than the expression type
allows. And in theory, it enables additional optimizations, such as
replacing `a * b + c` with fma(a, b, c).

Unfortunately, it is extremely hard to predict when the contraction will
happen. For example, Clang 17 on x86_64 with the default options will
use FMA only for constant-folded non-constexpr expressions. So, in
practice, FP contraction leads to hard-to-find bugs and inconsistencies
between executables compiled with different toolchains or for different
OSes. And we had two instances of this happening last week.

Since we did not ever used -mfma on x86_64, this patch can only possibly
regress performance on Apple ARM devices, where FMA is enabled by
default. However, this regression will likely be negligible since the
difference would be one additional add instruction, which would be then
likely executed in parallel with something else.
2023-11-16 19:05:13 -05:00
Aliaksandr Kalenik 61a2e59d87 LibAccelGfx+WebContent: Add GPU painter support on macOS
With these changes it is now possible to create OpenGL context on macOS
and run GPU-painter. For now only QT client has a CLI param that turns
it on though.
2023-11-16 15:13:16 +01:00
Timothy Flynn 2c1bbf5a99 AK+LibIDL: Put IDL dbgln statement behind a debug flag
This is a bit spammy now that we are performing some overload resolution
at build time. The fallback to an interface has generally worked fine on
the types it warns about (BufferSource, Module, etc.) so let's not warn
about it for every build.
2023-11-15 23:42:53 +01:00
Timothy Flynn 50406f541b Meta: Port recent changes to GN build
124c378472
2023-11-15 11:28:39 -05:00
Timothy Flynn 665a95e39e Meta: Support (and default to) Ladybird's AppKit chrome in the GN build
The Qt chrome may be used by setting `enable_qt = true` in args.gn.
2023-11-14 14:29:35 -05:00
Timothy Flynn 652bbe172b Meta: Port recent changes to GN build
86ee7d219e
75caccafa4
1b30b510b9
bb43bd2dee
6322d68b1b
73ef102b01
923027b1df
dfa79ba6d8
66c9696687
521f8bd5f2
734076946b
0df06ce273
1ca46afa2f
66bd75f2b9
43dc9dfb69
4b94b0b561
4c5d48f861
c4efc0a5aa
3999c74237
4d356cfca5
2023-11-14 09:36:36 -05:00
Timothy Flynn 6ac57448af Meta: Explicitly set the sysroot path during Lagom builds
Otherwise, we don't set the -isysroot flag, and my mac is unable to
build with GN.
2023-11-14 09:36:36 -05:00
Tim Ledbetter 1793f51bc6 LibDNS: Make DNS packet parsing fallible
Previously, a DNS packet containing an invalid name would be returned
with an empty name. With this change, an error is returned if any error
is encountered during parsing.
2023-11-14 10:12:44 +01:00
Matthew Olsson 5824916f8c LibWeb: Add KeyframeEffect IDL objects 2023-11-14 10:12:02 +01:00
Matthew Olsson 99bb5a1d08 IDLGenerators: Allow specifying multiple constructors 2023-11-14 10:12:02 +01:00
Lucas CHOLLET 86ee7d219e LibCompress/LZW: Use its own debug flag
The file still used the `GIF_DEBUG` flag from when it was a part of the
GIF decoder. Let's give `LZWDecoder` its own flag.
2023-11-12 13:56:27 +01:00
Matthew Olsson 82c36b303c IDLGenerators: Do not emit null literals as default values 2023-11-11 22:45:16 +01:00
Timothy Flynn 4b94b0b561 LibWeb: Begin implementing the Clipboard API
https://w3c.github.io/clipboard-apis/

This implements enough for navigator.clipboard.writeText(String).
2023-11-11 08:54:37 +01:00
Idan Horowitz f2410071cd LibIDL: Support dictionary types when distinguishing argument indices 2023-11-11 08:48:25 +01:00
Idan Horowitz f837f02eea LibIDL+LibWeb: Resolve distinguishing argument index at build time
Aside from the obvious performance benefits, this will allow us to
properly handle dictionary types. (whose dictionary-ness is only known
at build-time)

Much of the rest of the overload resolution algorithm steps can (and
should) be evaluated at build-time as well, but this is a good first
step.
2023-11-11 08:48:25 +01:00
Nico Weber 8f4966fc5c test_pdf.py: Output tweaks
* Count files that are password-protected
* Use `pdf --json` to groups by missing feature and then by file
  instead of by file first, feature second
* Count files that render with issues
* Print number of files without issues last
* Always print all crash stacks
2023-11-10 14:46:06 +01:00
Andrew Kaster a0d8990c82 CMake: Bump CMake minimum up to 3.21 to work around CLion bug
Fix the recursive directory bug in CLion Nova EAP's CMake version in a
way that doesn't also break `./Meta/serenity.sh run lagom ladybird`.

This brings the Lagom minimum required closer to the Serenity minimum
required. Which is still fine, because the serenity.sh script knows how
to build CMake from source if a developer's local copy is too old.
2023-11-10 09:36:22 +01:00