Commit graph

3241 commits

Author SHA1 Message Date
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
c5860d1d70
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