Commit Graph

1853 Commits

Author SHA1 Message Date
Timothy Flynn
0524bc1d13 WebContent+WebDriver: Ensure Get Window Handle checks for closed BCs 2023-03-07 18:16:35 +00:00
Timothy Flynn
010be9b7c2 WebDriver: Do not throw an error when closing an inactive session
The spec states to only try to close the session *if* it exists. This
situation can occur when closing a session after a Close Window command,
as the session will be closed automatically if it was the last window.
2023-03-07 18:16:35 +00:00
Timothy Flynn
12015a4db6 WebDriver: Remove active sessions from the close-the-session AO
These steps now have more than one caller; specifically, they may be
called from the Delete Session and Close Window endpoints. The session
was only removed from the active session map for the former endpoint.

Instead, let's more accurately handle removing the session where the
spec tells us to, so that all callers properly perform this step.
2023-03-07 18:16:35 +00:00
Timothy Flynn
a0992c7731 WebDriver: Reference-count WebDriver Session objects
When some WebDriver spec steps are implemented a bit more literally, we
will end up in a situation where we remove a session from its client's
active session map, but still have more steps to perform. Currently,
when we remove the session, it is immediately destroyed because it is
stored in an OwnPtr. Instead, we can store it as a RefPtr, which will
let the caller to such steps keep the session alive until the subsequent
steps are complete.

While here, this also changes the storage of active sessions to a
HashMap, as all lookups into it are currently a linear search.
2023-03-07 18:16:35 +00:00
Timothy Flynn
7be8931ca0 WebDriver: Defer removing closed window handles until no longer needed
WebDriver::Session::close_window may invoke Session::stop, which needs
the WebContent connection to still exist. Do not remove the window's
handle (thus destroying the connection) until it is no longer needed.
2023-03-07 18:16:35 +00:00
Timothy Flynn
0ae015e266 WebDriver: Do not ignore the result of closing a session 2023-03-07 18:16:35 +00:00
Aliaksandr Kalenik
5c117cdcec WebDriver: Keep WebDriver socket listening until session end
WebDriver socket should not be closed as soon as first client
got connected becaused there might more than one WebContent
process spawned by browser.
2023-03-07 07:16:23 -05:00
Aliaksandr Kalenik
0905fd57e4 WebContent+WebDriver: Move window commands handling back to WebDriver
With current architecture every window has its own WebContent process
and there is one WebDriver process that is responsible for talking to
all opened windows. It thus make sense to manage open windows from
WebDriver process instead of WebContent process that is not supposed
to know about all other opened WebContent processes.

This mostly reverts 826d5f8f9a but also
adds `web_content_connection` to window structure and window id
generation (currently out of spec).

With these changes `get_window_handles`, `switch_to_window` and
`close_window` start to actually switch, close and returned handles
of currently opened windows.
2023-03-07 07:16:23 -05:00
Aliaksandr Kalenik
cc41233be4 LibWebView+WebContent: Propagate close from WebContent to LibWebView 2023-03-07 11:34:11 +00:00
Andreas Kling
21db2b7b90 Everywhere: Remove NonnullOwnPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Andreas Kling
689ca370d4 Everywhere: Remove NonnullRefPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling
8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Matthew Olsson
a9372de972 WebContent: Add missing LibGfx include 2023-03-06 13:05:43 +00:00
Timothy Flynn
77fbd912b7 LibWeb+WebContent+WebDriver: Port WebDriver parameters to String
This changes the parameters parsed from a WebDriver HTTP request to
String for transferring over IPC. Conveniently, most locations these
were ultimately passed to only need a StringView.
2023-03-05 23:50:05 +00:00
Sam Atkins
774f328783 LibCore+Everywhere: Return an Error from DirIterator::error()
This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
2023-03-05 20:23:42 +01:00
Andreas Kling
b71c7a6e44 Userland: Use Font::pixel_size_rounded_up() instead of glyph_height()
The only remaining clients of this API are specific to bitmap fonts and
editing thereof.
2023-03-04 00:29:38 +01:00
Ali Mohammad Pur
500044906d LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
2023-03-01 10:47:19 +01:00
Luke Wilde
54f58e2662 LibWeb: Restore proper functionality of legacy platform objects
With the GC heap conversion, the functionality of legacy platform
objects was broken. This is because the generated implementation of one
of them was used for all of them, removing functionality such as
deletion.

This re-adds all functionality, where questions such as "does the
object support indexed properties?" is instead answered by virtual
functions instead of by the IDL generator checking the presence of
certain keywords/attributes.
2023-02-28 12:36:14 +01:00
Andreas Kling
7e76a51cb0 LibWeb: Rename Layout::InitialContainingBlock to Layout::Viewport
The name "initial containing block" was wrong for this, as it doesn't
correspond to the HTML element, and that's specifically what it's
supposed to do! :^)
2023-02-28 12:21:56 +01:00
Nico Weber
a83f4ec186 WebServer: Remove a call to String::from_deprecated_string
guess_mime_type_based_on_filename() returns a StringView, so no
need to bring DeprecatedString's (implicit) ctor into this.

No behavior change.
2023-02-26 21:01:58 -05:00
MacDue
6cf8eeb7a4 LibGfx: Return bool not ErrorOr<bool> from ImageDecoderPlugin::sniff()
Nobody made use of the ErrorOr return value and it just added more
chance of confusion, since it was not clear if failing to sniff an
image should return an error or false. The answer was false, if you
returned Error you'd crash the ImageDecoder.
2023-02-26 19:43:17 +01:00
Linus Groh
09d40bfbb2 Everywhere: Use _{short_,}string to create Strings from literals 2023-02-25 20:51:49 +01:00
Timothy Flynn
87c4080d00 Browser+LibWeb+WebContent: Store cookie expiry times in UTC
We are currently converting parsed expiry times to local time, whereas
the RFC dictates we parse them as UTC. When expiring cookies, we must
also use the current UTC time to compare against the cookies' expiry
times.
2023-02-24 15:50:42 -05:00
Andrew Kaster
f40094d014 LibWeb+LibJS: Format Console arguments with JS::Print
Instead of just calling JS::Value::to_string_without_side_effects() when
printing values to the console, have all the console clients use
the same JS::Print that the REPL does to print values.

This method leaves some things to be desired as far as OOM hardening
goes, however. We should be able to create a String in a way that
doesn't OOM on failure so hard.
2023-02-21 10:57:44 +01:00
Andreas Kling
38b6eedd54 WebContent: Fix const-correctness issues 2023-02-21 00:54:04 +01:00
Andreas Kling
025bdcf34c WindowServer: Fix various const-correctness issues 2023-02-21 00:54:04 +01:00
Jonah
30ec59f163 WebDriver: Add computedlabel endpoint 2023-02-19 13:28:01 -05:00
Liav A
61f4914d6e Kernel+Userland: Add constants subdirectory at /sys/kernel directory
This subdirectory is meant to hold all constant data related to the
kernel. This means that this data is never meant to updated and is
relevant from system boot to system shutdown.
Move the inodes of "load_base", "cmdline" and "system_mode" to that
directory. All nodes under this new subdirectory are generated during
boot, and therefore don't require calling kmalloc each time we need to
read them. Locking is also not necessary, because these nodes and their
data are completely static once being generated.
2023-02-19 13:47:11 +01:00
Liav A
73bc856c16 SystemServer: Re-mount / as non-writable, nosuid and nodev
This is a preparation before we remove the default root mount flags from
the kernel code.
2023-02-19 01:20:10 +01:00
Tom
328a64fbdc WindowServer: Fix drawing wallpaper on additional screens
We need to translate the source rectangle relative to the screen
location when blitting from the wallpaper bitmap.
2023-02-19 01:15:26 +01:00
Tom
15d4903efb WindowServer: Fix caching stretched wallpaper for multiple screens
This creates a cached bitmap for each unique screen resolution, which
allows us to share it between displays with the same resolution. If
the resolution is the same as the wallpaper, we can just use the
wallpaper as-is.
2023-02-19 01:15:26 +01:00
Lucas CHOLLET
9c1dbf1ac5 SpiceAgent: Rename ClipboardType::JPG to ClipboardType::JPEG 2023-02-18 23:56:24 +01:00
Lucas CHOLLET
856d0202f2 LibGfx: Rename JPGLoader to JPEGLoader
The patch also contains modifications on several classes, functions or
files that are related to the `JPGLoader`.

Renaming include:
 - JPGLoader{.h, .cpp}
 - JPGImageDecoderPlugin
 - JPGLoadingContext
 - JPG_DEBUG
 - decode_jpg
 - FuzzJPGLoader.cpp
 - Few string literals or texts
2023-02-18 23:56:24 +01:00
Sam Atkins
6b66e39df4 LibGUI+Userland: Stop returning Layout from Widget::(try_)set_layout()
Nobody uses this return value any more. It also lets us remove a whole
bunch of `(void)` casts. :^)
2023-02-18 16:56:56 +00:00
Sam Atkins
77ad0fdb07 Userland: Specify margins and spacing in the GUI::Layout constructor 2023-02-18 16:56:56 +00:00
Sam Atkins
9561ec15f4 Userland: Use Widget::add_spacer() everywhere 2023-02-18 16:56:56 +00:00
Kenneth Myhra
c120c46acc LibWeb: Make factory methods of DOM::Event fallible
Because of interdependencies between DOM::Event and UIEvents::MouseEvent
to template function fire_an_event() in WebDriverConnection.cpp, the
commit: 'LibWeb: Make factory methods of UIEvents::MouseEvent fallible'
have been squashed into this commit.
2023-02-18 00:52:47 +01:00
John Bundgaard
7dc874104b WindowServer: Redraw Taskbar on window highlight during switching 2023-02-17 16:18:14 +00:00
John Bundgaard
091dbec295 WindowServer: Show window switcher even if fullscreen window is active 2023-02-17 16:18:14 +00:00
Tim Schumacher
43f98ac6e1 Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
Tim Schumacher
874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher
606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Karol Kosek
e39adc4772 Userland: Set Button text using the new String class 2023-02-13 00:45:09 +00:00
Karol Kosek
b5cb9a9ebb LibGUI+TaskBar: Make Calendar::formatted_date() return ErrorOr<String>
This commit introduces no error propagation.
2023-02-13 00:45:09 +00:00
Karol Kosek
d32d4029d3 Userland: Replace usages of AbstractButton::text_deprecated with text() 2023-02-13 00:45:09 +00:00
Karol Kosek
d32b052f22 LibGUI+Userland: Add _deprecated suffix to AbstractButton::{set_,}text 2023-02-13 00:45:09 +00:00
Karol Kosek
421b1eee49 WindowServer: Restore cursor animation
This regressed in 6edc0cf5ab.
2023-02-11 14:34:56 +00:00
Timothy Flynn
3b4879d29b LibJS+Userland: Port the JS Console object and direct callers to String 2023-02-10 17:26:20 +00:00
Timothy Flynn
4a916cd379 Everywhere: Remove needless copies of Error / ErrorOr instances
Either take the underlying objects with release_* methods or move() the
instances around.
2023-02-10 09:08:52 +00:00
MacDue
63b11030f0 Everywhere: Use ReadonlySpan<T> instead of Span<T const> 2023-02-08 19:15:45 +00:00
Tim Schumacher
a86184c997 AudioServer: Use AK::Stream to serialize mixed samples 2023-02-08 18:51:02 +00:00
Tim Schumacher
185787d29d TelnetServer: Use AK::Stream to serialize commands 2023-02-08 18:51:02 +00:00
Tim Schumacher
220fbcaa7e AK: Remove the fallible constructor from FixedMemoryStream 2023-02-08 17:44:32 +00:00
MacDue
ab5bdc598d Revert "SQLServer: Unveil /etc/passwd"
This reverts commit c3bd841d50.
2023-02-05 16:40:51 +01:00
MacDue
808f0c6837 Revert "ConfigServer: Unveil "/etc/passwd""
This reverts commit cd0b7656fa.
2023-02-05 16:40:51 +01:00
MacDue
83f41d1491 SystemServer: Revert back to inheriting environments again
This reverts the SystemServer exec() logic to how it was before
81bd91c, but now with some extra TRY()s. This allows the HOME var
to always be propagated from LoginServer which prevents needing
to unveil() /etc/passwd everywhere.
2023-02-05 16:40:51 +01:00
Liav A
ed67a877a3 Kernel+SystemServer+Base: Introduce the RAMFS filesystem
This filesystem is based on the code of the long-lived TmpFS. It differs
from that filesystem in one keypoint - its root inode doesn't have a
sticky bit on it.

Therefore, we mount it on /dev, to ensure only root can modify files on
that directory. In addition to that, /tmp is mounted directly in the
SystemServer main (start) code, so it's no longer specified in the fstab
file. We ensure that /tmp has a sticky bit and has the value 0777 for
root directory permissions, which is certainly a special case when using
RAM-backed (and in general other) filesystems.

Because of these 2 changes, it's no longer needed to maintain the TmpFS
filesystem, hence it's removed (renamed to RAMFS), because the RAMFS
represents the purpose of this filesystem in a much better way - it
relies on being backed by RAM "storage", and therefore it's easy to
conclude it's temporary and volatile, so its content is gone on either
system shutdown or unmounting of the filesystem.
2023-02-04 15:32:45 -07:00
Timothy Flynn
cb06031180 LibSQL+SQLServer: Send result column names over IPC to SQL clients 2023-02-03 20:34:45 +01:00
Liav A
f354b52099 SystemServer: Propagate errors properly in the main code
To do this properly, we also create Strings with formatting of device
nodes' names, taking into consideration errors when doing that.
Also, we use LibCore System mknod method instead of raw LibC functions
to be able to propagate errors from these calls too.
2023-02-03 19:38:23 +01:00
Timothy Flynn
7c1fe32af3 WebContent: Remove pending file requests before invoking their callbacks
It's currently possible for the callback of a file request to request
more file objects. This could cause the hash map storing these requests
to be rehashed while one of its callbacks is being invoked. AK::Function
explicitly forbids this with an assertion.

Instead, remove the callback from the hash map before invoking the
callback function.
2023-02-02 19:14:00 +00:00
Karol Kosek
2cc108a15e LibWeb: Rename DOM::shadow_root() to shadow_root_internal()
The shadowRoot property getter that will be added in subsequent commits
has an additional check that checks whether the shadow root is opened.
I didn't update the function logic to match with the IDL interface,
because it's very likely we don't want that check in the existing code,
so that for example closed shadow root elements can still be updated.
2023-02-02 14:43:29 +01:00
Guilherme Gonçalves
230c0b34d4 LibWeb+LibWebSocket: DOM WebSocket subprotocol support
This adds support for WebSocket subprotocols to WebSocket DOM
objects, with some necessary plumbing to LibWebSocket and its
clients.

See the associated pull request for how this was tested.
2023-02-02 14:41:34 +01:00
Timothy Flynn
5d1acdc455 FileSystemAccessServer: Send correct error code for failed file access
When a file cannot be accessed, we currently send errno as the error
code. However, there are system calls which occur (by way of dbgln)
between the failed file access and accessing errno. This prevents the
client-side detection of ENOENT from working.

Instead, send over the error we already have stored in the ErrorOr
object.
2023-02-02 14:36:01 +01:00
MacDue
c3bd841d50 SQLServer: Unveil /etc/passwd
This is now required to launch the SQLServer for Browser (without
this it now fails to launch).
2023-02-02 02:17:06 -07:00
Lucas CHOLLET
81bd91c1c3 SystemServer: Propagate errors
This patch also includes some changes in the way that the environment
and arguments are passed to `exec`. It was needed to fit the signature
of `Core::System::exec`. That's beneficial though, as we are now doing
`String` manipulation in a fallible environment, so we can propagate
more errors.
2023-02-01 19:21:10 +01:00
Lucas CHOLLET
cd0b7656fa ConfigServer: Unveil "/etc/passwd"
This is needed to use functions like `getpwuid()`.
2023-02-01 19:21:10 +01:00
Timothy Flynn
96f409ec1e LibWeb+WebContent: Do not reference-count file request objects
There is currently a memory leak with these file request objects due to
the callback on_file_request_finish referencing itself in its capture
list. This object does not need to be reference counted or allocated on
the heap. It is only ever stored in a HashMap until a response is
received from the browser, and it is not shared.
2023-02-01 14:04:44 +00:00
Tim Schumacher
093cf428a3 AK: Move memory streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher
8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Tim Schumacher
ae64b68717 AK: Deprecate the old AK::Stream
This also removes a few cases where the respective header wasn't
actually required to be included.
2023-01-29 19:16:44 -07:00
Linus Groh
8556d47240 LibWeb: Move ARIA-related code into the Web::ARIA namespace
ARIA has its own spec and is not part of the DOM spec, which is what the
Web::DOM namespace is for (https://www.w3.org/TR/wai-aria-1.2/).

This allows us to stay closer to the spec with function names and don't
have to add the word "ARIA" to identifiers constantly - the namespace
now provides that clarity.
2023-01-29 00:02:55 +00:00
Timothy Flynn
b75b7f0c0d LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate
Callers that are already in a fallible context will now TRY to allocate
cells. Callers in infallible contexts get a FIXME.
2023-01-29 00:02:45 +00:00
Timothy Flynn
2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
2023-01-29 00:02:45 +00:00
MacDue
890b4d7980 LibWeb: Replace ARIA role static FlyStrings with an enum
This replaces the FlyStrings for ARIA roles that were constructed in
a [[gnu::constructor]] with a single enum. I came across this as the
DOM inspector was crashing due to a null FlyString for an ARIA role.

After fixing that, I was confused as to why these roles were not an
enum. Looking at the spec there's a fixed list of roles and switching
from references to static strings to an enum was pretty much an
exercise in find and replace :).

No functional changes (outside of fixing the mentioned crash).
2023-01-28 22:09:18 +00:00
Karol Kosek
f23eba1ba8 ImageDecoder: Actually set is_animated and loop_count variables
Before 649f78d0a4, the is_animated and
loop_count objects were set directly when making a return object.

That commit moved the decode logic to a separate function but forgot to
assign `is_animated` and `loop_count`. The compiler didn't throw an
error about unused variables because we were also VERIFY()ing that these
variables were zero-initialized at the beginning of the function.
2023-01-28 21:49:23 +00:00
Linus Groh
108ea2b921 LibCore: Remove try_ prefix from fallible SharedCircularQueue methods 2023-01-28 22:41:36 +01:00
Linus Groh
6e7459322d AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
2023-01-27 20:38:49 +00:00
Sam Atkins
da81041e97 WindowServer: Remove declarations for non-existent methods 2023-01-27 20:33:18 +00:00
Sam Atkins
990f1c799e TelnetServer: Remove declarations for non-existent methods 2023-01-27 20:33:18 +00:00
Sam Atkins
ca85ce6db3 Taskbar: Remove declarations for non-existent methods 2023-01-27 20:33:18 +00:00
Sam Atkins
38b4e938b7 WebContent: Implement more of WebDriver element-click algorithm
All this just for `<option>` elements. Other elements require a lot more
infrastructure that we don't have yet.
2023-01-27 17:30:46 +00:00
Sam Atkins
f64ba82944 WebContent: Bring existing WebDriver element-click code closer to spec
The main change here is to implement and use the "container for element"
algorithm. But also, adjust the errors we return. Errors thrown by
`scroll_element_into_view()` are not related to the scrolling itself,
so should not claim to be. `UnsupportedOperation` is more accurate than
`InvalidArgument` when we're expressing that the operation isn't fully
implemented.
2023-01-27 17:30:46 +00:00
Sam Atkins
c43db5dae7 WebDriver+LibWeb: Rename "click" to "element_click"
This matches the name used in the spec, and is unambiguous.
2023-01-27 17:30:46 +00:00
Sam Atkins
ba51e2dd3f Services: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-27 08:07:24 -05:00
Tim Schumacher
82a152b696 LibGfx: Remove try_ prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit
it.
2023-01-26 20:24:37 +00:00
Sam Atkins
a19e54c1db WindowServer: Reuse existing WindowManager::desktop_rect() method 2023-01-24 14:41:16 +00:00
Jelle Raaijmakers
83488cd102 WindowServer: Double click a window's frame to latch to screen's edge 2023-01-24 12:53:26 +00:00
Jelle Raaijmakers
3e70d41c57 WindowServer: Always process double clicks for mouse events
This used to be optional and was disabled in two cases:

  - On a mouse move event during dragging; because double clicks are
    only possible on mouse up events, this had no effect.
  - On a mouse event for automatic cursor tracking; this has now gained
    support for double click events.

Since it's always enabled now, we can remove the `bool` argument.
2023-01-24 12:53:26 +00:00
Andrew Kaster
100fb38c3e Kernel+Userland: Move LibC/sys/ioctl_numbers to Kernel/API/Ioctl.h
This header has always been fundamentally a Kernel API file. Move it
where it belongs. Include it directly in Kernel files, and make
Userland applications include it via sys/ioctl.h rather than directly.
2023-01-21 10:43:59 -07:00
Tim Schumacher
63cf9b973d AK: Remove FileStream 2023-01-21 14:43:56 +01:00
Tim Schumacher
debde54928 WebServer: Use Core::Stream to read served files 2023-01-20 20:50:42 +00:00
Liav A
57e19a7e56 LibGfx: Re-structure the whole initialization pattern for image decoders
When trying to figure out the correct implementation, we now have a very
strong distinction on plugins that are well suited for sniffing, and
plugins that need a MIME type to be chosen.

Instead of having multiple calls to non-static virtual sniff methods for
each Image decoding plugin, we have 2 static methods for each
implementation:
1. The sniff method, which in contrast to the old method, gets a
    ReadonlyBytes parameter and ensures we can figure out the result
    with zero heap allocations for most implementations.
2. The create method, which just creates a new instance so we don't
    expose the constructor to everyone anymore.

In addition to that, we have a new virtual method called initialize,
which has a per-implementation initialization pattern to actually ensure
each implementation can construct a decoder object, and then have a
correct context being applied to it for the actual decoding.
2023-01-20 15:13:31 +00:00
Liav A
6e6999ce57 LibGfx: Re-work the abstractions of sending image for decoding over IPC
Originally I simply thought that passing file paths is quite OK, but as
Linus pointed to, it turned out that passing file paths to ensure some
files are able to be decoded is awkward because it does not work with
images being served over HTTP.

Therefore, ideally we should just use the MIME type as an optional
argument  to ensure that we can always fallback to use that in case
sniffing for the correct image type has failed so we can still detect
files like with the TGA format, which has no magic bytes.
2023-01-20 15:13:31 +00:00
Liav A
649f78d0a4 LibGfx+Ladybird+Userland: Don't sniff for TGA images with only raw bytes
Because TGA images don't have magic bytes as a signature to be detected,
instead assume a sequence of ReadonlyBytes is a possible TGA image only
if we are given a path so we could check the extension of the file and
see if it's a TGA image.

When we know the path of the file being loaded, we will try to first
check its extension, and only if there's no match to a known decoder,
based on simple extension lookup, then we would probe for other formats
as usual with the normal sniffing method.
2023-01-18 21:48:35 +01:00
Timothy Flynn
142abc0b2e LibCore+ConfigServer: Add FileWatcherFlags to replace InodeWatcherFlags
InodeWatcherFlags is an enumeration from the Kernel. To avoid using it
outside of Serenity, add a FileWatcherFlags for FileWatcher, much like
we already have FileWatcherEvent::Type.
2023-01-18 09:37:11 -05:00
Timothy Flynn
98e6dbf50a Userland: Add missing limits.h header includes
This is currently being implicitly including by InodeWatcherEvent.h by
way of FileWatcher.h. The former will soon be removed from the latter,
which would otherwise cause a compile error in these files.
2023-01-18 09:37:11 -05:00
Sam Atkins
1dd6b7f5b7 AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-17 19:52:52 -05:00