Commit Graph

34098 Commits

Author SHA1 Message Date
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
Liav A
c6c3e2a7fd Kernel: Instantiate a TextModeConsole early on if there's no framebuffer
If the bootloader that loaded us is providing a framebuffer details from
the Multiboot protocol then we can instantiate a framebuffer console.
Otherwise, we should use a text mode console, assuming that the BIOS and
the bootloader didn't try to modeset the screen resolution so we have is
a VGA 80x25 text mode being displayed on screen.

Since "boot_framebuffer_console" is no longer a good representative as a
global variable name, it's changed to g_boot_console to match the fact
that it can be assigned with a text mode console and not framebuffer
console if needed.
2022-02-09 21:05:48 +00:00
Liav A
278b0aa629 Kernel/Graphics: Don't assert when disabling TextModeConsole
Not sure how it's useful to do so, let's not assert if something tries
to disable it. If we will use TextModeConsole as a boot console, that
console will be disabled after loading an appropriate console to replace
it.
2022-02-09 21:05:48 +00:00
Liav A
90a194377c Kernel/Graphics: Untie Text mode console from VGACompatibleAdapter class
Instead, we can construct this type of object without having to
instantiate a VGACompatibleAdapter object first.
This can help instantiate such console very early on boot to aid debug
issues on bare metal hardware.
2022-02-09 21:05:48 +00:00
Lenny Maiorani
c6acf64558 Kernel: Change static constexpr variables to constexpr where possible
Function-local `static constexpr` variables can be `constexpr`. This
can reduce memory consumption, binary size, and offer additional
compiler optimizations.

These changes result in a stripped x86_64 kernel binary size reduction
of 592 bytes.
2022-02-09 21:04:51 +00:00
Ali Mohammad Pur
6a4c8a66ae LibRegex: Only skip full instructions when optimizing alternations
It makes no sense to skip half of an instruction, so make sure to skip
only full instructions!
2022-02-09 21:02:24 +00:00
Lenny Maiorani
f0d2489254 Applications: Port Assistant to LibMain 2022-02-09 21:01:52 +00:00
electrikmilk
133a30c8b7 Base+Browser: Add browser icons
Add local storage and style sheet icons. I also noticed the name of the
DOM tree icon needed updated (tree => dom_tree).
2022-02-09 21:00:37 +00:00
Ali Mohammad Pur
3bfcd7b52d LibJS: Implement Sets using Maps
This implements ordered sets using Maps with a sentinel value, and
includes some extra set tests.
Fixes #11004.

Co-Authored-By: davidot <davidot@serenityos.org>
2022-02-09 20:57:41 +00:00
Ali Mohammad Pur
4a73ec07c5 LibJS: Make Map iterators independent of the underlying hashmap
This implements ordered maps as a pair of an RBTree for key order, and
an underlying unordered hash map for storage.
Fixes (part of) #11004.
2022-02-09 20:57:41 +00:00
Ali Mohammad Pur
e7dea10381 AK: Add RBTree::find_smallest_above_iterator(Key) 2022-02-09 20:57:41 +00:00
Ali Mohammad Pur
9ff22ac7e0 LibHTTP: Skip the body when response code is 204
...even if the headers claim that there's some data in the form of
Content-Length.
This finally fixes loading Discord with RequestServer ConnectionCache
on :^)
2022-02-09 21:23:25 +01:00
Ali Mohammad Pur
cb7becb067 LibTLS+RequestServer: Add an option to dump TLS keys to a log file
This file allows us to decrypt TLS messages in wireshark, which can help
immensely in debugging network stuff :^)
2022-02-09 21:23:25 +01:00
Sam Atkins
a796207b9f LibWeb: Paint box-shadows more efficiently
Our previous code roughly did this:

1. Generate a bitmap as large as the shadow would end up.
2. Paint a rectangle onto it.
3. Blur the whole bitmap.
4. Split it up and render each section.

This patch takes advantage of the fact that (aside from corners) each
horizontal or vertical strip of a box-shadow is identical to the
others, to generate and blur a much smaller bitmap - only large enough
for the four corners and 1px of central "side" in each direction. This
greatly reduces the memory footprint, and should also speed things up,
since there is much less to blur.
2022-02-09 19:36:26 +01:00