Commit graph

15516 commits

Author SHA1 Message Date
Andreas Kling 3e8050f002 ProtocolServer: Add some debug log output for failed downloads
To make it easier to work out what went wrong.
2021-01-03 13:10:53 +01:00
TheMorc 7be2c9864e Demos: add CatDog (Neko clone) 2021-01-03 12:57:18 +01:00
Andreas Kling a63330077f Browser: Tell LaunchServer we only want to show the downloads directory
Browser only uses LaunchServer for one thing: to open the user's
downloads directory after a download is finished.

Eventually I'd like to move this functionality to a separate download
manager service, but for now, let's at least lock down what Browser is
able to ask LaunchServer to do. :^)
2021-01-03 12:10:34 +01:00
Andreas Kling 70c59dcbf8 LaunchServer+LibDesktop: Add ability to allow URL without handler
This lets clients say they want to be able to open a specific URL
without specifying which handler to use.
2021-01-03 12:10:01 +01:00
Andreas Kling 43c2b66b18 Revert "Terminal: Tell LaunchServer we only need to open "Help""
This reverts commit 8bf98eb581.

Terminal uses LaunchServer to open URLs that you click on. Oopsie!
2021-01-03 11:53:57 +01:00
Andreas Kling 8bf98eb581 Terminal: Tell LaunchServer we only need to open "Help" 2021-01-03 11:43:03 +01:00
Andreas Kling 1f1763c37a LaunchServer+LibDesktop: Add unveil-like mechanism for LaunchServer
Clients of LaunchServer can now provide a list of allowed handlers,
optionally with a specific set of URLs. The list can be sealed to
prevent future additions to it.

If LaunchServer receives a request to open something not on the allowed
handlers list, it will disconnect the client immediately.

The main idea here is to allow otherwise restricted programs to launch
specific things, e.g "Help" to open their manual, or "Browser" to load
the SerenityOS home page. :^)
2021-01-03 11:39:33 +01:00
Andreas Kling 8b2e7628fa LibGUI: Also specialize PgUp/PgDn/Home/End in line-wrapped TextEditors
This exposes some bugs in TextEditor's widget/document coordinate
conversions which we'll need to track down separately.
2021-01-03 10:49:20 +01:00
Andreas Kling 906e310411 LibGUI: Improve up/down arrow behavior in TextEditor with wrapping
Instead of moving between physical lines, the up/down arrow keys now
move between visual lines.
2021-01-03 10:49:20 +01:00
Brendan Coles bd2a7c414c Help: Support loading help page by file path as command line argument 2021-01-03 10:48:54 +01:00
AnotherTest 7f7656fe4e LibGUI: Make the autocomplete box window a child of its editor's window
Fixes #4761.
2021-01-03 10:47:29 +01:00
AnotherTest 6dbdbec835 Playground: Improve the autocompleted suggestions
- Now sorted
- Add a "layout" property to GUI::Widget and GUI::Frame
- Only complete Layouts for the values of "layout"
- Don't suggest anything if the only suggestion is what the user has
  already typed
2021-01-03 10:47:29 +01:00
AnotherTest 432c37cafc LibGUI: Stop the automatic autocomplete timer when typing whitespace
There's no reason to bring up autocomplete when the user is just
inserting indentation and spaces and such.
2021-01-03 10:47:29 +01:00
AnotherTest 3b2668e996 LibGUI: Register the various BoxLayouts
They're not exactly "widgets", but the widget registration registers
Core::Objects anyway.
2021-01-03 10:47:29 +01:00
AnotherTest 2b38b2f83b LibCore: Add a way to check if a property is readonly 2021-01-03 10:47:29 +01:00
AnotherTest f3ecea1fb3 AK: Add String{,View}::is_whitespace()
+Tests!
2021-01-03 10:47:29 +01:00
Glenford Williams b795f582cf LibGUI: Add missing properties to Widget gml
Add a few properties to Widget class for usage when in a gml environment
2021-01-03 10:34:55 +01:00
Andrew Kaster 39908fd569 LibGUI: Move widget registrations to the corresponding cpp file
This gets a lot of unecessary includes out of Widget.cpp. Doing this
didn't work before, but improvements in the C library and using dynamic
libraries have likely un-broken it :^).

Also, move the registration global object to an anonymous namespace. No
reason it has to be an extern symbol.
2021-01-03 10:31:42 +01:00
Luke 0bf44ac9d8 LibWeb: Fully implement end tag parsing in foreign content
Required to view the Spotify home page
2021-01-03 00:29:28 +01:00
Linus Groh 306aff80d0 LibGUI: Remove Widget's unused m_{foreground,background}_color
...as well as the few remaining references to set_foreground_color().

These properties are not being used for rendering anymore, presumably
because they completely mess up theming - assigning random white and
gray backgrounds just doesn't work with dark themes.
I've chosen to not replace most of the few remaining uses of this
broken functionality with custom palette colors (the closest
replacement is background_role) for now (except for Minesweeper where
squares with mines are painted red again now), as no one has actually
complained about them being broken, so it must look somewhat decent
(some just look right anyway). :^)

Examples of this are the taskbar buttons, which apparently had a
DarkGray foreground color for minimized windows once - this has since
been replaced with bold/regular font. Another one is the Profiler's
ProfileTimelineWidget, which is supposed to have a white background -
which it didn't have for quite some time, it's grey now (with the
default theme, that is). Doesn't look bad either.
2021-01-02 23:31:22 +01:00
Laria Carolin Chabowski fc2c5c373b NotificationServer: Reposition notifications on screen resolution change
Previously notifications were (partially) drawn outside the screen rect if
they were created before changing the screen resolution to smaller
dimensions. This prevented the user from dismissing the notification as the
close button was no longer clickable.
2021-01-02 23:17:30 +01:00
AnotherTest 2caf4e66ea Shell: Stop running the backgrounding test
This test is breaking the build all the time, let's just turn it off for
now. we can enable it again once we know it won't fail.
2021-01-02 21:02:15 +01:00
Andreas Kling 05f5d0dda3 LibGfx: Add Gfx::TextAttributes (and use it in GUI::TextDocumentSpan) 2021-01-02 20:57:43 +01:00
Tom 0d44ee6f2b Kernel: Ignore TLB flush requests for user addresses of other processes
If a TLB flush request is broadcast to other processors and the addresses
to flush are user mode addresses, we can ignore such a request on the
target processor if the page directory currently in use doesn't match
the addresses to be flushed. We still need to broadcast to all processors
in that case because the other processors may switch to that same page
directory at any time.
2021-01-02 20:56:35 +01:00
Tom c630669304 Kernel: If a VMObject is shared, broadcast page remappings
If we remap pages (e.g. lazy allocation) inside a VMObject that is
shared among more than one region, broadcast it to any other region
that may be mapping the same page.
2021-01-02 20:56:35 +01:00
Tom e3190bd144 Revert "Kernel: Allocate shared memory regions immediately"
This reverts commit fe6b3f99d1.
2021-01-02 20:56:35 +01:00
AnotherTest 4bc33ee3ae Spreadsheet: Drop all references to example windows when closing them
Fixes #4716.
2021-01-02 17:15:46 +01:00
AnotherTest e080a4f74a Spreadsheet: Avoid OOB access and use-after-move in selection 2021-01-02 17:15:46 +01:00
Andreas Kling 88ce755579 Help: Add a "Home" action to the toolbar :^) 2021-01-02 17:00:25 +01:00
Andreas Kling ae0320183a Help: Rename manual section 1 to "User programs"
Since we're putting man pages for GUI apps into this category as well,
let's call it something other than "Command-line programs" :^)
2021-01-02 16:58:13 +01:00
Andreas Kling fe6b3f99d1 Kernel: Allocate shared memory regions immediately
Lazily committed shared memory was not working in situations where one
process would write to the memory and another would only read from it.

Since the reading process would never cause a write fault in the shared
region, we'd never notice that the writing process had added real
physical pages to the VMObject. This happened because the lazily
committed pages were marked "present" in the page table.

This patch solves the issue by always allocating shared memory up front
and not trying to be clever about it.
2021-01-02 16:57:31 +01:00
Andreas Kling 5dae85afe7 Kernel: Pass "shared" flag to Region constructor
Before this change, we would sometimes map a region into the address
space with !is_shared(), and then moments later call set_shared(true).

I found this very confusing while debugging, so this patch makes us pass
the initial shared flag to the Region constructor, ensuring that it's in
the correct state by the time we first map the region.
2021-01-02 16:57:31 +01:00
Andreas Kling 1898aa8cd4 LibWeb: Use Gfx::Bitmap::create_shareable() in OOPWV
We were jumping through some pretty wasteful hoops in the resize event
handler of OOPWV by first creating a bitmap and then immediately
creating a new (shareable) clone of that bitmap. Now we go straight
to the shareable bitmap instead.
2021-01-02 16:57:31 +01:00
Andreas Kling 0bc8d58c3b LibGfx: Add Gfx::Bitmap::create_shareable(format, size)
This helper allocates a shbuf and returns it wrapped in a Bitmap.
2021-01-02 16:57:31 +01:00
Brian Gianforcaro fd08c93ef5 LibC: Randomize the stack check cookie value on initialization
Previously we had a static stack check cookie value for LibC.
Now we randomize the cookie value on LibC initialization, this should
help make the stack check more difficult to attack (still possible just
a bigger pain). This should also help to catch more bugs.
2021-01-02 13:55:48 +01:00
Andreas Kling 9ec9d20e84 Kernel: Fix bad VMObject iteration in sys$purge()
We were fooling ourselves into thinking all VMObjects are anonymous and
then tried to call purge() on them as if they were.
2021-01-02 13:34:29 +01:00
Brian Gianforcaro 79328b2aba Kernel: Enable -fstack-protector-strong (again)
Insert stack canaries to find stack corruptions in the kernel.
It looks like this was enabled in the past (842716a) but appears to have been
lost during the CMake conversion.

The `-fstack-protector-strong` variant was chosen because it catches more issues
than `-fstack-protector`, but doesn't have substantial performance impact like
`-fstack-protector-all`.
2021-01-02 13:04:30 +01:00
Itamar df5ea97c51 Kernel: Release scheduler_lock in ptrace once we know tracee is stopped
This fixes a kernel crash that occured when calling ptrace with PT_PEEK
on non paged-in memory.
The crash occurred because we were holding the scheduler lock while
trying to read from the disk's block device, which we do not allow.
Fixes #4740
2021-01-02 11:52:19 +01:00
Brendan Coles a50583ade1 Base: Add Terminal man page documentation 2021-01-02 11:43:42 +01:00
Brendan Coles 69e3879b7a LibGUI: CommonActions: Add make_help_action common action 2021-01-02 11:43:25 +01:00
AnotherTest 7785d9715d Playground: Enable automatic autocomplete in the editor
This makes it a bit more useful, as the user doesn't have to explicitly
ask for completion, it just provides completions, and tries really hard
to avoid suggesting things where they're not expected, for instance:
(cursor positions denoted as pipes)
```
@G | {|
    foo: bar |
    foo |
}
```

The user does not expect any suggestions in any of those cursor positions,
so provide no suggestions for such cases. This prevents the automatic autocomplete
getting in the way of the user, esp. when they try to press return fully
expecting to go to a new line.
2021-01-02 11:37:01 +01:00
AnotherTest a4a238ddc8 LibGUI: Add an optional "automatic" autocomplete feature to TextEditor
This aims to be a "smart" autocomplete that tries to present the user
with useful suggestions without being in the way (too much).
Here is its current configuration:
- Show suggestions 800ms after something is inserted in the editor
- if something else is inserted in that period, reset it back to 800ms
  to allow the user to type uninterrupted
- cancel any shown autocomplete (and the timer) on external changes
  (paste, cut, etc)
2021-01-02 11:37:01 +01:00
Tom 60f5f48dd1 Kernel: Allocate profiling memory upfront
We need to allocate all pages for the profiler right away so that
we don't trigger page faults in the timer interrupt handler to
allocate them.

Fixes #4734
2021-01-02 11:36:48 +01:00
Brian Gianforcaro 06da50afc7 Build + LibC: Enable -fstack-protector-strong in user space
Modify the user mode runtime to insert stack canaries to find stack corruptions.

The `-fstack-protector-strong` variant was chosen because it catches more
issues than vanilla `-fstack-protector`, but doesn't have substantial
performance impact like `-fstack-protector-all`.

Details:

    -fstack-protector enables stack protection for vulnerable functions that contain:

    * A character array larger than 8 bytes.
    * An 8-bit integer array larger than 8 bytes.
    * A call to alloca() with either a variable size or a constant size bigger than 8 bytes.

    -fstack-protector-strong enables stack protection for vulnerable functions that contain:

    * An array of any size and type.
    * A call to alloca().
    * A local variable that has its address taken.

Example of it catching corrupting in the `stack-smash` test:
```
courage ~ $ ./user/Tests/LibC/stack-smash
[+] Starting the stack smash ...
Error: Stack protector failure, stack smashing detected!
Shell: Job 1 (/usr/Tests/LibC/stack-smash) Aborted
```
2021-01-02 11:34:55 +01:00
Andreas Kling bf3772362a LibWeb: When collapsing margins, consider border box heights
Empty boxes should be fully collapsed, but a box with border and/or
padding is not empty.

This fixes an issue where <hr> elements were getting weirdly collapsed
since they have zero content height (but some border height.)
2021-01-02 03:48:35 +01:00
Andreas Kling 5116b94114 LibWeb: Fix unnecessary wrapping of block boxes in anonymous blocks
Outside of tables, we don't need to wrap block-level boxes in anymous
blocks. Only inline-level boxes need this treatment.
2021-01-02 03:48:35 +01:00
Brendan Coles 9bdffc9eb4 Calculator: Add app-calculator.png 32x32 icon 2021-01-02 03:22:44 +01:00
Andreas Kling d51bbe1e20 Help: Add a simple index page
Let's show something a bit more welcoming than empty white when the user
launches the Help application. :^)
2021-01-02 02:41:16 +01:00
Andreas Kling 042890d319 LibMarkdown: Parse horizontal rules
A horizontal rule is generated by a line with three or more of these
characters: '*', '-', '_'.
2021-01-02 02:41:15 +01:00
Andreas Kling 888a93e0f6 Help: Rename "Tree" tab to "Browse" 2021-01-02 02:20:59 +01:00