Commit graph

29129 commits

Author SHA1 Message Date
Idan Horowitz
db5df26841 LibJS: Convert Array AOs to ThrowCompletionOr 2021-10-22 15:07:04 +03:00
Idan Horowitz
3426285738 LibJS: Convert Locale AOs to ThrowCompletionOr 2021-10-22 15:07:04 +03:00
Andreas Kling
09b08d8e35 WindowServer: Re-evaluate hover state when active window changes
This effectively makes us send a "mouse move" event to windows when they
become active, even if the mouse didn't actually move. By doing this, we
trigger hover/tooltip/etc logic immediately, instead of doing it on the
next 1px mouse movement.

It's a small detail but my goodness does it feel better this way. :^)
2021-10-22 13:22:09 +02:00
Liav A
cf0dbc9069 Tests: Add a unit test to ensure the /dev/mem device works correctly
To ensure everything works as expected, a unit test was added with
multiple scenarios.
This binary has to have the SetUID flag, and we also bind-mount the
/usr/Tests directory to allow running of SetUID binaries.
2021-10-22 13:13:00 +02:00
Liav A
026687816d Kernel: Fix restrictions in is_allowed_to_mmap_to_userspace function
This small change simplifies the function a bit but also fixes a problem
with it.
Let's take an example to see this:
Let's say we have a reserved range between 0xe0000 to 0xfffff (EBDA),
then we want to map from the memory device (/dev/mem) the entire
EBDA to a program. If a program tries to map more than 131072 bytes,
the current logic will work - the start address is 0xe0000, and ofcourse
it's below the limit, hence it passes the first two restrictions.
Then, the third if statement will fail if we try to mmap more than
the said allowed bytes.
However, let's take another scenario, where we try to mmap from
0xf0000 - but we try to mmap less than 131072 - but more than 65536.
In such case, we again pass the first two if statements, but the third
one is passed two, because it doesn't take into account the offseted
address from the start of the reserved range (0xe0000). In such case,
a user can easily mmap 65535 bytes above 0x100000. This might
seem negligible. However, it's still a severe bug that can theoretically
be exploited into a info leak or tampering with important kernel
structures.
2021-10-22 13:13:00 +02:00
Tim Schumacher
89afd4d063 LibC: Implement mbsnrtowcs 2021-10-21 23:57:32 -07:00
Tim Schumacher
552ae77f0d LibC: Implement wcsnrtombs 2021-10-21 23:57:32 -07:00
Tim Schumacher
e618602433 LibC: Implement mbrlen 2021-10-21 23:47:20 -07:00
Andrew Kaster
259ef76504 Utilities: Add fdtdump for dumping OpenFirmware Device Trees
Use the new LibDeviceTree to dump the contents of the device tree blob
(Flattened Device Tree) file passed on the command line.
2021-10-21 19:20:03 -07:00
Andrew Kaster
644928314a Libraries: Add LibDeviceTree for manipulating OpenFirmware Device Trees
Starting with header validation and a dump() method that can be used to
debug future parsing work.
2021-10-21 19:20:03 -07:00
Andreas Kling
4ffee78146 Kernel: Make FrameBufferDevice::try_to_set_resolution() return KResult 2021-10-22 01:21:34 +02:00
Andreas Kling
21bfa02dd2 Kernel: Remove unused InodeIdentifier::to_string() 2021-10-22 01:19:04 +02:00
Linus Groh
9143d37907 LibJS: Convert Temporal.ZonedDateTime functions to ThrowCompletionOr 2021-10-21 22:31:31 +01:00
Linus Groh
7085458a23 LibJS: Convert Temporal.TimeZone functions to ThrowCompletionOr 2021-10-21 22:31:31 +01:00
Linus Groh
15f52c5f8e LibJS: Convert Temporal.PlainYearMonth functions to ThrowCompletionOr 2021-10-21 22:31:31 +01:00
Linus Groh
e4e04528af LibJS: Convert Temporal.PlainTime functions to ThrowCompletionOr 2021-10-21 22:31:31 +01:00
Linus Groh
c8e359c25e LibJS: Convert Temporal.PlainMonthDay functions to ThrowCompletionOr 2021-10-21 22:31:31 +01:00
Linus Groh
c043b818ad LibJS: Convert Temporal.PlainDateTime functions to ThrowCompletionOr 2021-10-21 22:31:31 +01:00
Linus Groh
2093128b24 LibJS: Convert Temporal.PlainDate functions to ThrowCompletionOr 2021-10-21 22:31:31 +01:00
Linus Groh
df67f4978e LibJS: Convert Temporal.Now functions to ThrowCompletionOr 2021-10-21 22:31:09 +01:00
Linus Groh
149231d47d LibJS: Convert Temporal.Instant functions to ThrowCompletionOr 2021-10-21 22:31:09 +01:00
Linus Groh
5e9e3f9dc8 LibJS: Convert Temporal.Duration functions to ThrowCompletionOr 2021-10-21 22:31:09 +01:00
Linus Groh
2d2ba4eec6 LibJS: Convert Temporal.Calendar functions to ThrowCompletionOr 2021-10-21 22:31:09 +01:00
Andreas Kling
649cb67f28 LibGUI: Don't paint TextEditor selection in non-focused widgets
Showing the selection in non-focused text editors was not really useful,
since refocusing the widget would clear or change the selection
immediately anyway.

Note that TextEditors in inactive windows can still be the focused
widget within that window, and will still be painted with an "inactive"
looking selection.
2021-10-21 23:23:25 +02:00
Andreas Kling
c1576aca11 LibGUI: Use the new GUI::Tray widget in GUI::FilePicker
This removes all the extra entries from the keyboard focus chain and
makes FilePicker actually pleasant to navigate with the keyboard.
2021-10-21 23:23:24 +02:00
Andreas Kling
ae2579d8b5 LibGUI: Add a GUI::Tray widget for the FilePicker common locations
The FilePicker has implemented its common locations tray as a composite
widget built from a GUI::Frame with a bunch of GUI::Button inside it.
The problem with that is that it creates a long and annoying chain of
keyboard-focusable widgets.

This patch adds GUI::Tray, which is a dedicated single widget that
implements the same UI element, but without child widgets.
2021-10-21 23:23:24 +02:00
Andreas Kling
25475f7003 LibGUI: Make toolbar buttons non-focusable by default
Toolbar buttons are meant for quick mouse access to common actions,
while quick keyboard access is normally achieved via keyboard shortcuts
and underlined menu items.

This makes interfaces with many toolbar buttons (e.g GUI::FilePicker)
a lot nicer to navigate via keyboard.
2021-10-21 23:23:24 +02:00
Andreas Kling
fe98cb2c4b Kernel: Make Ext2FS::free_inode() return KResult, and use TRY() more
While there's no clear propagation path for errors that happen in an
inode destructor, using TRY() still makes the code a lot nicer.
2021-10-21 23:23:23 +02:00
Andreas Kling
98b865fe10 Kernel: Make Ext2FS::write_ext2_inode() return KResult
This allows us to use TRY() in more places.
2021-10-21 23:23:23 +02:00
Andreas Kling
6f69d5204f Kernel: Make Inode::flush_metadata() return a KResult
Even if this goes nowhere yet, we have to start building an error
propagation path somewhere.
2021-10-21 23:23:23 +02:00
Karol Kosek
6337d742bb logout: Add this utility to REQUIRED_TARGETS
The Shutdown Dialog needs it.

Related: a36d13e36c
2021-10-21 23:10:25 +02:00
Daniel Bertalan
17b66eaa3c Kernel: Call try_set_coredump_property with StringView arguments
Storing assigning a string literal to a String object just to pass it to
a function expecting a StringView is wasteful. Let's just not do that.

For consistency's sake, this commit changes all of the other invocations
to use StringView literals, too.
2021-10-21 22:19:50 +02:00
Daniel Bertalan
bbb4eb0aa1 Kernel: Convert Formatter<Process> to use Formatter<FormatString>
This lets us avoid allocating memory on the heap most of the time, as
Formatter<FormatString> writes into a quite large stack buffer instead.
2021-10-21 22:19:50 +02:00
Daniel Bertalan
39a74676bd AK: Avoid temporary String allocation in Formatter<FormatString>
Creating a String object from the formatted data is unnecessary, as it
immediately gets turned into a StringView anyways.

With this change, we will no longer allocate on the heap when printing
`VirtualAddress`, `VirtualRange` and `InodeIdentifier` objects, which is
a step towards stronger OOM hardening.
2021-10-21 22:19:50 +02:00
Daniel Bertalan
018c4e0e7e AK+Kernel: Format DistinctNumeric using the underlying type's formatter
Forcing the formatting to go through `Formatter<FormatString>` is
completely unnecessary, increases code size, performs a String
allocation and prevents us from using the formatting options available
on that type.

This commit also removes explicit formatters from
`BlockBasedFileSystem::BlockIndex` and `Kernel::InodeIndex`, as those
are already covered by the blanket implementation for all
`DistinctNumeric` types.
2021-10-21 22:19:50 +02:00
Ben Wiederhake
9bf6d51aec LibGUI: Make links only clickable where the text is 2021-10-21 20:23:04 +01:00
Nico Weber
ef1d247d79 Documentation: Tweak RunningOnRaspberryPi a bit 2021-10-21 20:01:34 +01:00
Timothy Flynn
1e1cd07549 CI: Add a cache for the CLDR on the test262 runner 2021-10-21 17:41:13 +01:00
Timothy Flynn
cff39734f1 CI: Use correct CLDR cache path on GitHub Actions 2021-10-21 17:41:13 +01:00
xSlendiX
bf80dea39c LoginServer: Capitalize username and password fields
This commit changes the TextBox's placeholders for the username and
password fields to be capitalized.
2021-10-21 16:08:13 +01:00
Andreas Kling
d621534511 LibGUI: Move GUI::FocusPolicy to its own header & add explainer comment 2021-10-21 16:48:24 +02:00
Andreas Kling
c1ba9c66b5 LibWeb: Use is_single_line() and add spec comments to FFC step 8 2021-10-21 16:48:24 +02:00
Andreas Kling
e2dbaa6ceb LibWeb: Include flex-direction in layout tree dumps 2021-10-21 16:48:24 +02:00
Ben Wiederhake
3371a27018 adjtime: Drop unnecessary privileges unconditionally
Furthermore, this simplifies the control flow.
2021-10-21 15:41:22 +01:00
Timothy Flynn
4e4db65e26 LibJS: Remove now-redundant TemporaryClearException from Promise methods
IteratorClose now handles exceptions itself before invoking VM::call(),
so outside callers doubling that work isn't helpful.
2021-10-21 14:57:43 +01:00
Jelle Raaijmakers
28e0aa59a8 Ports: Register all dependencies of ports
Previously, only `manual` installs would register dependencies of an
installed port package. Since in the future we might want to check all
dependents, not only those for manually installed packages, we should
take care to register dependencies for `auto` installs as well.

Additionally, this surpresses some unnecessary verbose output from the
package management and fixes warnings when the package DB directory did
not yet exist.
2021-10-21 14:48:21 +01:00
Jelle Raaijmakers
7ff99cb516 Ports: Return early in parse_arguments() in .port_include.sh 2021-10-21 14:48:21 +01:00
Timothy Flynn
f8e46ec296 LibJS: Convert all four PerformPromise* AOs to ThrowCompletionOr 2021-10-21 14:46:14 +01:00
Timothy Flynn
4fb948d8e7 LibJS: Convert IfAbruptRejectPromise AO to a GNU statement expression
GNU statement expressions fit the definition of IfAbruptRejectPromise
rather nicely, where we need to reject the failed promise (and return
the failed promise itself) on failure, and otherwise store a value on
success.
2021-10-21 14:46:14 +01:00
Timothy Flynn
9064491a47 LibJS: Convert GetPromiseResolve AO to ThrowCompletionOr
This is a bit ugly because, rather than simply wrapping the invocation
to GetPromiseResolve with TRY(), we have to invoke the promise's reject
method with any error. But this will be a bit cleaner in a subsequent
commit to change how IfAbruptRejectPromise is invoked.
2021-10-21 14:46:14 +01:00