Commit graph

1667 commits

Author SHA1 Message Date
Timothy Flynn
c08956028a SQLServer: Mark a deferred invocation lambda as mutable
Otherwise the `move(result)` statement inside the lambda does not
actually move anything, because `result` is constant without the mutable
attribute. Caught by clangd.
2022-12-30 14:17:18 +01:00
Timothy Flynn
21255cb2b8 SQLServer: Explicitly return empty optionals over IPC upon errors
These are currently hitting the `decltype(nullptr)` constructor, which
marks the response as invalid, resulting in no response being sent to
the waiting client.
2022-12-30 14:17:18 +01:00
Jelle Raaijmakers
7b0adee487 LibGfx+Overall: Remove is_null from Point, Rect and Size
Having a `Point`, `Rect` or `Size` claim it's `null` is silly. We have
`Optional<T>` for that. For `Point`, rename `is_null` to `is_zero` to
better reflect what we're testing. For `Rect` and `Size`, `is_null` is
removed outright.

Also, remove `is_empty` from `Point`. Points can't be empty.
2022-12-28 22:32:21 -05:00
Jelle Raaijmakers
d5630bd20e NotificationServer: Use Optional for last rect in NotificationWindow
We were calling `Gfx::Rect<T>::is_null` which checked if the width and
height were 0. What we want to do instead, is check if the rect value
was set at all. `Optional<Rect>` is the right way to do this.
2022-12-28 22:32:21 -05:00
thankyouverycool
352c1fec2d Taskbar: Propagate more errors on widget population 2022-12-27 09:28:16 -05:00
thankyouverycool
10626e6c6c Taskbar: Load Assistant's AppFile on window creation
Fixes crashing when spawning Assistant by shortcut
2022-12-27 09:28:16 -05:00
Thomas Keppler
dc8be499e6 WebServer: Use new String type internally as much as possible
Here, we try to use the new String type for everything internal,
keeping the public interface and the interface to other code the same.
2022-12-26 09:38:03 +01:00
Thomas Keppler
1d6528b94b WebServer: Use new String type for default option values
We've also pulled out the default root path instead of folding it in
with the receiving variables, so that it's uniform across all options
with default values.
2022-12-26 09:38:03 +01:00
Thomas Keppler
5d305845e3 WebServer: Require document root and credentials as config init params
Now, there is nothing that can react to `set_...()` calls, so
offering this possibility can cause wrong assumptions as to what one
can do as soon as a WebServer instance has launched.

The main program can still decide whether to supply the optional
credentials or not, but this way, the configuration can become a Value
Object that won't change after initial creation.
2022-12-26 09:38:03 +01:00
Thomas Keppler
bb91857885 WebServer: Rename {real_}root_path to {real_}document_root_path
The concept of a "document root" seems to be a de-facto industry
standard and doesn't make you wonder what kind of root path is meant.
2022-12-26 09:38:03 +01:00
Timothy Flynn
9b483625e6 LibIPC+Everywhere: Change IPC decoders to construct values in-place
Currently, the generated IPC decoders will default-construct the type to
be decoded, then pass that value by reference to the concrete decoder.
This, of course, requires that the type is default-constructible. This
was an issue for decoding Variants, which had to require the first type
in the Variant list is Empty, to ensure it is default constructible.

Further, this made it possible for values to become uninitialized in
user-defined decoders.

This patch makes the decoder interface such that the concrete decoders
themselves contruct the decoded type upon return from the decoder. To do
so, the default decoders in IPC::Decoder had to be moved to the IPC
namespace scope, as these decoders are now specializations instead of
overloaded methods (C++ requires specializations to be in a namespace
scope).
2022-12-26 09:36:16 +01:00
Arda Cinar
4fec9540ec Taskbar: Handle errors when adding/changing quick launch entries
This patch removes 2 FIXMEs :^)
2022-12-26 09:31:44 +01:00
Arda Cinar
1acc788500 Taskbar: Add a factory function for TaskbarWindow
This means the errors all the way from Individual widgets get propagated
up.
2022-12-26 09:31:44 +01:00
Arda Cinar
f40cb8d771 Taskbar: Add a factory function for QuickLaunchWidget
This helps propagate errors that might happen when constructing the
quick launch menu. However, the errors are not propagated all the way
yet.
2022-12-26 09:31:44 +01:00
Baitinq
419dea0996 WebDriver: Implement stub for .../element/{element id}/click
This patch adds a stub implementation for the POST
/session/{session id}/element/{element id}/click endpoint.
2022-12-25 17:24:52 +01:00
Baitinq
6a72a4df96 LibWeb: Propagate errors in Element::scroll_into_view()
This patch will allow us to handle scrolling errors in the WebDriver
implementation :)
2022-12-25 17:24:52 +01:00
Timothy Flynn
69beda23c3 LibConfig+LibCore+ConfigServer: Support u32 configuration entries 2022-12-23 23:26:21 +01:00
ericLemanissier
7fa78b2456 Taskbar: Propagate errors while loading bmp 2022-12-23 12:23:05 +00:00
FrHun
6187cfec49 WindowServer: Remove overcropping for magnifier
This function is only used by the magnifier currently.
Since we now apply the scaling factor in Bitmap::cropped(), this is not
necessary anymore.
2022-12-23 12:16:46 +00:00
FrHun
6d4e37138e WindowServer: Allow overriding position when getting bitmap 2022-12-23 12:16:46 +00:00
Alexander Narsudinov
ce2ed7615a LookupServer: Propagate the errors from MulticastDNS::handle_packet()
This is a bit awkward, but I think it is better to make the caller
deal with possible errors.
2022-12-20 10:45:20 +01:00
Alexander Narsudinov
e279a1723b LookupServer: Propagate the errors from MulticastDNS::lookup()
This patch slightly change the signature of lookup() method
and propagates all the errors to the caller with help of ErrorOr.
2022-12-20 10:45:20 +01:00
Alexander Narsudinov
767529ebf5 LibCore: Make UDPServer::receive() return ErrorOr<ByteBuffer>
This is a first step towards handling OOM errors instead of just
crashing the program.

Now UDPServer's method `receive()` return memory allocation
errors explicitly with help of ErrorOr.

This removes one FIXME and make a bunch of new ones. :(
2022-12-20 10:45:20 +01:00
Jelle Raaijmakers
25f2e4981c AK: Stop using DeprecatedString in Base64 encoding 2022-12-20 10:34:19 +01:00
MacDue
3de5dcf383 Browser+WebContent: Fixup some DOM inspector weirdness
This fixes a few things I noticed whilst working on the inspector
for Ladybird.

1.
The computed and resolved values were being passed swapped around
from the inspect_dom_node() IPC call. I.e. computed values were
passed as resolved values and vice versa. This was then fixed by
swapping them again in the InspectorWidget (two errors canceled out).

2.
Resolved values were called "specified values" seemingly only in the
inspect_dom_node() IPC calls. This was a little confusing so I've
renamed them to back to "resolved values" for consistency.

3.
The inspector took and stored the DOM JSON strings unnecessarily,
all the models immediately parse the JSON and don't need the strings
to hang around.
2022-12-19 11:37:56 -05:00
Linus Groh
111a38c464 LibJS: Convert new_object_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Federico Guerinoni
43ff500a80 LibCore: Use ';' to split socket path in SOCKET_TAKEOVER
This allow to use socket path with spaces inside.

Closes #16436.
2022-12-15 12:33:36 -05:00
Timothy Flynn
944e17ce9e WebContent: Disallow creating WebDriverConnections with existing sockets
This reverts commit d2b2d3ad80.

This is no longer needed once Ladybird will uses local socket files.
2022-12-15 17:29:19 +00:00
Timothy Flynn
cbbaf8ea2c WebDriver: Remove the WebContent socket file when closing the session
Otherwise it is left on disk forever.
2022-12-15 17:29:19 +00:00
Timothy Flynn
956fa84f12 WebDriver: Specify callbacks for clients to launch browser windows
This moves the actual launching of browser windows to the WebDriver main
file. This will allow Ladybird to specify its own callback and re-use
Serenity's Session class.
2022-12-15 17:29:19 +00:00
Timothy Flynn
366f24a73b WebContent+WebDriver: Move WebDriver socket to the standard runtime path
This will allow Ladybird to use local socket files rather than passing
around a bunch of socket FDs.
2022-12-15 17:29:19 +00:00
Linus Groh
22089436ed LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Cygnix Proto
806a55eda1 LibGfx+Userland: Make Gfx::SystemTheme propagate errors
This patch introduces error propagation to Gfx::SystemTheme to remove
instances of release_value_but_fixme_should_propagate_errors().

Userland applications that have been affected by this change have been
updated to utilise this propagation and as a result 4 such instances of
the aforementioned method have been removed.
2022-12-14 18:25:28 +00:00
Sam Atkins
ab49dbf137 LibWeb: Convert Paintable coordinates to new pixel units
This fixes a few sizing issues too. The page size is now correct in most
cases! \o/

We get to remove some of the `to_type<>()` shenanigans, though it
reappears in some other places.
2022-12-14 16:47:57 +00:00
Sam Atkins
4440af0870 LibWeb: Split PaintContext::viewport_rect() into device/css variants
For now, everyone uses `device_viewport_rect()`, until I convert them.
2022-12-14 16:47:57 +00:00
Sam Atkins
0be479dcfb LibWeb: Make PaintContext aware of CSS and DevicePixels
Store the ratio between device and CSS pixels on the PaintContext, so
that it can convert between the two.

Co-authored-by: MacDue <macdue@dueutil.tech>
2022-12-14 16:47:57 +00:00
Maciej
569a035786 LaunchServer: Return if read_link fails in for_each_handler_for_path
Previously we were just printing error and then doing release_value(),
causing crash when opening links that cannot be read (e.g in /proc).
2022-12-14 15:48:25 +00:00
Linus Groh
91b0123eaf LibJS: Convert Array::create{,_from}() to NonnullGCPtr 2022-12-14 09:59:45 +00:00
Tim Schumacher
ed4c2f2f8e LibCore: Rename Stream::read_all to read_until_eof
This generally seems like a better name, especially if we somehow also
need a better name for "read the entire buffer, but not the entire file"
somewhere down the line.
2022-12-12 14:16:42 +01:00
thankyouverycool
e06f9174a1 WindowServer: Remove unused bools in Menu::draw()
Added in d522a6f and 1e604b7, their purpose snuffed out in 11bb88f
like the faint pulse of a pleading candle, two lives of short excess,
doomed to itemize their sins to no effect and for all eternity...
2022-12-11 20:25:58 +01:00
thankyouverycool
d80c520a92 WindowServer: Include missing visibility argument when making MenuItem
Fixes checkable MenuItems drawing incorrectly due to shifted defaults.
2022-12-11 20:25:58 +01:00
Timothy Flynn
12152a4556 SQLServer: Re-use already opened SQL::Database objects
Currently, we create a new SQL::Database object for each database we are
requested to open. When multiple clients connect to the same database,
the same underlying database file is opened and cached each time. This
results in updates from one client not being propagated to others.

To prevent this, when a database is requested to be open, check if it is
already open. We can then re-use that SQL::Database object for the new
connection.
2022-12-11 10:08:17 -05:00
Thomas Queiroz
eacfcac932 LibWeb: Use HashMap::try_ensure_capacity in StyleComputer 2022-12-10 14:29:46 +01:00
Andreas Kling
49f5767789 LibGUI+WindowServer: Add "visible" state to GUI actions
This patch adds a visibility state to GUI::Action. All actions default
to being visible. When invisible, they do not show up in toolbars on
menus (and importantly, they don't occupy any space).

This can be used to hide/show context-sensitive actions dynamically
without rebuilding menus and toolbars.

Thanks to Tim Slater for assuming that action visibility was a thing,
which gave me a reason to implement it! :^)
2022-12-10 14:28:38 +01:00
thankyouverycool
0c2f36966c WindowServer: Update checked state of m_window_menu_always_on_top_item
when setting it programmatically.
2022-12-10 13:15:35 +01:00
Sam Atkins
d3476c28ba LibWeb+WebContent+headless-browser: Remove PaintContext::scroll_offset()
Nobody uses this. They get the scroll_offset from the BlockContainer
instead.
2022-12-10 12:03:19 +00:00
Sam Atkins
3c7bd5a317 LibWeb+WebContent+headless-browser: Use CSSPixels for PageClient events
...and also for hit testing, which is involved in most of them.

Much of this is temporary conversions and other awkwardness, which
should resolve itself as the rest of LibWeb is converted to these new
types. Hopefully. :thousandyakstare:
2022-12-10 12:03:19 +00:00
Sam Atkins
8dfeb67f8c LibWeb+WebContent+headless-browser: Make Page aware of the display scale
For now, we just report it as "1" everywhere.

Replaced `screen_rect()` with `web_exposed_screen_area()` from the spec.
2022-12-10 12:03:19 +00:00
Tim Schumacher
8940f2da7f LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
Timothy Flynn
5ece0a13c4 SQLServer: Add a hook to inform owners of disconnected SQL clients 2022-12-09 20:33:19 +00:00