Commit Graph

2998 Commits

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