Commit graph

52500 commits

Author SHA1 Message Date
Kenneth Myhra
18aa588968 LibWeb: Add AO transform_stream_default_sink_write_algorithm() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
11c0600729 LibWeb: Add AO transform_stream_default_controller_perform_transform() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
4d4fc53f5c LibWeb: Implement TransformStreamDefaultController::terminate() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
e1740938fc LibWeb: Add AO transform_stream_default_controller_terminate() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
4ae82983a4 LibWeb: Implement TransformStreamDefaultController::enqueue() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
e028918a64 LibWeb: Add AO transform_stream_default_controller_enqueue() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
d2236e5ca5 LibWeb: Add AO readable_stream_default_controller_has_backpressure() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
2d0a2756b4 LibWeb: Implement TransformStreamDefaultController::error() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
9efcc01387 LibWeb: Add AO transform_stream_default_controller_error() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
69fb6f15f9 LibWeb: Add AO transform_stream_error() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
ad73c03ea3 LibWeb: Add AO transform_stream_error_writable_and_unblock_write() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
91f58eb220 LibWeb: Add AO transform_stream_set_backpressure() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
d8d0e8a6ea LibWeb: Add AO transform_stream_default_controller_clear_algorithms() 2023-07-15 11:59:39 +02:00
Kenneth Myhra
0091a60448 LibWeb: Add TransformStreamDefaultController scaffolding
This adds the scaffolding of TransformStreamDefaultController so we can
start implementing the necessary abstract operations for it.
2023-07-15 11:59:39 +02:00
Kenneth Myhra
f1d69d789b LibWeb: Add TransformStream scaffolding
This adds the scaffolding of TransformStream so we can start
implementing the necessary abstract operations for it.
2023-07-15 11:59:39 +02:00
Kenneth Myhra
90fdd598c2 LibWeb: Make sure we do not generate duplicate variable names 2023-07-15 11:59:39 +02:00
Kenneth Myhra
12ff48047f LibWeb: Add Transformer API
This adds the Transformer API which the TransformStream() constructor
accepts as its first argument.
2023-07-15 11:59:39 +02:00
Andreas Kling
3ec9fd0aae LibWeb: Resolve calc() values in CSS transform
There are two parts to this fix:

- First, StyleProperties::transformations() would previously omit calc()
  values entirely when returning the list of transformations. This was
  very confusing to StackingContext which then tried to index into the
  list based on faulty assumptions. Fix this by emitting calc values.

- Second, StackingContext::get_transformation_matrix() now always calls
  resolve() on length-percentages. This takes care of actually resolving
  calc() values. If no reference value for percentages is provided, we
  default to 0px.

This stops LibWeb from asserting on websites with calc() in transform
values, such as https://qt.io/ :^)
2023-07-15 11:35:16 +02:00
Daniel Bertalan
2a563b9de6 LibJS/Bytecode: Correctly rethrow exception in await expression
We were implicitly converting the throw completion's value into a normal
completion in `AsyncFunctionDriverWrapper::continue_async_execution`,
which meant the routine generated by `generate_await` didn't know that
the value had to be thrown when execution resumed.

Without this change, we mistakenly pass 13 tests for `Array.fromAsync`,
which we do not implement yet. But even with that "regression", we pass
17 more test262 tests in total.
2023-07-15 11:27:43 +02:00
Daniel Bertalan
cff8f56ce7 LibJS/Bytecode: Do not unwind eagerly after throwing Await
If an exception was thrown while evaluating the argument of an `await`
expression, we should jump to the continuation block instead of eagerly
rejecting the caller async function.

This restores the behavior prior to the addition of the separate `Await`
instruction in d66eb4e3.
2023-07-15 11:27:43 +02:00
Sam Atkins
8fc545992d LibWeb: Use generated math-function-parsing code 2023-07-15 10:23:33 +02:00
Sam Atkins
618c0402a7 LibWeb: Generate parsing code for CSS math functions 2023-07-15 10:23:33 +02:00
Sam Atkins
780998b3d5 LibWeb: Add CSSNumericType::matches_dimension()
This isn't a spec algorithm, but is useful when type-checking parameters
to math functions.
2023-07-15 10:23:33 +02:00
Sam Atkins
136dc7a1c3 LibWeb: Extract CalculationNode::constant_type_from_string() function
This is needed by some upcoming generated code. Renamed "PI" member to
"Pi" while I was at it.
2023-07-15 10:23:33 +02:00
Sam Atkins
e4a2bd7a44 LibWeb: Move RoundingMode to Enums.json
In the spec this is a `<rounding-strategy>`, so let's use that name.
This also fixes a bug where we were serializing `to-zero` as
`toward-zero`.
2023-07-15 10:23:33 +02:00
Andreas Kling
3194f10ad0 LibWeb: Explicitly instantiate a CSS parser template function
We're gonna call parse_a_comma_separated_list_of_component_values from
another cpp file soon, so let's prepare for that by instantiating the
specific version we need.
2023-07-15 10:23:33 +02:00
Shannon Booth
5625ca5cb9 AK: Rename URLParser::parse to URLParser::basic_parse
To make it more clear that this function implements
'concept-basic-url-parser' instead of 'concept-url-parser'.
2023-07-15 09:45:16 +02:00
Shannon Booth
6fecd8cc44 LibWeb: Add interface for 'concept-url-parser'
This does not implement extra functionality on top of the basic parser,
but allows multiple places in LibWeb to call the 'correct' interface for
when it is fully implemented.
2023-07-15 09:45:16 +02:00
Shannon Booth
7ef4689383 AK: Implement steps for state override in URL parser 2023-07-15 09:45:16 +02:00
Lucas CHOLLET
500097de82 LibGfx/GIF: Decode the header in create()
Again, header includes the logical screen descriptor here. This is done
as a part of #19893.
2023-07-15 09:44:30 +02:00
Lucas CHOLLET
294217586b LibGfx/GIF: Move the code to read the header to its own function
By header, I include the logical screen descriptor here, so all the
information that is not specific to each frame.
2023-07-15 09:44:30 +02:00
Lucas CHOLLET
b8bc84a3e8 LibGfx/GIF: Only use a FixedMemoryStream
This allows us to drop the data pointer in the `GIFLoadingContext`.
2023-07-15 09:44:30 +02:00
Lucas CHOLLET
1192e46c09 LibGfx/GIF: Don't read the header twice
This is already done in `load_gif_frame_descriptors()`. As the method
`initialize()` is now empty, we can delete it.
2023-07-15 09:44:30 +02:00
Lucas CHOLLET
e56809dda8 LibGfx: Register WebP as a supported image format
Basically, it means that we now render a thumbnail for WebP images.
2023-07-15 09:34:07 +02:00
Lucas CHOLLET
8ef5170bd5 LibGfx/WebP: Remove a typo
:redthakis:
2023-07-15 09:34:07 +02:00
Lucas CHOLLET
4adef05e6d LibGfx/WebP: Decode the first chunk in create()
And remove `initialize()`.

This is done as a part of #19893.
2023-07-15 09:34:07 +02:00
Xexxa
ed67acb16d Base: Add more emoji
👣 - U+1F463 FOOTPRINTS
👕 - U+1F455 T-SHIRT
👝 - U+1F45D CLUTCH BAG
👒 - U+1F452 WOMAN’S HAT
🎸 - U+1F3B8 GUITAR
2023-07-15 09:33:54 +02:00
Andreas Kling
2d6c1bbf88 LibWeb: Paint relatively positioned inline-level elements
Since we deliberately skip positioned elements in paint_descendants(),
we have to make sure we actually paint them in the subsequent
paint_internal() pass.

Before this change, we were only painting positioned elements whose
paintable was a PaintableBox, neglecting inline-level relpos elements.
2023-07-15 07:10:34 +02:00
Andreas Kling
268492413a LibWeb: Add Paintable::stacking_context_rooted_here()
This is a convenience helper that lets you get the stacking context
rooted at a given paintable, without checking that the paintable is a
box first.
2023-07-15 07:10:34 +02:00
Aliaksandr Kalenik
2138c164c9 LibWeb: Respect justify-items property of grid container 2023-07-15 05:50:51 +02:00
Aliaksandr Kalenik
f060f89220 LibWeb: Add support for justify-items property in CSS parser 2023-07-15 05:50:51 +02:00
Luke Wilde
e86d7cab06 LibJS: Don't crash on broken promises in AsyncGenerator#return
See: https://github.com/tc39/ecma262/pull/2683
2023-07-15 01:08:52 +02:00
Luke Wilde
d1cb78c411 LibJS/Bytecode: Implement async generators 2023-07-15 01:08:52 +02:00
Luke Wilde
d4e30710e7 LibJS: Enable bytecode default parameter values for async generators 2023-07-15 01:08:52 +02:00
Luke Wilde
3373626dd5 LibJS/Bytecode: Enable local variables for async generators
See 8b64508 and 71c54dd
2023-07-15 01:08:52 +02:00
Luke Wilde
53e527281f LibJS/Bytecode: Propagate FDI errors normally for async generators
Previously it returned a rejected promise, which is not correct:
https://tc39.es/ecma262/#sec-runtime-semantics-evaluateasyncgeneratorbody
```
1. Perform ? FunctionDeclarationInstantiation(functionObject,
   argumentsList).
```
2023-07-15 01:08:52 +02:00
Luke Wilde
265a9b5ffc LibJS/Bytecode: Add function to determine if we're in an async generator 2023-07-15 01:08:52 +02:00
Luke Wilde
c37ef5694b LibJS/Bytecode: Class async generators as async functions 2023-07-15 01:08:52 +02:00
Luke Wilde
d66eb4e3ba LibJS/Bytecode: Add Await and AsyncIteratorClose instructions 2023-07-15 01:08:52 +02:00
kleines Filmröllchen
b645f87b7a Kernel: Overhaul system shutdown procedure
For a long time, our shutdown procedure has basically been:
- Acquire big process lock.
- Switch framebuffer to Kernel debug console.
- Sync and lock all file systems so that disk caches are flushed and
  files are in a good state.
- Use firmware and architecture-specific functionality to perform
  hardware shutdown.

This naive and simple shutdown procedure has multiple issues:
- No processes are terminated properly, meaning they cannot perform more
  complex cleanup work. If they were in the middle of I/O, for instance,
  only the data that already reached the Kernel is written to disk, and
  data corruption due to unfinished writes can therefore still occur.
- No file systems are unmounted, meaning that any important unmount work
  will never happen. This is important for e.g. Ext2, which has
  facilites for detecting improper unmounts (see superblock's s_state
  variable) and therefore requires a proper unmount to be performed.
  This was also the starting point for this PR, since I wanted to
  introduce basic Ext2 file system checking and unmounting.
- No hardware is properly shut down beyond what the system firmware does
  on its own.
- Shutdown is performed within the write() call that asked the Kernel to
  change its power state. If the shutdown procedure takes longer (i.e.
  when it's done properly), this blocks the process causing the shutdown
  and prevents any potentially-useful interactions between Kernel and
  userland during shutdown.

In essence, current shutdown is a glorified system crash with minimal
file system cleanliness guarantees.

Therefore, this commit is the first step in improving our shutdown
procedure. The new shutdown flow is now as follows:
- From the write() call to the power state SysFS node, a new task is
  started, the Power State Switch Task. Its only purpose is to change
  the operating system's power state. This task takes over shutdown and
  reboot duties, although reboot is not modified in this commit.
- The Power State Switch Task assumes that userland has performed all
  shutdown duties it can perform on its own. In particular, it assumes
  that all kinds of clean process shutdown have been done, and remaining
  processes can be hard-killed without consequence. This is an important
  separation of concerns: While this commit does not modify userland, in
  the future SystemServer will be responsible for performing proper
  shutdown of user processes, including timeouts for stubborn processes
  etc.
- As mentioned above, the task hard-kills remaining user processes.
- The task hard-kills all Kernel processes except itself and the
  Finalizer Task. Since Kernel processes can delay their own shutdown
  indefinitely if they want to, they have plenty opportunity to perform
  proper shutdown if necessary. This may become a problem with
  non-cooperative Kernel tasks, but as seen two commits earlier, for now
  all tasks will cooperate within a few seconds.
- The task waits for the Finalizer Task to clean up all processes.
- The task hard-kills and finalizes the Finalizer Task itself, meaning
  that it now is the only remaining process in the system.
- The task syncs and locks all file systems, and then unmounts them. Due
  to an unknown refcount bug we currently cannot unmount the root file
  system; therefore the task is able to abort the clean unmount if
  necessary.
- The task performs platform-dependent hardware shutdown as before.

This commit has multiple remaining issues (or exposed existing ones)
which will need to be addressed in the future but are out of scope for
now:
- Unmounting the root filesystem is impossible due to remaining
  references to the inodes /home and /home/anon. I investigated this
  very heavily and could not find whoever is holding the last two
  references.
- Userland cannot perform proper cleanup, since the Kernel's power state
  variable is accessed directly by tools instead of a proper userland
  shutdown procedure directed by SystemServer.

The recently introduced Firmware/PowerState procedures are removed
again, since all of the architecture-independent code can live in the
power state switch task. The architecture-specific code is kept,
however.
2023-07-15 00:12:01 +02:00