1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 03:30:46 +00:00
Commit Graph

61982 Commits

Author SHA1 Message Date
Dan Klishch
c03cca7b2f AK+LibTest: Choose definition of CO_TRY and CO_TRY_OR_FAIL more robustly
There are three compiler bugs that influence this decision:

 - Clang writing to (validly) destroyed coroutine frame with -O0 and
   -fsanitize=null,address under some conditions
   (https://godbolt.org/z/17Efq5Ma5) (AK_COROUTINE_DESTRUCTION_BROKEN);

 - GCC being unable to handle statement expressions in coroutines
   (AK_COROUTINE_STATEMENT_EXPRS_BROKEN);

 - GCC being unable to deduce template type parameter for TryAwaiter
   with nested CO_TRYs (AK_COROUTINE_TYPE_DEDUCTION_BROKEN).

Instead of growing an ifdef soup in AK/Coroutine.h and
LibTest/AsyncTestCase.h, define three macros in AK/Platform.h that
correspond to these bugs and use them accordingly in the said files.
2024-06-29 20:15:05 -06:00
Liav A.
6fc3908818 Utilities/init: Add "drop to emergency shell" functionality
In case the user requests this, init can drop directly to a shell
without trying to spawn SystemServer.

To test this on x86-64, run:
```
Meta/serenity.sh run x86_64 GNU "init_args=emergency"
```

Also, init will drop to emergency shell if mounting filesystems with
`mount -a` failed for some reason.

This functionality can be useful in many cases.
For example, if the user needs to perform a command that must not alter
a corrupted filesystem state, then this mode is useful as the filesystem
should be mounted in read-only mode.
Another example is the ability to get a functioning system in case
SystemServer behaves badly or inconsistently, or the user specified a
wrong fstab entry, so proceeding to boot is probably a bad option.
2024-06-30 00:20:45 +02:00
Liav A.
1e73a584a7 Userland: Move basic system init functionality out of SystemServer
Let's make SystemServer simpler by not involving it with the basic
system initialization sequence.
That initialization sequence can be done in another program that
theoretically can be put in another filesystem.

Co-authored-by: Tim Schumacher <timschumi@gmx.de>
2024-06-30 00:20:45 +02:00
Thomas Voss
96efa81dc6 Utilities/wc: Seek the input file(s) if only -c is passed
If the user only wants to get the byte count of a set of files, then for
each file we can simply seek it to get the byte count instead of
iterating over all the bytes.
2024-06-30 00:17:46 +02:00
Liav A.
bd474dab14 Prekernel: Move the generate_secure_seed function out of init.cpp
As part of a commit series trying to make the prekernel nicer, we should
move and refactor functions out of the init.cpp file if possible.
2024-06-29 19:56:45 +02:00
Liav A.
f6e01aae9a Prekernel: Add support for assertion printing
This is done by using a FixedStringBuffer as the foundation to perform
string formatting, which ensures that we avoid memory allocations in
the prekernel stage.
2024-06-29 19:56:45 +02:00
Liav A.
00c9a57345 Prekernel: Add stub methods to handle memory allocations
These methods do basically nothing right now, because we don't allocate
memory in the prekernel stage.
It's only here for a later commit when we bring up assertion formatting
and printing.
2024-06-29 19:56:45 +02:00
Liav A.
f003c37596 Kernel/Library: Move mini-stdlib functions into their own header file
This will be useful when integrating them later on in the prekernel
stage.
2024-06-29 19:56:45 +02:00
implicitfield
1bf7f99a7b Kernel/Ext2FS: Support writing holes
With this change, we no longer preallocate blocks when an inode's size
is updated, and instead only allocate the minimum amount of blocks when
the inode is actually written to.
2024-06-29 19:16:08 +02:00
implicitfield
180f3f29ab Kernel/Ext2FS: Refactor computing and flushing blocks
This is a large commit, since this is essentially a complete rewrite of
the key low-level functions that handle reading/writing blocks. This is,
however, a necessary prerequisite of being able to write holes.

The previous version of `flush_block_list()` (along with its numerous
helper functions) was entirely reliant on all blocks being sequential.
In contrast to the previous implementation, the new version
of `flush_block_list()` simply writes out the difference between the old
block list and the new block list by calculating the correct indirect
block(s) to update based on the relevant block's logical index.

`compute_block_list()` has also been rewritten, since the estimated
amount of meta blocks was incorrectly calculated for files with holes as
a result of the estimated amount of blocks being a function of the file
size. Since it isn't possible to accurately compute the shape of the
block list without traversing it, we no longer try to perform such a
computation, and instead simply search through all of the allocated
indirect blocks.

`compute_block_list_with_meta_blocks()` has also been removed in favor
of the new `compute_meta_blocks()`, since meta blocks are fundamentally
distinct from data blocks due to there being no mapping between any
logical block index and the physical block index.
2024-06-29 19:16:08 +02:00
implicitfield
176999e20c AK/Span: Add a method to check if a Span is filled with a value 2024-06-29 19:16:08 +02:00
implicitfield
06d4672564 Kernel/Ext2FS: Store the block list as a HashMap rather than a Vector
Since we now only store blocks that are actually allocated, it is
entirely valid for the block list to be empty, so this commit lifts the
restrictions on accessing inodes with an empty block list.
2024-06-29 19:16:08 +02:00
implicitfield
ba96a0e4f8 Kernel/Ext2FS: Simplify read/write loops
This removes removes the need to know the last block in advance, and
makes the loops slightly easier to reason about by depending on fewer
conditions.
2024-06-29 19:16:08 +02:00
kleines Filmröllchen
7337ad43b5 crash: Add RISC-V implementations for all architecture-specific tests
Co-authored-by: Sönke Holz <sholz8530@gmail.com>
2024-06-29 17:36:49 +02:00
kleines Filmröllchen
e11f84f86d crash: Make everything more architecture-independent
- Document exactly which crash features are available on which
  architectures. There's several interesting crash tests we will want to
  add for specific architectures, such as misaligned memory accesses.
- Don't compile the divide by zero crash test on RISC-V, as they simply
  don't crash here.
- Rename the test for "x86 User Mode Instruction Prevention" to a more
  generic "try to execute a priviledged instruction"; whatever that
  specifically entails on any given architecture.
- Rename a bunch of internal variables to more generic names.
- Wrap the x86-specific implementation of "execute non executable
  memory" in architecture preprocessor checks.
2024-06-29 17:36:49 +02:00
Nico Weber
311af9ad05 Toolchain: Use check_sha256() in BuildQemu.sh 2024-06-29 13:56:36 +02:00
Nico Weber
c1c00f9104 Meta+Toolchain: Move check_sha256 to shell_include.sh
Pure code move, no behavior change.
2024-06-29 13:56:36 +02:00
Nico Weber
046dbe27c4 Toolchain: Rename check_sha() to check_sha256()
No behavior change, just a more descriptive name.
2024-06-29 13:56:36 +02:00
Andreas Kling
225108c830 LibWeb: Set the correct prototype for SVGAElement instances
(cherry picked from commit 4db05ecf69bee07a060f2e4513e9d53b6110dcc4)
2024-06-28 23:43:59 +02:00
Andreas Kling
bdf3071bd9 Tests/LibWeb: Add test that dumps all global JS constructors
(cherry picked from commit a84261ee7a5e0b76a03225d71ec64424d4865a78)
2024-06-28 23:43:59 +02:00
Luke Warlow
cf5b1b7c10 LibWeb: Implement unsafe HTML parsing methods
Both Element's and ShadowRoot's setHTMLUnsafe, and Document's static
parseHTMLUnsafe methods are implemented.

(cherry picked from commit ce8d3d17c4f2fcca8fac0ff4a832c8f50a011fc7)
2024-06-28 10:56:27 +02:00
Edwin Hoksberg
e2bf7d1a36 LibWeb: Add attribute list that must always be compared without casing
(cherry picked from commit 2b30414c1d8641eaf4212db69e40a4381005314c)
2024-06-28 10:56:14 +02:00
Luke Warlow
27ffaad882 LibWeb: Implement dialog element's close watcher
Dialog elements now correctly establish a close watcher when
shown modally.

This means modal dialogs now correctly close with an escape key press.

(cherry picked from commit d86a6e1bec858a35935ba6839c154ba2482d33e6)
2024-06-28 10:32:12 +02:00
Luke Warlow
47bc8ecb0e LibWeb: Prevent select.click() opening the dropdown
No other browser allows opening the select element dropdown with the
select.click() function.
This change stops this happening in Ladybird.

(cherry picked from commit 564e546ff0bd78cc7ba770b53377457bf1ef88d6)
2024-06-28 10:31:53 +02:00
Liav A.
972f7581e9 Utilities/nc: Add an option to test a TCP-listening service
Similarly to OpenBSD nc, an option to just connect without transmitting
any actual data is added.

However, we don't allow UDP-mode when testing a remote service, as it
will always succeed and has no technical meaning for the user if they're
not able to view the traffic on the remote machine.
2024-06-28 10:31:23 +02:00
Liav A.
dcf7296929 Utilities/nc: Don't use LibC gethostbyname function
Instead, let's use the nicer Core::Socket API and resolve the hostname
this way.
2024-06-28 10:31:23 +02:00
Luke Warlow
1df32b7e1a LibWeb: Add HTMLSelectElement showPicker()
Adds the showPicker() function for select elements.
This doesn't do the check for "being rendered" which is in the spec.

(cherry picked from commit 5098ed6b1f881659dbdab10c74a0e17b362ce7a8)
2024-06-28 00:56:17 +02:00
Luke Warlow
33c315bad0 LibWeb: Implement CloseWatcher API
This implements most of the CloseWatcher API from the html spec.

AbortSignal support is unimplemented.

Integration with dialogs and popovers is also unimplemented.

(cherry picked from commit b216046234560df531e1a32269e5dfa18f8f240c,
manually amended to replace a single `UIEvents::KeyCode::Key_Escape`
with `KeyCode::Key_Escape` in EventHandler.cpp since we don't have
the second commit of https://github.com/LadybirdBrowser/ladybird/pull/86)
2024-06-28 00:55:43 +02:00
Luke Warlow
1739111d17 LibWeb: Refactor DOM parsing APIs
Multiple APIs have moved from the DOM Parsing and Serialization spec to
HTML.

Updates spec URLs and comments.

Delete InnerHTML file:
- Make parse_fragment a member of Element, matching serialize_fragment
on Node.
- Move inner_html_setter inline into Element and ShadowRoot as per the
spec.

Add FIXME to Range.idl for Trusted Types createContextualFragment

(cherry picked from commit 9171c3518358cd2d146ffbd7582e4c1247a1daa7)
2024-06-28 00:55:22 +02:00
Jamie Mansfield
d586afbf73 LibWeb: Don't set hashChange for classic history navigate events
See:
- https://github.com/whatwg/html/pull/10393

(cherry picked from commit 4c5fa102a381c3687e677f9b6b13752c2bcea867)
2024-06-28 00:55:02 +02:00
Nico Weber
43bef4b401 Ladybird/AppKit: Send mouse event on middle click 2024-06-27 17:49:07 -04:00
Nico Weber
8859bd3b78 Ladybird/AppKit: Send correct mouse event on right click 2024-06-27 17:47:43 -04:00
Tim Ledbetter
850859f645 LibWeb: Disallow pasting into non-editable text nodes
(cherry picked from commit 8969f2e34af196e935c57257ef7eec8f00b45d33)
2024-06-27 22:54:03 +02:00
Tim Ledbetter
b62c572154 LibWeb: Fire auxclick event on middle click
Previously, no event was fired on middle click. This change also allows
the UI to open a link in a new tab on middle click.

(cherry picked from commit 31d7fa244232c2a2239dbf6017ba9e3dd191ec2e)
2024-06-27 22:53:15 +02:00
Tim Ledbetter
2554d766bc LibWeb: Add Internals.middleClick
This simulates click of the middle mouse button, which is necessary for
testing whether the `auxevent` fires correctly.

(cherry picked from commit 728fca1b1ffd8b472bc8524e5e8ec8443de011a5)
2024-06-27 22:53:15 +02:00
Aliaksandr Kalenik
030ea71dff LibWeb: Use button layout for input elements with button type
(cherry picked from commit b2dcdf009605d50503592789ac14a8406b0d3983)
2024-06-27 19:02:45 +02:00
Aliaksandr Kalenik
c6e3c0a339 LibWeb: Create BlockContainer layout node for <input type="button">
...and shadow tree with TextNode for "value" attribute is created.
This means InlineFormattingContext is used, and button's text now
respects CSS text-decoration properties and unicode-ranges.

(cherry picked from commit 8feaecd5c8d02a2fdb989a9a9671e008d1c3a7de)
2024-06-27 19:02:45 +02:00
Ali Mohammad Pur
7b47c57c54 LibWeb/CSS: Avoid capturing structured binding in generic lambda
Apple Clang doesn't like this, rather than waiting for their version of
random-clang-commit-to-call-a-release to catch up with llvm trunk, just
work around the issue.

Fixes #186.

(cherry picked from commit 8c9d3b30cf62016ffb03e425f1e7e3f2461262bf)
2024-06-27 19:02:24 +02:00
Nico Weber
aef023a7f6 Meta: Port recent changes to the GN build
4033776fb5
2024-06-27 19:02:10 +02:00
Luke Warlow
d29cef8d5f LibWebView: Allow data URLs in sanitize_url
Allow navigation to data URLs from browser UI.

(cherry picked from commit 6014727c20ad108e8345e89cba8e9eace3c157b3)
2024-06-27 17:14:22 +02:00
Shannon Booth
4033776fb5 LibWeb: Add stub for ValidityState
This fixes https://html5test.com/ as previously an exception was being
thrown after trying to access this attribute which would then result in
a popup about the test failing (and none of the test results being
shown).

(cherry picked from commit e0bbbc729b6aad04ceff5f67c3e2868b65970047,
manually amended with the output of `git clang-format master`)
2024-06-27 17:13:16 +02:00
Hexeption
c0fdc7d2dd LibWeb: Added HTMLLinkElement.as Tests
(cherry picked from commit 7ac6fd274696fe3e66971bb3b82141466879f82b)
2024-06-27 14:49:29 +02:00
Hexeption
928576e0ac LibWeb: Added HTMLLinkElement.as
(cherry picked from commit 2f4668edce2effb38563b9da229d00d3ba5dc508,
manually amended to move `||` at the start of the line to appease
clang-format)
2024-06-27 14:49:29 +02:00
Matthew Olsson
5e4e39d84a LibWeb: Remove TimingFunction in favor of EasingStyleValue::Function
Now that EasingStyleValue is a lot nicer to use, there isn't much reason
to keep TimingFunction around.

(cherry picked from commit 7950992fc21e2428a7f32954bbe893a2b2d58cf7,
manually amended with the output of `git clang-format master`)
2024-06-27 14:49:14 +02:00
Matthew Olsson
6c0859d412 Meta: Remove GenerateCSSEasingFunctions
(cherry picked from commit ac35f76e67f9a393ed5a2e5c8b7e7f56809a2a56)
2024-06-27 14:49:14 +02:00
Matthew Olsson
e301c1d038 LibWeb: Parse easing values manually
The values aren't that complex, so it doesn't make much sense to have a
dedicated generator for them. Parsing them manually also allows us to
have much more control over the produced values, so as a result of this
change, EasingStyleValue becomes much more ergonomic.

(cherry picked from commit 667e313731f06fabf2a3f75893c3e8f15a4172be,
manually amended with the output of `git clang-format master`)
2024-06-27 14:49:14 +02:00
Nico Weber
4bf4905131 Meta: Port recent changes to the GN build
f72805398b
2024-06-27 14:42:29 +02:00
Tim Ledbetter
2519dadbb3 LibURL: Convert ASCII only URLs to lowercase during parsing
This fixes an issue where entering EXAMPLE.COM into the URL bar in the
browser would fail to load as expected.

(cherry picked from commit 1a4b042664f8fddbfa70f009c5873b1f8575bf0b)
2024-06-27 14:00:51 +02:00
Tim Ledbetter
1bf09a74b7 Meta: Ensure LibURL tests are built
(cherry picked from commit fd98076aca7a75a620672a7a1632b46a62641927,
manually resolved a conflict)
2024-06-27 14:00:51 +02:00
Tim Ledbetter
7561a48ec6 LibWebView: Don't query public suffix list when sanitizing URLs
Previously, part of the procedure we used to sanitize URLs entered via
the command line would check the host against the public suffix
database. This led to some valid, but not publicly accessible URLs
being treated as invalid.

(cherry picked from commit e9f34c7bd1e72da9a57a721d4ad501e8208cc986)
2024-06-27 14:00:51 +02:00