Commit graph

1116 commits

Author SHA1 Message Date
Sam Atkins 73552c1856 Userland: Always construct Application with try_create() 2022-04-18 12:57:34 +02:00
Thitat Auareesuksakul c949a4db2d DHCPClient: Send ParameterRequestList option with DHCPRequest packet
We'll need SubnetMask and Router options to be returned with the ACK
packet. So, it's a good idea to request them explicitly in this packet.
2022-04-17 10:25:01 +04:30
Thitat Auareesuksakul 01a602cb51 DHCPClient: Send ServerIdentifier option with DHCPRequest packet
Some DHCP servers (including Mikrotik ones) will NAK the request if the
ServerIdentifier option is not sent with the DHCPRequest packet.
2022-04-17 10:25:01 +04:30
Sam Atkins c4134e9794 LibCore+Everywhere: Make Core::Stream read_until() return Bytes
This affects BufferedSeekable::read_until() and ::read_until_any_of().
For the reasoning, see the previous commit about Core::Stream::read().
2022-04-16 13:27:51 -04:00
Sam Atkins 3b1e063d30 LibCore+Everywhere: Make Core::Stream::read() return Bytes
A mistake I've repeatedly made is along these lines:
```c++
auto nread = TRY(source_file->read(buffer));
TRY(destination_file->write(buffer));
```

It's a little clunky to have to create a Bytes or StringView from the
buffer's data pointer and the nread, and easy to forget and just use
the buffer. So, this patch changes the read() function to return a
Bytes of the data that were just read.

The other read_foo() methods will be modified in the same way in
subsequent commits.

Fixes #13687
2022-04-16 13:27:51 -04:00
Tom 49de4d5f33 LibDNS: Remove the 'DNS' prefix from the various type and class names
Since all types and class names live in the DNS namespace, we don't
need to spell it out twice each time.
2022-04-15 16:34:26 +01:00
Tom be4a4144f2 LookupServer: Move DNS related code into new LibDNS library
This allows other code to use the DNSPacket class, e.g. when sent
over IPC.
2022-04-15 16:34:26 +01:00
Aatos Majava 85da8cbb07 TelnetServer: Ignore null and \n when parsing
This fixes issues with carriage return sequences.

Before, using <CR><NUL> as the return sequence wouldn't work at all,
and when using <CR><LF> there was an extra newline after every newline.

After this patch, the behaviour should be closer to the Telnet RFC.
2022-04-14 16:12:16 +02:00
Tim Schumacher 1bdaee475b DHCPClient: Close outgoing sockets after use 2022-04-11 00:15:06 +02:00
kleines Filmröllchen 5319e3a03f LibCore+Userland: Remove File::ensure_parent_directories
We have a much safer and more powerful alternative now, so let's move
the few users over.
2022-04-11 00:08:48 +02:00
kleines Filmröllchen 0fd09b2381 LibCore: Automatically create config directories if necessary
If the .config directory (or its children, like lib) was deleted,
ConfigFile would crash because it would try to open or create a file in
a directory that didn't exist. Therefore, for user and library configs
(but not system configs), ensure that the parent directories exist. This
allows the user to delete the entire .config folder and all apps still
work. (Except those which can't handle missing config. That's a separate
issue though.)

Fixes #13555

Note: Some changes to pledges and unveils are necessary for this to
work. The only one who can recreate .config at the moment is
ConfigServer, as others probably don't pledge the user home directory.
2022-04-11 00:08:48 +02:00
Simon Wanner 206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
Ali Mohammad Pur a42e03b01a Browser+LibWeb+WebContent: Implement per-URL-pattern proxies
...at least for SOCKS5.
2022-04-09 12:21:43 +02:00
Ali Mohammad Pur 45867435c4 RequestServer+LibProtocol: Allow users to specify a per-request proxy 2022-04-09 12:21:43 +02:00
Ali Mohammad Pur cd9d740107 LibCore+RequestServer: Add support for SOCKS5 proxies 2022-04-09 12:21:43 +02:00
Lady Gegga e34f199997 WebServer: Add utf-8 charset to Content-Type header for text/plain 2022-04-09 01:14:14 +02:00
Andreas Kling 59e8dedea2 LibWeb: Remove the InProcessWebView widget
Let's simplify our offering by only having the OutOfProcessWebView.
2022-04-06 19:35:07 +02:00
sin-ack 359365a06a InspectorServer: Defer removal of InspectableProcess from table
This prevents a crash when the inspected process closes the socket (i.e.
when the app is exited). This crash was caused by the InspectableProcess
removing itself from the global process table within a callback Function
that is stored as part of the InspectableProcess.
2022-04-06 13:04:03 +02:00
Andreas Kling 217993b1d1 Revert "WebContent: Use ConsoleGlobalObject for the console's global object :^)"
This reverts commit 8296dd9955.
2022-04-05 17:47:52 +02:00
Andreas Kling 1a38ab0ca1 WindowServer+LibGUI: Notify windows when their maximized state changes
Previously, GUI::Window::is_maximized() had to make a synchronous IPC
request to WindowServer in order to find out if the window was indeed
maximized.

This patch removes the need for synchronous IPC by instead pushing the
maximization state to clients when it changes.

The motivation for this change was that GUI::Statusbar was checking
if the containing window was maximized in its resize_event(), causing
all windows with a statusbar to block on sync IPC *during* resize.
Browser would typically block for ~15 milliseconds here every time
on my machine, continuously during live resize.
2022-04-05 17:45:07 +02:00
Andreas Kling 463dc91049 WebContent: Cancel pending paint requests when removing a backing store
If there are pending paint requests waiting to be processed when the
client asks us to remove a backing store, we now prune them from the
request queue.

This avoids doing completely wasted painting work while resizing the
browser window. :^)
2022-04-05 17:28:33 +02:00
Sam Atkins 8296dd9955 WebContent: Use ConsoleGlobalObject for the console's global object :^)
Seems like this got missed when ESOs were implemented. Now we can use
`$0` again!
2022-04-05 13:02:12 +01:00
cflip 5bb0b6ba7a ClockSettings+Taskbar: Add settings for taskbar clock format 2022-04-04 13:15:13 +02:00
Brian Gianforcaro 09fe9b546f Services: Use default execpromises parameter to pledge(..) 2022-04-03 17:13:51 -07:00
Valtteri Koskivuori 45a81f5a2c Browser+LibWeb+WebContent: Add ability to inspect local storage
The storage inspector now has a new tab for local storage. The next step
would be to persist local storage and receive real-time notifications
for changes to update the table view.
2022-04-03 13:13:10 +01:00
Ben Maxwell 8070a98288 DisplaySettings+WindowServer: Allow updating theme without background
With this change you can now set the theme and background color at the
same time in the Display Settings. Before if both were changed
before hitting 'apply' the theme background color would overwrite
the custom background.
2022-04-03 12:58:46 +02:00
Ben Maxwell 8fa0409ae1 LibGfx: Add list_installed_system_themes() to SystemTheme 2022-04-02 21:50:41 +02:00
Idan Horowitz 086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Linus Groh 04e40b7aaa Browser+WebContent: Add a Debug menu action to disable scripting :^) 2022-03-31 17:08:38 +02:00
Linus Groh 780e5441b4 WebContent: Add plumbing for 'is scripting enabled' setting 2022-03-31 17:08:38 +02:00
Linus Groh 46ad69cd1e LookupServer: Fix confusing copy/paste error in debug message 2022-03-27 18:39:47 +01:00
Timur Sultanov 46710d9efa LookupServer: Use case-insensitive comparison for domain names
Some ISPs may MITM DNS requests coming from clients, changing the case
of domain name in response. LookupServer will refuse responses from
any DNS server in that case. This commit changes the behaviour to
perform a case-insensitive equality check.
2022-03-27 17:36:13 +02:00
circl eeeaf410fb WindowServer+LibGUI: Expose raw scroll wheel values to applications
This is useful, for instance, in games in which you can switch held
items using the scroll wheel. In order to implement this, they
previously would have to either add a hard-coded division by 4, or look
up your mouse settings to adjust correctly.

This commit adds an MouseEvent.wheel_raw_delta_x() and
MouseEvent.wheel_raw_delta_y().
2022-03-27 01:11:27 +01:00
Andreas Kling bd44d9d641 LibWeb: Show correct element margin values in Inspector "Box Model" view
We were showing the margin-top value for all 4 margin values.
2022-03-25 11:57:30 +01:00
Lenny Maiorani 0b7baa7e5a Services: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-24 20:09:26 -07:00
Andreas Kling c2d7ef057d WebContent: Remove accidentally committed unveil() call 2022-03-24 23:17:49 +01:00
Andreas Kling 195ef5e26f LibWeb: Bring CSS line-height implementation closer to spec
We now distribute the line-height evenly between the space above and
below inline-level boxes. This noticeably improves our baseline
alignment in many cases.

Note that the "vertical-align: <length>" case is quite awkward, as the
extra height added by the offset baseline must count towards the line
box height.

There's a lot of room for improvement here, but this makes the buckets
container on Acid3 show up in the right place, with the right size.
2022-03-24 22:52:44 +01:00
Kenneth Myhra 4a57be824c Userland+Tests: Convert File::read_link() from String to ErrorOr<String>
This converts the return value of File::read_link() from String to
ErrorOr<String>.

The rest of the change is to support the potential of an Error being
returned and subsequent release of the value when no Error is returned.
Unfortunately at this stage none of the places affected can utililize
our TRY() macro.
2022-03-24 11:57:51 +01:00
Andreas Kling ca85ac26d4 WebContent: Fill OOPWV with palette base color when there's no content 2022-03-23 17:27:20 +01:00
Liav A e508073168 SystemServer: Create /dev/tty as a character device instead of a symlink
The new device has major number 5, minor number 0, and is represented by
the SelfTTYDevice class in the Kernel.
2022-03-22 20:26:05 +01:00
sin-ack e212514bbf LookupServer: Return with failure result when lookup fails
This was missed in 4ca0669d1e and the
error condition would still fall through to an ErrorOr unwrapping which
caused a crash.
2022-03-20 12:09:31 +03:30
Ali Mohammad Pur dff8344336 RequestServer: Keep the EnsureConnection job alive until it finishes
Fixes #12906.
2022-03-19 22:04:35 +01:00
Maciej c1ca009939 WebServer: Add Content-Length header to HTTP responses
This makes the browser know how much data it should expect.
2022-03-19 22:03:51 +01:00
Tom 9f59d7d9a0 WindowServer: Fix animation crash
If an Animation's on_stop handler cleared itself inside the on_stop
event handler, it would remove itself from the animation map that was
still being iterated, leading to a crash.

To solve this, we'll iterate over the animations using the
remove_all_matching function, which enables us to delete it by simply
returning true when the animation finished. In the event that the
Animation is kept alive elsewhere and the on_stop event clears its own
reference, we need to temporarily bump the reference count. Another
advantage is that we only need to bump the reference count when an
animation is finished, whereas before this we bumped it
unconditionally.
2022-03-18 20:00:30 +01:00
Lenny Maiorani f912a48315 Userland: Change static const variables to static constexpr
`static const` variables can be computed and initialized at run-time
during initialization or the first time a function is called. Change
them to `static constexpr` to ensure they are computed at
compile-time.

This allows some removal of `strlen` because the length of the
`StringView` can be used which is pre-computed at compile-time.
2022-03-18 19:58:57 +01:00
Linus Groh 9422ae9bb2 LibJS: Add infallible variant of VM::push_execution_context()
It makes no sense to require passing a global object and doing a stack
space check in some cases where running out of stack is highly unlikely,
we can't recover from errors, and currently ignore the result anyway.

This is most commonly in constructors and when setting things up, rather
than regular function calls.
2022-03-18 01:12:12 +01:00
Andreas Kling e31fe3eeb8 LibWeb: Rename Element::specified_css_values() => computed_css_values()
Let's make it very clear that these are *computed* values, and not at
all the specified values. The specified values are currently discarded
by the CSS cascade algorithm.
2022-03-15 19:48:19 +01:00
Andreas Kling 43ef813f3d LibWeb: Rename Element::computed_style() to resolved_css_values()
This more accurately reflects what's actually being returned.
2022-03-15 19:48:19 +01:00
kleines Filmröllchen 79deb7d6c7 AudioServer: Decrease sample headroom to 5%
This might still be too much, but it's better than what we had before.
2022-03-14 22:46:46 +01:00
Karol Kosek a5e149c012 WindowServer: Update menu buttons' rects on font change
Prior to this change, after changing the system font, the menu rects
stayed the same, making the menu bar look a bit cramped on larger fonts.
2022-03-14 22:29:57 +01:00