Commit Graph

34111 Commits

Author SHA1 Message Date
Idan Horowitz
1aad64fbe4 Kernel: Workaround QEMU hypervisor.framework CPUID max leaf bug
This works around issue #10382 until it is fixed on QEMU's side.
Patch from Anonymous.
2022-02-11 02:45:34 +02:00
Timothy Flynn
b683e8ab77 LibSQL: Return unimplemented errors from unimplemented MATCH expressions
A bit friendlier than crashing the entire SQLService process.
2022-02-10 23:11:13 +01:00
Timothy Flynn
df2ddcafd4 LibSQL: Remove the now-unused ExecutionContext::result object
The INSERT and SELECT statements set up this object for any expression
evaluation to indicate errors. This is no longer needed.
2022-02-10 23:11:13 +01:00
Timothy Flynn
f3c6cb40d7 LibSQL: Convert SQL expression evaluation to use ResultOr
Instead of setting an error in the execution context, we can directly
return that error or the successful value. This lets all callers, who
were already TRY-capable, simply TRY the expression evaluation.
2022-02-10 23:11:13 +01:00
Timothy Flynn
2397836f8e LibSQL+SQLServer: Introduce and use ResultOr<ValueType>
The result of a SQL statement execution is either:
    1. An error.
    2. The list of rows inserted, deleted, selected, etc.

(2) is currently represented by a combination of the Result class and
the ResultSet list it holds. This worked okay, but issues start to
arise when trying to use Result in non-statement contexts (for example,
when introducing Result to SQL expression execution).

What we really need is for Result to be a thin wrapper that represents
both (1) and (2), and to not have any explicit members like a ResultSet.
So this commit removes ResultSet from Result, and introduces ResultOr,
which is just an alias for AK::ErrorOrr. Statement execution now returns
ResultOr<ResultSet> instead of Result. This further opens the door for
expression execution to return ResultOr<Value> in the future.

Lastly, this moves some other context held by Result over to ResultSet.
This includes the row count (which is really just the size of ResultSet)
and the command for which the result is for.
2022-02-10 23:11:13 +01:00
kleines Filmröllchen
6409618413 LibCore: Convert AnonymousBuffer to use System::anon_create 2022-02-10 21:35:17 +01:00
kleines Filmröllchen
cf1f58d51c LibCore/System: Add anon_create syscall wrapper
This wrapper is particularly helpful as we use a combination of similar
syscalls on Linux to simulate the behavior of the Serenity-exclusive
anon_create syscall. Users therefore won't have to worry about the
platform anymore :^)
2022-02-10 21:35:17 +01:00
Andreas Kling
05eb68d452 LibWeb: Make :root selector match <html> element only
We were matching every HTML element, instead of just the root (<html>)
2022-02-10 20:52:58 +01:00
Andreas Kling
b68c51379e LibWeb: Add "tag name" buckets to StyleComputer::RuleCache
We can skip rules that require a specific tag name when matching against
any element with a different tag name. :^)
2022-02-10 20:52:11 +01:00
Andreas Kling
031296cf7b LibWeb: Add "ID" buckets to StyleComputer::RuleCache
We can skip rules that require a specific ID when matching against any
element that doesn't have that ID.
2022-02-10 20:52:11 +01:00
Andreas Kling
646b37d1a9 LibWeb: Cache CSS rules in buckets to reduce number of rules checked
This patch introduces the StyleComputer::RuleCache, which divides all of
our (author) CSS rules into buckets.

Currently, there are two buckets:
- Rules where a specific class must be present.
- All other rules.

This allows us to check a significantly smaller set of rules for each
element, since we can skip over any rule that requires a class attribute
not present on the element.

This takes the typical numer of rules tested per element on Discord from
~16000 to ~550. :^)

We can definitely improve the cache invalidation. It currently happens
too often due to media queries. And we also need to make sure we
invalidate when mutating style through CSSOM APIs.
2022-02-10 20:52:11 +01:00
Andreas Kling
8d104b7de2 LibWeb: Perform CSS custom property cascade once instead of per-property
Previously we would re-run the entire CSS selector machinery for each
property resolved. Instead of doing that, we now resolve a final set of
custom property key/value pairs at the start of the cascade.
2022-02-10 20:52:11 +01:00
Andreas Kling
b248661f11 LibWeb: Fix a bunch of trivial clang-tidy warnings in StyleComputer
- Replace "auto" with "auto const" where appropriate.
- Remove an unused struct.
- Make sort_matching_rules() a file-local static function.
- Remove some unnecessary includes.
2022-02-10 20:51:44 +01:00
Andreas Kling
31695e1695 LibWeb: Rename a CascadeOrigin parameter in StyleComputer 2022-02-10 20:51:44 +01:00
Daste
542e18b367 HackStudio: Fix error handling logic in delete_action
The `result.is_error()` check was inverted, causing a crash.
2022-02-10 21:41:05 +02:00
Daste
11c53a1944 HackStudio: Don't save file when filename is empty
When saving a new file, save_as_action will return if the filename
input was empty, but save_action would still try to save the file.
Added a guard to make sure we never try to save files with empty
filenames.
2022-02-10 18:42:45 +01:00
Riccardo Arena
a9b387a1bf pgrep: Port to LibMain
Use unveil to allow access only to required paths. 
Switch to new pledge format.
2022-02-10 14:10:58 +00:00
Riccardo Arena
5c63537ae9 pidof: Port to LibMain
Use pledge/unveil to allow access only to required paths and syscalls.
2022-02-10 14:10:58 +00:00
Timothy Flynn
a78058bc79 LibJS: Do not refer to moved-from completions / values
In the ThrowCompletionOr constructors, the VERIFY statements are using
moved-from objects. We should not rely on those objects still being
valid after being moved.
2022-02-10 14:10:34 +00:00
davidot
821ae3a479 LibJS: Add tests for Set.prototype.keys which is an alias for values 2022-02-10 14:09:39 +00:00
davidot
45646eee43 LibJS: Fix Map Iterators when elements are deleted during iteration
Before this would assume that the element found in operator++ was still
valid when dereferencing it in operator*.
Since any code can have been run since that increment this is not always
valid.
To further simplify the logic of the iterator we no longer store the
index in an optional.
2022-02-10 14:09:39 +00:00
davidot
fdbfe85a87 AK: Clear minimum when removing last node of RedBlackTree 2022-02-10 14:09:39 +00:00
davidot
2bddf157b1 AK: Fix RedBlackTree::find_smallest_not_below_iterator
Before this was incorrectly assuming that if the current node `n` was at
least the key and the left child of `n` was below the key that `n` was
always correct.
However, the right child(ren) of the left child of `n` could still be
at least the key.

Also added some tests which produced the wrong results before this.
2022-02-10 14:09:39 +00:00
Liav A
41dae9b3c7 Kernel: Convert i8042 code to use the ErrorOr pattern more broadly
Not only does it makes the code more robust and correct as it allows
error propagation, it allows us to enforce timeouts on waiting loops so
we don't hang forever, by waiting for the i8042 controller to respond to
us.

Therefore, it makes the i8042 more resilient against faulty hardware and
bad behaving chipsets out there.
2022-02-10 15:42:56 +02:00
Liav A
dc41a0b830 Kernel: Check i8042 existence before trying to use it
If we don't do so, we just hang forever because we assume there's i8042
controller in the system, which is not a valid assumption for modern PC
hardware.
2022-02-10 15:42:56 +02:00
Timothy Flynn
f1f0770d68 LibSQL: Do not crash when SELECTing from an empty table
The crash was caused by getting the first element of an empty vector.
2022-02-10 12:20:35 +00:00
Timothy Flynn
373b467302 LibSQL+SQLServer: Move LibSQL/SQLResult.[h,cpp] to LibSQL/Result.[h,cpp]
Rename the file to match the new class name.
2022-02-10 12:20:35 +00:00
Timothy Flynn
aff17a2fbd LibSQL: Remove now-unused SQLResult class 2022-02-10 12:20:35 +00:00
Timothy Flynn
6620f19979 LibSQL+SQLServer: Return the new Result class from statement executions
We can now TRY anything that returns a SQL::Result or an AK::Error.
2022-02-10 12:20:35 +00:00
Timothy Flynn
d9055de7ea LibSQL: Add a new Result class to replace SQLResult
The existing SQLResult class predates our TRY semantics. As a result, in
the AST execution methods, there is a lot of is_error checking on values
that could instead be wrapped with TRY. This new class will allow such
semantics, and is also stack allocated (no need to be a RefPtr). It is
heavily based on LibJS's completion class.
2022-02-10 12:20:35 +00:00
Timothy Flynn
f2fae3a21c LibSQL: Do not return copies of vectors from table/index definitions 2022-02-10 12:20:35 +00:00
kleines Filmröllchen
70cdd05172 Base: Add a quote to the fortunes database 2022-02-10 11:14:27 +00:00
Lenny Maiorani
2e436129b0 LibSoftGPU: Dispatch based on ClipPlane enum at compile-time
The `ClipPlane` enum is being looped over at run-time performing
run-time dispatch to determine the comparison operation in
`point_within_clip_plane`.

Change this `for` loop to be linear code which dispatches using a
template parameter. This allows for the `point_within_clip_plane`
function to do compile-time dispatch.

Note: This linear code can become a compile-time loop when static
reflection lands in C++2[y|z] allowing looping over the reflected
`enum class`.
2022-02-10 10:33:31 +00:00
electrikmilk
3c11dc5bd3 Base+HackStudio: Add or insert missing icons
Insert or add icons where they are missing.
2022-02-10 10:27:26 +00:00
Timothy Flynn
19d4f52a9e js: Add a command line argument to evaluate a string as a script
For example:

    $ js -c "console.log(42)"
    42
2022-02-10 10:26:12 +00:00
Ryan Chandler
65de0d2910 Utilities: Port realpath to LibMain 2022-02-10 10:25:36 +00:00
Lenny Maiorani
2e87a5b7eb Applications: Port Spreadsheet to LibMain 2022-02-10 10:24:18 +00:00
Lenny Maiorani
4b18a25e22 Applications: Port SpaceAnalyzer to LibMain 2022-02-10 10:23:51 +00:00
Lenny Maiorani
ed971f1134 Applications: Port Debugger to LibMain 2022-02-10 10:23:26 +00:00
Lenny Maiorani
e5d178528d AK: Change static base36 character map to function-local constexpr
Static variables consume memory and can be subject to less
optimization. This variable is only used in 1 place and can be moved
into the function and make it non-static.
2022-02-10 10:22:54 +00:00
electrikmilk
7be79eeb5e Base: Add pastel color palette
Add pastel color palette for PixelPaint.
2022-02-10 10:22:17 +00:00
Lady Gegga
c9ce73ffaa Base: Add Ol Chiki characters to font Katica Regular 10
1C50, 1C51, 1C5A-1C67, 1C6A-1C70, 1C73-1C7C, 1C7E, 1C7F
https://www.unicode.org/charts/PDF/U1C50.pdf
2022-02-10 08:48:43 +00:00
Lady Gegga
b11c22e564 Base: Add Lycian characters to font Katica Regular 10
10280-1029C https://www.unicode.org/charts/PDF/U10280.pdf
2022-02-10 08:48:43 +00:00
Lady Gegga
ce0df575a3 Base: Add Carian characters to font Katica Regular 10
102A0-102D0 https://www.unicode.org/charts/PDF/U102A0.pdf
2022-02-10 08:48:43 +00:00
Luke Wilde
1bfbc0b6af LibJS: Don't coerce this value to an object in Function.prototype.call 2022-02-10 08:45:03 +00:00
Luke Wilde
12231068bd LibJS: Don't coerce this value to an object in Function.prototype.apply 2022-02-10 08:45:03 +00:00
Linus Groh
898ad7c682 LibJS: Implement Function.prototype.bind() according to the spec :^) 2022-02-09 23:31:34 +00:00
Linus Groh
87b9fa2636 LibJS: Add FunctionObject constructor allowing null prototype
This just calls through to the Object constructor added in the previous
commit.
2022-02-09 23:31:34 +00:00
Linus Groh
368af9ad6e LibJS: Add Object constructor allowing null prototype 2022-02-09 23:31:34 +00:00
Linus Groh
f663c7d6da LibJS: Remove unused BoundFunction::m_constructor_prototype
This was not being used anywhere, and the way we determined it was not
matching the spec at all, so let's remove it and do it properly.
2022-02-09 23:31:34 +00:00