Commit graph

2594 commits

Author SHA1 Message Date
Daniel Bertalan 1f747b9132 CMake: Use CMAKE_POSITION_INDEPENDENT_CODE instead of explicit -fpic
This makes CMake pass `-fpie` instead of `-fpic` to the compiler when
building the Kernel and userland *executables*. This allows the compiler
to make certain optimizations based on the fact that the code will be
used in an executable, such as not having to emit `.localalias` symbols.
This leads to a 450 KiB decrease in the size of the Kernel binary.
2023-09-18 10:26:42 +02:00
Daniel Bertalan 4defa401d3 Toolchain+Ports: Update binutils to 2.41
Aside from a straightforward rebase, this contains an out-of-tree patch
from MaskRay which adds the `-Bsymbolic-non-weak-functions` flag to ld.
2023-09-18 10:26:42 +02:00
Shannon Booth e123492470 LibWeb: Allow ArrayBuffer attributes to be used in IDL
The FileReader IDL has the following entry:
```
readonly attribute (DOMString or ArrayBuffer)? result;
```

This change supports the use ArrayBuffer as a JS built-in in this
definition.
2023-09-17 16:37:31 -06:00
Dan Klishch 67e07fa4e2 JSSpecCompiler: Introduce ControlFlowOperator nodes 2023-09-17 16:04:42 -06:00
Dan Klishch 81519975c5 JSSpecCompiler: Add reference resolving pass
It replaces UnresolvedReference with Variable, FunctionPointer, or
SlotName nodes. Also, it gathers all variable names from their
declarations.
2023-09-17 16:04:42 -06:00
Dan Klishch 326bac19d9 JSSpecCompiler: Make nodes inherit from Statement or Expression
The distinction between them will become important during CFG building.
2023-09-17 16:04:42 -06:00
Dan Klishch ed5ef4da6d JSSpecCompiler: Make clang-tidy happier, no functional changes 2023-09-17 16:04:42 -06:00
nipos 2e0960a7ef Meta: Don't link LibCrypt to native libcrypt on Haiku 2023-09-17 13:38:12 -06:00
nipos 2691c079d4 Meta+Ladybird: Link to libnetwork on Haiku 2023-09-17 13:38:12 -06:00
nipos e345085329 Meta+Ladybird: Add some extra definitions for Haiku 2023-09-17 13:38:12 -06:00
implicitfield 7cb80c67d8 checksum: Add support for BLAKE2b 2023-09-17 16:49:35 +03:30
implicitfield 1b3ad1c721 LibCrypto: Add support for BLAKE2b 2023-09-17 16:49:35 +03:30
Aliaksandr Kalenik da2c18d1f9 Meta: Update LibJSGCVerifier to build with llvm 16.0.6
Changes to fix LibJSGCVerifier build with llvm version used in
BuildClang.sh
2023-09-16 20:51:28 -06:00
Andrew Kaster 78ebeb6a5a Ladybird/Android: Move gradle files to Ladybird/Android directory
And add documentation for how to use the thing
2023-09-15 14:18:52 -06:00
Timothy Flynn 139c575cc9 LibUnicode: Update to Unicode version 15.1.0
https://unicode.org/versions/Unicode15.1.0/

This update includes a new set of code point properties, Indic Conjunct
Break. These may have the values Consonant, Linker, or Extend. These are
used in text segmentation to prevent breaking on some extended grapheme
cluster sequences.
2023-09-15 18:30:26 +02:00
Tim Schumacher b0c1dc14f3 Meta: Download pnp_ids.html to the cache directory 2023-09-14 08:05:00 +01:00
Tim Schumacher cc6054ae3b Meta: Download commonmark.spec.json to the cache directory 2023-09-14 08:05:00 +01:00
Sam Atkins 2cb816ad69 LibWeb: Alphabetize property names in Properties.json
And add a check to make sure it stays that way!
2023-09-11 10:42:00 +01:00
Sam Atkins b78b5e6297 LibWeb: Generate property_is_shorthand(PropertyID) function
Sometimes we want to know if a property is a shorthand, but don't care
what its longhands are.
2023-09-11 10:42:00 +01:00
Dan Klishch 9b7aa8f6b6 Meta: Do not spam "<compiler-name>: command not found"
In bd7d01e9, Meta/serenity.sh started checking cc and cxx if CC or CXX
respectively are not set in the environment. My machine does not have
cxx symlink in PATH, so every invocation of the script resulted in
the "cxx: command not found" message outputted to stderr, and that
became quite annoying.
2023-09-09 13:38:06 -06:00
Dan Klishch 4c4e1e1aed JSSpecCompiler: Add if branch merging pass
It merges standalone IfBranch/ElseIfBranch nodes into IfElseIfChain
nodes. This will ease CFG generation later.
2023-09-09 11:20:43 -06:00
Dan Klishch 092ed1cc8a JSSpecCompiler: Allow storing NullableTrees in nodes
And use this in ElseIfBranch node.
2023-09-09 11:20:43 -06:00
Dan Klishch 4eede5282c JSSpecCompiler: Allow storing error text in ErrorNode
This will be the main way to communicate errors from compilation passes.
2023-09-09 11:20:43 -06:00
Dan Klishch 72794e7843 JSSpecCompiler: Add function call canonicalization pass
It simplifies ladders of BinaryOperators nodes in the function call
arguments into nice and neat FunctionCall node. Ladders initially appear
since I do not want to complicate expression parser, so it interprets
`f(a, b, c, d)` as `f "function_call_operator" (a, (b, (c, d))))`.
2023-09-09 11:20:43 -06:00
Dan Klishch 1c4cd34320 JSSpecCompiler: Restrict usage of NodeSubtreePointer
This class stores a non-owning raw pointer to a member of `Node`, so
extra care is needed to ensure that referenced `Node`s will be alive
by the time `NodeSubtreePointer` is used. Since we only need to use this
class while traversing AST in `RecursiveASTVisitor`, access to class
methods can be restricted using `Badge<RecursiveASTVisitor>`.
2023-09-09 11:20:43 -06:00
Timothy Flynn d0fd34112f LibJS: Remove the now-unused ThrowableStringBuilder 2023-09-09 13:03:25 -04:00
Andrew Kaster bd7d01e975 Meta: Move compiler detection functions to their own file
This way we can use them in other scripts that want to build Lagom
and pick a suitable host compiler.
2023-09-08 09:01:34 -06:00
Shannon Booth 41928c2902 LibWeb: Port DOMException interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Andrew Kaster 4e9dc127ae Meta: Run Android CI via gradle wrapper instead of via CMake 2023-09-06 11:26:20 -04:00
Shannon Booth 914fb90bbe LibWeb: Don't generate Optional<String> from IDL for non-null arguments
Previously if the IDL was something like:
```
constructor(optional DOMString data = "");
```

We were generating code that would be passing through to the constructor
an Optional<String> - even though for this situation it is not possible
for it to be null.

Instead, if we know if there is a default value that is non-null and the
type is not nullish, just generate the cpp code as a String.
2023-09-05 20:36:09 -04:00
Shannon Booth f991e40d7f LibWeb: Support [Reflect] on IDL String attributes that may return null
This change allows IDL interfaces to be compiled using new AK String
which have a attribute in the interface that may return null.

Without this change we would run into a compile error from code such as
the following example:

```
auto retval = impl->deprecated_attribute(HTML::AttributeNames::ref);

if (!retval.has_value()) {
    return JS::js_null();
 }
 return JS::PrimitiveString::create(vm, retval.release_value());
```

As `deprecated_attribute` returns a `DeprecatedString` instead of an
`Optional<String>`. Fix that by using the non-deprecated attribute
implementation, and falling back to the empty string for where we cannot
return null.

Also add a test here to cover a regression I almost introduced here
which was not previously covered by our test suite.

Ideally, all of this should actually just be calling
Element::get_attribute_value, but I'm not entirely sure at this stage
what the behavioral change would be to test for here. Since this
implementation preserves the previous behavior, stick with it, and add a
FIXME for now.
2023-09-05 20:36:09 -04:00
Shannon Booth 0f6782fae6 LibWeb: Rename Element::attribute to Element::deprecated_attribute
This should allow us to add a Element::attribute which returns an
Optional<String>. Eventually all callers should be ported to switch from
the DeprecatedString version, but in the meantime, this should allow us
to port some more IDL interfaces away from DeprecatedString.
2023-09-05 20:36:09 -04:00
Daniel Bertalan dac443fbff Meta: Link Lagom with LLD by default and allow configuring the linker
This ports over the `LADYBIRD_USE_LLD` option from the standalone
Ladybird build and generalizes it to work for mold as well: the
`LAGOM_USE_LINKER` variable can be set to the desired name of the
linker. If it's empty, we default to trying LLD and Mold on ELF
platforms (in this order).
2023-09-05 14:50:36 +02:00
Sam Atkins e9b58ff096 LibWeb: Move check for CSS-wide keywords to ValueID.h
This feels like a better home for it. The new name better reflects the
spec phrasing.
2023-09-05 14:27:23 +02:00
Timothy Flynn bb4eca2037 LibLocale: Remove compact currency patterns
These are no longer used by the Intl.NumberFormat implementation.
2023-09-04 18:22:28 +02:00
Sönke Holz d6906736cc Meta: Add -fno-omit-frame-pointer flag
We currently only use frame pointer-based backtrace generation.
This option is necessary for RISC-V as otherwise the compiler doesn't
save `fp` most of the time.
I made this flag not riscv64 exclusive, as we should do everything
to make that kind of backtrace generation work.
(https://discord.com/channels/830522505605283862/1139481927594803260/1148020960499351643)
2023-09-04 07:45:35 +02:00
Andrew Kaster 7bc009d80f Ladybird: Add new template Kotlin Android application without Qt
This template app from Android Studio should hopefully be more fun to
work on than the Qt wrapped application we were using before. :^)

It currently builds the native code using gradle rules, and has a stub
WebViewImplementationNative class that will wrap a c++ class of the same
name that inhertis from WebView::ViewImplementation. Spawning helper
processes and creating proper views in Kotlin is next on the list.
2023-09-03 11:38:51 +02:00
Shannon Booth d4a890080d LibWeb: Switch IDL from UseNewAKString to UseDeprecatedAKString
NewAKString is effectively the default for any new IDL interface, so
let's mark this as the default behavior. It also makes it much easier to
figure out whatever interfaces are still left to port over to new AK
String.
2023-09-02 19:23:41 +01:00
Dan Klishch 198591cc20 JSSpecCompiler: Add infrastructure to run compiler passes on AST 2023-09-02 19:57:06 +02:00
Dan Klishch cd8f4aaa7d JSSpecCompiler: Introduce Function and ExecutionContext classes
Currently, they are not extremely useful, but the plan is to store
all function-local state in JSSpecCompiler::Function and all
"translation unit" state in ExecutionContext.
2023-09-02 19:57:06 +02:00
Andrew Kaster 4641af7873 AK: Always use our assertion failure method, and add backtrace to it
On platforms that support it, enable using ``<execinfo.h>`` to get
backtrace(3) to dump a backtrace on assertion failure. This should make
debugging things like WebContent crashes in Lagom much easier.
2023-09-01 11:50:47 +02:00
Sebastian Zaha 8dcb7c29ad Meta: Port recent build changes to gn build
This ports the following commits:

e26ead0995
5c5a00dd3a
2023-09-01 09:00:03 +02:00
Timothy Flynn f7adc3320d Meta: Replace Lagom's LibWebView setup with LibWebView's CMakeLists.txt
This lets us add new sources to LibWebView in a single location.
2023-08-31 06:33:04 -04:00
Dan Klishch 66f4cdba85 JSSpecCompiler: Make it compile and dump AST created from stdin input 2023-08-31 11:00:31 +02:00
Dan Klishch db0a03d1fb JSSpecCompiler: Add infrastructure to parse <emu-clause> into AST 2023-08-31 11:00:31 +02:00
Dan Klishch f70e39d501 JSSpecCompiler: Add TextParser for converting algorithm steps into AST 2023-08-31 11:00:31 +02:00
Dan Klishch 9f29e04897 JSSpecCompiler: Add functions for splitting node contents into tokens 2023-08-31 11:00:31 +02:00
Dan Klishch 8342361481 JSSpecCompiler: Add Token type 2023-08-31 11:00:31 +02:00
Dan Klishch 5846470a5f JSSpecCompiler: Add stubs for AST types 2023-08-31 11:00:31 +02:00
Dan Klishch da30afa0c3 Meta: Allow overriding root for local includes
Previously, we always assumed that local includes are relative to the
parent directory of a file. This effectively banned style-wise
multi-directory subprojects which are not libraries, since there was no
way to cleanly reference local file from a different directory.

This commit relaxes the restrictions by introducing
LOCAL_INCLUDE_ROOT_OVERRIDES. Entry in the set changes root of the
local includes to itself for all files in its subtree.
2023-08-31 11:00:31 +02:00
Timothy Flynn bf59e06d2a Ladybird+LibWebView: Extract common JS console functionality to a helper
This creates WebView::ConsoleClient to handle functionality that will be
common to the JS consoles of all Ladybird chromes. This will let each
chrome focus on just the UI.

Note that this includes the `console.group` functionality that only the
Serenity chrome previously had. This was a FIXME in the Qt chrome, and
it is implemented such that all chromes will receive this functionality
for free.
2023-08-30 09:24:59 +02:00
Timothy Flynn 1e1c3e5a34 LibWebView: Create a method to syntax-highlight page source with HTML
This tokenizes a page's source to produce HTML with syntax highlighting.
The first implementation here is rather simple; we do not yet implement
code folding, line numbers, etc.

The goal is for this to be used as the View Source implementation for
all Ladybird chromes.
2023-08-29 08:11:11 -04:00
Sebastian Zaha 967cb86c5b Meta: Port recent build changes to gn build
This ports the following commits:

848ec538c6
703c2bb06e
27dd2a40ad
daefe744ba
9812031a02
4c0816b002
8bb275f2ea
3f122b7335
2023-08-29 09:37:52 +02:00
Timothy Flynn 5d7e73adfe Meta: Add and document convenient method to build non-Qt Ladybird chrome
This lets us switch between the AppKit and Qt chromes more easily.
2023-08-27 19:02:36 -04:00
Luke Wilde af2886449a LibWeb: Implement PerformanceObserver 2023-08-27 23:27:44 +02:00
Timothy Flynn 3f122b7335 LibWebView: Allow using native/user style sheets on Lagom
Move the methods to set the native/user style sheets to the base
ViewImplementation class. We must also generate the native style sheet
explicitly for now, as LibWebView on Lagom isn't able to include the
main LibWebView CMakeLists.txt file yet.
2023-08-26 15:32:36 -04:00
Timothy Flynn 70a87795e4 LibWeb: Remove the Tests subfolder
These were used only by test-web, which was removed in commit 81aa60163.
2023-08-25 05:39:58 +02:00
Andrew Kaster d1aea87889 LibWeb: Add NavigateEvent, the main event of the Navigation API
This event is the star of the show, and the main way that web content
can react to either programmatic or user-initiated navigation.

All of the fun algorithms will have to come later though.
2023-08-24 11:03:57 -06:00
Andrew Kaster 3dd3b2019d LibWeb: Add NavigationTransition, a transient property of Navigation
This property is useful for web content to determine whether an ongoing
navigation has settled or not.
2023-08-24 11:03:57 -06:00
Andrew Kaster 4989375191 LibWeb: Add NavigationDestination, used for NavigateEvents
This class will be used in the algorithms for the navigate event firing
algorithms to populate the destination field of the NavigateEvent.
2023-08-24 11:03:57 -06:00
Andrew Kaster 0c2f758067 LibWeb: Implement the start of the Navigation API
This API is how JavaScript can manipulate the new Navigable concepts
directly. We are still missing most of the interesting algorithms on
Navigation that do the actual navigation steps, and call into the
currently WIP navigable AOs.
2023-08-24 11:03:57 -06:00
Andrew Kaster 51c2835044 LibWeb: Add NavigationCurrentEntryChangeEvent, fired when navigating
This event will be fired by Navigation when changing the current
NavigationHistoryEntry.
2023-08-24 11:03:57 -06:00
Andrew Kaster 3c1d4eab24 LibWeb: Add NavigationHistoryEntry, a wrapper around SessionHistoryEntry 2023-08-24 11:03:57 -06:00
Andrew Kaster cf0ffc12cc BindingsGenerator: Handle nullable enum properties
Add some checks to the statement wrapping code to make sure we properly
handle the expected pattern of returning ``Optional<Enum>`` from
nullable enum properties.
2023-08-24 11:03:57 -06:00
Sam Atkins eab44f982a Meta: Use embed_as_string_view() for stringify_gml() 2023-08-24 07:42:12 +01:00
Sam Atkins abba6f7b54 LibWeb: Use embed_as_string_view() for style sheet source generation 2023-08-24 07:42:12 +01:00
Sam Atkins af4642c826 Meta: Make embed_as_string_view.py usable by CMake builds :^) 2023-08-24 07:42:12 +01:00
Bastiaan van der Plaat c88f14902b LibWeb: Add DOMQuad and text tests 2023-08-23 12:11:21 +01:00
Bastiaan van der Plaat 43825acc79 Meta+BindingsGenerator: Add postfix to member_value_name to make unique 2023-08-23 12:11:21 +01:00
Tim Schumacher dbc25f18ec LibCompress: Let BrotliDecompressionStream take a MaybeOwned 2023-08-23 12:03:37 +01:00
Tim Schumacher 8a853278d0 LibCompress: Port ZlibDecompressor to AK::Stream 2023-08-23 12:03:37 +01:00
Timothy Flynn eb8f7b303c LibLocale+LibJS: Make relative time format APIs infallible
These APIs only perform small allocations, and are only used by LibJS.
Callers which could only have failed from these APIs are also made to
be infallible here.
2023-08-23 05:29:21 +02:00
Timothy Flynn 7536648498 LibLocale+LibJS+ClockSettings: Make date time format APIs infallible
These APIs only perform small allocations, and are only used by LibJS
and the time zone settings widget. Callers which could only have failed
from these APIs are also made to be infallible here.
2023-08-23 05:29:21 +02:00
Timothy Flynn 0914e86691 LibLocale+LibJS: Make number format APIs infallible
These APIs only perform small allocations, and are only used by LibJS.
Callers which could only have failed from these APIs are also made to
be infallible here.
2023-08-23 05:29:21 +02:00
Timothy Flynn cd526813e6 LibLocale+LibJS: Make locale data APIs infallible
These APIs only perform small allocations, and are only used by LibJS.
Callers which could only have failed from these APIs are also made to
be infallible here.
2023-08-23 05:29:21 +02:00
Timothy Flynn 2a8f558911 CI: Add a step to ensure the AppKit chrome can compile
The main build step builds the Qt chrome, because ENABLE_QT=ON is the
default. This adds a step to ensure we can build the AppKit chrome as
well.
2023-08-22 21:36:19 -04:00
Timothy Flynn 5722d0025b Ladybird: Implement an AppKit chrome for macOS :^)
This adds an alternative Ladybird chrome for macOS using the AppKit
framework. Just about everything needed for normal web browsing has
been implemented. This includes:

* Tabbed, scrollable navigation
* History navigation (back, forward, reload)
* Keyboard / mouse events
* Favicons
* Context menus
* Cookies
* Dialogs (alert, confirm, prompt)
* WebDriver support

This does not include debugging tools like the JavaScript console and
inspector, nor theme support.

The Qt chrome is still used by default. To use the AppKit chrome, set
the ENABLE_QT CMake option to OFF.
2023-08-22 21:36:19 -04:00
Andreas Kling 788c2c5a8d LibWeb: Stop using fallible JSON API in code generators 2023-08-22 13:08:24 +02:00
Andreas Kling 20ea82bacc LibWeb: Make (snake/title/camel) casification functions infallible 2023-08-22 13:08:24 +02:00
Andreas Kling 0b83717ea2 AK: Make SourceGenerator::fork() infallible 2023-08-22 13:08:24 +02:00
Andreas Kling 244516142a AK: Remove fallible SourceGenerator::try_append()
And fall back to the infallible append().
2023-08-22 13:08:24 +02:00
Andreas Kling a1d694ccdc AK: Remove fallible SourceGenerator::try_appendln()
And fall back to the infallible appendln().
2023-08-22 13:08:24 +02:00
Andreas Kling 8b936b5912 AK: Make SourceGenerator::set() infallible 2023-08-22 13:08:24 +02:00
Andreas Kling 3d5728ef57 LibWeb/BindingsGenerator: Remove some TRY() spam in generated bindings 2023-08-22 13:08:24 +02:00
Sam Atkins 5b125811f1 LibWeb: Add support for pseudo-class functions that take an ident param
This is prep work for `:dir()`, though other pseudo-classes may well use
it in the future too.
2023-08-21 13:51:56 +02:00
Ali Mohammad Pur 3c176bafee LibWasm: Implement a few SIMD instructions 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur 5f013e5374 Meta: Generate bigint values for v128 constants in Wasm tests 2023-08-21 13:39:32 +03:30
Ali Mohammad Pur 2462064fcd LibWasm+LibWeb: Parse and validate all Wasm SIMD instructions 2023-08-21 13:39:32 +03:30
Sam Atkins 0d021a63c7 LibUnicode: Generate data for bidirectional character types
This will let us examine code points to determine the rtl/ltr direction
of a piece of text.
2023-08-20 16:21:35 -04:00
Shannon Booth daefe744ba LibWeb: Implement RadioNodeList
This interface is used in the interface for HTMLFormControlsCollection
as a live view over its matching elements.

Currently the "value" attribute for this interface is left
unimplemented.
2023-08-20 11:04:03 +02:00
Andrew Kaster 041d5bff91 Meta: Port changes to gn build
This commit includes gn changes for the following commits:
625aac2367
8451c4d91c
8fcf42f684
9ba4c33940
1d6c2cb287
8e5b2907f6
d68433653a
2023-08-19 21:05:06 -06:00
Andrew Kaster 863fad0e32 Meta: Add ccache compiler launcher to gn build 2023-08-19 21:05:06 -06:00
Andrew Kaster 0acd87954b Meta: Add Serenity Kernel to gn build 2023-08-19 21:05:06 -06:00
Andrew Kaster f4e37c8ad4 Meta: Add serenity toolchain to gn build 2023-08-19 21:05:06 -06:00
Andrew Kaster f8e1544f41 StateMachineGenerator: Pass output file as an argument
This allows us to avoid shell redirection to create output files, and
will help with the GN build.
2023-08-19 21:05:06 -06:00
Andrew Kaster 871485cc0d Meta: Port fe672989a9 to gn build 2023-08-19 21:05:06 -06:00
Sebastian Zaha a0fb1478bf Meta: Add options for lldb and gdb output to gn
This makes it possible to specify (instead of is_debug) a more
specialized is_debug_lldb or is_debug_gdb, so that clang outputs the
proper symbols. (For lldb this fixes issues with formatting by
setting -fstandalone-debug)
2023-08-19 20:09:26 -06:00
Sebastian Zaha 1b395a3df9 Meta: Port GCC compile option from cmake to gn
The clang build is very noisy without
-Wno-implicit-const-int-float-conversion
2023-08-19 20:09:26 -06:00
Sebastian Zaha b4df4d66dc Meta: Port recent build changes to gn build
This ports the following commits:

f76c614a84
ddbe6bd7b4
2eaa528a0e
1b40bf9783
9f6ceff7cf
52d6df5ee5
9e22f01eba
bf4e2f3e9c
da2cd73bcf
2023-08-19 20:09:26 -06:00
Andrew Kaster 99499a6fae Ladybird+Meta: Add ctest to run WPT in the Integration configuration
By running ctest -C Integration -R WPT, you can run WPT. Adding just
-C Integration will run all other tests *and* the WPT test.

Also add support for ./Meta/serenity.sh test lagom WPT to serenity.sh
2023-08-19 23:50:29 +02:00
Andrew Kaster 8e605fb0f9 Meta+LibWeb: Make WPT run script runnable anywhere, remove apt installs
We should be documenting required pacakges elsewhere and installing them
in the setup step of CI.

This also fixes a problem where the run script would fail if you already
had a cloned wpt directory.
2023-08-19 23:50:29 +02:00
Sam Atkins 2038cb3c81 LibWeb: Make CSS math function parsing infallible 2023-08-19 17:34:22 +02:00
Sam Atkins 28c2836c24 LibWeb: Make external StyleValue-parsing methods infallible 2023-08-19 17:34:22 +02:00
Daniel Bertalan 075ce53d14 AK: Fix Clang 18 -Wdeprecated-literal-operator warning
The proper syntax for defining user-defined literals does not require a
space between the `operator""` token and the operator name:

> error: identifier 'sv' preceded by whitespace in a literal operator
>        declaration is deprecated
2023-08-19 11:07:12 +02:00
kleines Filmröllchen 096cecb95e Everywhere: Add RISC-V 64 target to the build system
This is a minimal set of changes to allow `serenity.sh build riscv64` to
successfully generate the build environment and start building. This
includes some, but not all, assembly stubs that will be needed later on;
they are currently empty.
2023-08-18 08:37:43 -06:00
Daniel Bertalan 182bb97479 CMake: Always build LibC with -ftls-model=initial-exec
LibC is always guaranteed to be loaded at program start, so its
thread-local variables live in the static TLS block. This permits us to
use the more optimal initial-exec TLS access model.
2023-08-18 16:20:13 +02:00
Cameron Youell 8fcf42f684 LibPublicSuffix: Add Library and Generators 2023-08-17 15:30:23 +01:00
Nicolas Ramz 0986533c11 Meta+Tests: Add a fuzzer and a test for the ILBM decoder 2023-08-15 18:36:11 +01:00
Nicolas Ramz fda5590313 LibGfx/ILBM: Add an IFF-ILBM decoder :)
IFF was a generic container fileformat that was popular on the Amiga
since it was the only file format supported by Deluxe Paint.

ILBM is an image format popular in the late eighties/nineties
that uses the IFF container.

This is a very first version of the decoder that only supports
(byterun) compressed files with bpp <= 8.

Only the minimal chunks are decoded: CMAP, BODY, BMHD.

I am planning to add support for the following variants:

- EHB (32 colours + lighter 32 colours)
- HAM6 / HAM8 (special mode that allowed to display the whole Amiga
4096 colours / 262 144 colours palette)
- TrueColor (24bit)

Things that could be fun to do:

- Still images could be animated using color cycle information
2023-08-15 18:36:11 +01:00
Bastiaan van der Plaat eafdb06d87 LibWeb: Add directory entries page when visiting a local directory 2023-08-15 10:41:54 +01:00
Andreas Kling 58e482a06d LibGUI: Remove Layout::try_add_spacer()
And fall back to the infallible add_spacer().

Work towards #20557.
2023-08-14 14:57:54 +02:00
Andrew Kaster ea0e07ec8f Meta: Include RPATH rules at top level to share them with Ladybird
When using Ladybird/ as CMake source directory, the RPATH rules were
left at the default, which is almost never correct.
2023-08-13 23:31:00 -06:00
Andreas Kling 72c9f56c66 LibJS: Make Heap::allocate<T>() infallible
Stop worrying about tiny OOMs. Work towards #20449.

While going through these, I also changed the function signature in many
places where returning ThrowCompletionOr<T> is no longer necessary.
2023-08-13 15:38:42 +02:00
Daniel Bertalan 1e737e763e CI: Force UBSan errors to be fatal for Serenity tests
The test runner script sets the `halt_on_error=1` `UBSAN_OPTIONS` flag
already, this just makes it a compile-time decision. This should
alleviate some of the slowness of running on-target tests without
hardware acceleration.
2023-08-13 05:14:07 +02:00
Daniel Bertalan 44365074fe CMake: Add UNDEFINED_BEHAVIOR_IS_FATAL configure option
This is mainly intended for use on CI, as UBSan instrumentation results
in a serious load and execution time penalty there. See the previous
commit for more details.

With this enabled, the size of LibWeb, built for x86-64 with Clang 17 as
of 0b91d36a is reduced as follows:

      FILE SIZE        VM SIZE
   --------------  --------------
     +18% +2.99Mi  [ = ]       0    .debug_info
     +14%  +758Ki  [ = ]       0    .debug_addr
    +2.6% +7.92Ki  [ = ]       0    .debug_abbrev
    +129% +2.66Ki  [ = ]       0    [Unmapped]
    -0.2%    -208  -0.2%    -208    .plt
    -0.2%    -312  -0.2%    -312    .rela.plt
    -0.1%    -336  -0.1%    -336    .dynsym
    -0.0%    -647  -0.0%    -513    [8 Others]
    -0.1% -1.14Ki  -0.1% -1.14Ki    .dynstr
   -20.1% -53.5Ki -20.1% -53.5Ki    .eh_frame_hdr
    -7.2% -56.8Ki  [ = ]       0    .debug_str_offsets
    -7.1%  -156Ki  [ = ]       0    .debug_str
   -15.0%  -160Ki  [ = ]       0    .symtab
   -63.6%  -245Ki -63.6%  -245Ki    .relr.dyn
   -25.4%  -357Ki -25.4%  -357Ki    .eh_frame
   -27.7% -1.09Mi  [ = ]       0    .strtab
   -59.3% -10.0Mi  [ = ]       0    .debug_rnglists
   -41.3% -11.0Mi  [ = ]       0    .debug_line
   -70.0% -12.0Mi -70.0% -12.0Mi    .rodata
   -65.2% -15.1Mi -65.2% -15.1Mi    .data
   -53.0% -15.7Mi -53.0% -15.7Mi    .text
   -41.7% -62.1Mi -57.7% -43.4Mi    TOTAL
2023-08-13 05:14:07 +02:00
Andrew Kaster a0a1411ec9 CMake: Set CMAKE_RUNTIME_OUTPUT_DIRECTORY based on CMAKE_INSTALL_BINDIR
Instead of hardcoding bin/, we should use the INSTALL_BINDIR directly
to reflect the intent of the way we're doing the settings.

This should have the benefit of fixing the build when a distro sets the
GNUInstallDirs variables to exciting values, like on NixOS.
2023-08-12 18:21:38 -06:00
kleines Filmröllchen aa741a1544 GMLCompiler: Allow using GML in any kind of Userland program
This is accomplished by detecting the Userland subdirectory from the GML
file's own path. Thereby, any Userland program, e.g. applet,
application, or even service, can use GML and the include paths of the
generated files will be correct.
2023-08-12 12:29:19 -06:00
kleines Filmröllchen 285119bc1a GMLCompiler: Force main class name to be resolved from global namespace
Calculator would otherwise trip over this, since there's a class with
the same name within the namespace.
2023-08-12 12:29:19 -06:00
kleines Filmröllchen 842a5adfdc GMLCompiler: Add a variety of special cases
Headers, enum properties, and associated default includes.
2023-08-12 12:29:19 -06:00
kleines Filmröllchen a24d9f5e22 GMLCompiler: Handle bitmap properties 2023-08-12 12:29:19 -06:00
kleines Filmröllchen 04a4f6a2e8 GMLCompiler: Allow generating enum constants from strings
As with other special cases, this depends on the property name.

The UIDimension code is kept separate since it can handle both integers
and strings, and the string names for special dimensions don't match
with the enum names.
2023-08-12 12:29:19 -06:00
kleines Filmröllchen cc6b9d5873 GMLCompiler: Escape compiled strings
We don't want a newline to cause havoc.
2023-08-12 12:29:19 -06:00
kleines Filmröllchen 33bd078052 GMLCompiler: Handle spacer pseudo-objects 2023-08-12 12:29:19 -06:00
kleines Filmröllchen 625aac2367 LibAudio: Add a FLAC encoder
This encoder can handle all integer formats and sample rates, though
only two channels well. It uses fixed LPC and performs a
close-to-optimal parameter search on the LPC order and residual Rice
parameter, leading to decent compression already.
2023-08-12 12:25:26 -06:00
Valtteri Koskivuori 077a8058c3 LibIMAP+Mail: Implement RFC2047 message header encoding
This enables us to display email subject fields with non-ASCII
characters in Mail :^)
2023-08-12 11:45:52 -06:00
Valtteri Koskivuori 8451c4d91c LibIMAP: Add useful dbgln_if() printouts to IMAP::Parser
I couldn't run the parser in a debugger like I normally would, so I
added printouts to understand where the parser is failing.
More could be added, but these are enough to get a good idea of what
the parser is doing. It's very spammy, though, so enable it by flicking
the IMAP_PARSER_DEBUG switch :^)
2023-08-12 11:45:52 -06:00
Daniel Bertalan 11896868d6 CMake: Clean up AArch64 compiler flags
Two non-functional changes:
- Remove pointless `-latomic` flag. It was specified via
  `add_compile_options`, which only affects compilation and not linking,
  so the library was never actually linked into the kernel. In fact, we
  do not even build `libatomic` for our toolchain.
- Do not disable `-Wnonnull`. The warning-causing code was fixed at some
  point.

This commit also removes `-mstrict-align` from the userland. Our target
AArch64 hardware natively supports unaligned accesses without a
significant performance penalty. Allowing the compiler to insert
unaligned accesses into aligned-as-written code allows for some
performance optimizations in fact. We keep this option turned on in the
kernel to preserve correctness for MMIO, as that might be sensitive to
alignment.
2023-08-12 19:39:00 +02:00
kleines Filmröllchen e304ba492f Meta: Fix ENABLE_LAGOM_LIBWEB CMake configuration 2023-08-12 11:29:43 -06:00
Sam Atkins b684bab5f1 LibWeb: Make :host() take a <compound-selector>
This matches the spec:
https://drafts.csswg.org/css-scoping-1/#selectordef-host
2023-08-12 16:26:32 +02:00
Sam Atkins f76c614a84 LibWeb: Generate PseudoClass metadata
The usual to/from-string functions, and metadata about whether the
pseudo-class is a a function or not, and what type of parameter it
takes.
2023-08-12 16:26:32 +02:00
Jonah 0b2da4f8c6 LibWeb: Add the default user agent MathML stylesheet
We now apply MathML's default user agent style sheet along with other
default styles. This sheet is not mixed in with the other styles in
CSS/Default.css because it is a namespaced stylesheet and so has to
be its own sheet.
2023-08-12 07:59:23 +01:00
Jonah cce50b1841 LibWeb: Add MathML Namespace to IDL Generator
This will make the codegen produce code for MathML IDL that doesn't
fail to compile in confusing ways.
2023-08-12 07:59:23 +01:00
Aliaksandr Kalenik 0abe2a5023 Meta: Remove usage of bytecode_interpreter_if_exists() in js_repl
There is no need to check if bytecode interpreter exists after we
switched away from AST interpreter.
2023-08-12 08:46:35 +02:00
Daniel Bertalan c0cf6e3744 CMake: Set -fvisibility-inlines-hidden on ELF platforms
The C++ semantics of `inline` dictate that such functions might be
defined in multiple translation units. As with all other functions, they
must have the same address in all TUs. Because of this, the compiler
emits `inline` functions as weak symbols, which the dynamic linker can
then resolve to the same address everywhere.

This rule is responsible for a significant overhead at startup, as such
lookups happen by name. Namely, 86'000 of the 114'000 by-name symbol
lookups when loading LibWeb can be attributed to this. Most of these
are only ever defined in a single object, making this even more
pointless.

As nothing in our code relies on either ELF symbol interposition rules
or function address equality, we can use the -fvisibility-inlines-hidden
escape hatch, which causes this rule to be disregarded. As the symbols
are now hidden, no load-time symbol lookup is needed. This flag is used
without issues in other large C++ codebases like Chromium and LLVM.

Some relevant light reading, suggested by Nico:
- https://ridiculousfish.com/blog/posts/i-didnt-order-that-so-why-is-it-on-my-bill-episode-1.html
- https://www.cs.dartmouth.edu/~sergey/cs258/ABI/UlrichDrepper-How-To-Write-Shared-Libraries.pdf
- https://blog.llvm.org/2018/11/30-faster-windows-builds-with-clang-cl_14.html
- https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-fvisibility-inlines-hidden
2023-08-12 05:14:20 +02:00
kleines Filmröllchen d1645efde9 Meta+Userland: Allow generating C++ initializer code from GML
This does the exact same thing as the runtime initializer,
except it is faster and can catch some errors much earlier.

The code generator includes these important features:
- Automatic include generation where necessary
- Special-casing for TabWidget and ScrollableContainerWidget
- No use of DeprecatedString where possible
2023-08-11 21:33:48 +02:00
kleines Filmröllchen 1e67435ff5 Meta: Rename compile_gml to stringify_gml
This is what this function really does, it doesn't compile anything.
2023-08-11 21:33:48 +02:00
Andrew Kaster 941a9846a3 Meta: Assume files already extracted for ENABLE_NETWORK_DOWNLOADS=OFF
This allows external meta build systems to extract a cached archive into
our Cache directory without having to also copy the .tar.gz file.
2023-08-10 20:10:05 -06:00
Andrew Kaster 68953f798b CMake: Add option to disable network downloads altogether
This is useful for fully offline builds, and some distribution platforms
2023-08-10 20:10:05 -06:00
Andrew Kaster b046940679 CMake: Download Commonmark and Wasm spec tests using download_file()
This makes sure we have no bare file(DOWNLOAD) calls in the build
2023-08-10 20:10:05 -06:00
Andrew Kaster 92214b59ab CMake: Make sure to install generated sources and header files
We weren't installing a lot of generated sources for the top level Lagom
build or for LibWeb, making it impossible to use LibWeb from a
find_package. ...And also Kernel/API/KeyCode.h, which is included by
no less than 8 different files in Userland/Libraries. We also weren't
installing any Ladybird header files.
2023-08-10 20:10:05 -06:00
Andrew Kaster 1d78e07f6b Meta: Promote SERENITY_CACHE_DIR to a real option
We've had it as a secret option for long enough, let's make it more
visible.
2023-08-10 20:10:05 -06:00
Andreas Kling 97ebfd9f0f LibJS: Make Value::to_string_without_side_effects() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling 1a27c525d5 LibJS: Make PrimitiveString::create() infallible
Work towards #20449.
2023-08-09 17:09:16 +02:00
Andreas Kling 2eaa528a0e LibJS: Rip out the AST interpreter :^)
This has been superseded by the bytecode VM, which is both faster
and more capable.
2023-08-08 13:07:13 +02:00
Andreas Kling 3bb06cc719 Fuzzers: Use the LibJS bytecode VM 2023-08-08 13:07:13 +02:00
Andreas Kling 196e04d1c7 CI: Stop running test-js with the AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling 18c54d8d40 LibJS: Make Cell::initialize() return void
Stop worrying about tiny OOMs.

Work towards #20405
2023-08-08 07:39:11 +02:00
Lucas CHOLLET 3f35ffb648 Userland: Prefer _string over _short_string
As `_string` can't fail anymore (since 3434412), there are no real
benefits to use the short variant in most cases.
2023-08-08 07:37:21 +02:00
Andrew Kaster 391beef707 Ladybird: Move Qt-specific classes and functions to a Qt subdirectory
This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.

As a bonus, remove Qt dependency from WebDriver.
2023-08-07 14:58:04 -06:00
Liav A ccaa423372 Utilities: Add basic Package manager skeleton utility 2023-08-07 13:24:25 -06:00