Commit graph

9059 commits

Author SHA1 Message Date
Ben Wiederhake
dce3faff08 Kernel: Don't crash on invalid fcntl 2020-05-03 22:46:28 +02:00
Ben Wiederhake
b24cfd36ae Kernel: Demonstrate kernel crash on invalid fcntl 2020-05-03 22:46:28 +02:00
Andreas Kling
e6922c0d40 LibCrypto: Manage vector sizing manually in performance-critical places
Use Vector::resize_and_keep_capacity() to resize BigInt vectors to just
the right size without risking deallocation. Then do direct indexed
accesses to the underlying words (or use memset/memcpy.)

This gives a ~40% speed-up on the RSA tests in "test-crypto -t pk" :^)
2020-05-03 19:14:50 +02:00
Andreas Kling
baadde122b AK: Add Vector::resize_and_keep_capacity()
This function is just like resize() except it does not deallocate the
vector buffer when shrinking.
2020-05-03 19:14:50 +02:00
Andreas Kling
e7abbc6655 LibTLS: Put some debug spam behind an #ifdef 2020-05-03 19:14:50 +02:00
Andreas Kling
7f41a1adda LibHTTP: Put some debug spam behind an #ifdef 2020-05-03 19:14:50 +02:00
AnotherTest
b028a123b8 LibTLS: "Properly" handle the server dropping the connection
Contrary to popular belief, not every implementation of TLS follows the
specs.
Some of them just drop the connection without sending a proper
close_notify, and we should handle that gracefully.
2020-05-03 19:08:40 +02:00
DexesTTP
8aeccf4f02 LibCrypto: Added BigInteger 'division by u16' operator 2020-05-03 14:31:26 +02:00
DexesTTP
0efd58bf6d LibCrypto: Changed ModularFunctions to use non-allocating operations
This change leads to between 10% and 35% performance improvement when executing
the RSA decryption method.

The main impact is to drastically reduce the number of allocations done in this
method from around 50% of the profile hits to less than 2%.
2020-05-03 14:31:26 +02:00
DexesTTP
28ea347e55 LibCrypto: Added static non-allocating UnsignedBigInteger operators
This changes the plus, minus, etc... operators from UnsignedBigInteger to use a
static helper method. The static methods do not allocate any variables, instead
all the required BigInteger output and temporary variables are required on call
as parameters.

This change already optimizes the number of allocations in complex operations
such as multiply or divide, by having a single allocation per call (instead of
one per loop).

This new API also provides a way to limit the number of allocations for complex
computations in other parts of the code. This is done by using these helpers in
any place that currently makes use of the standard operators.
2020-05-03 14:31:26 +02:00
DexesTTP
d008a38f93 LibCrypto: Small fixes in BigInteger & test-crypto 2020-05-03 14:31:26 +02:00
DexesTTP
8ad48cca29 test-crypto: Display execution time for passing tests 2020-05-03 14:31:26 +02:00
Andreas Kling
3c0ca04ad3 LookupServer: Only pass A record responses to clients
This works around an issue where we'd try responding to a LookupServer
client with an empty CNAME record.
2020-05-03 14:24:54 +02:00
Andreas Kling
82d83f0fe1 WindowServer: Remove debug spam when creating new windows 2020-05-03 14:24:54 +02:00
Ben Wiederhake
da837fe46e Meta: Fix Makefile permissions (not executable) 2020-05-03 14:24:08 +02:00
AnotherTest
06cf9d3fb7 ProtocolServer: Implement and handle download progress
Also updates `pro` to display download progress and speed on stderr
2020-05-03 12:59:26 +02:00
AnotherTest
c6825a96c7 AK+FileManager: Move out human_readable_size to AK::NumberFormat 2020-05-03 12:59:26 +02:00
AnotherTest
6fcb6baa69 IPCCompiler: Add support for Optional<T> (so long as T is trivial) 2020-05-03 12:59:26 +02:00
Linus Groh
32742709dc LibJS: Support empty statements
We already skipped random semicolons in Parser::parse_program(), but now
they are properly matched and parsed as empty statements - and thus
recognized as a valid body of an if / else / while / ... statement.
2020-05-03 12:57:48 +02:00
AnotherTest
3b432eed98 LibCrypto: Correct RFC5246 un-padding behaviour
The decrypted data is legally allowed to have any amount of padding, so
long as it is block-aligned, we should not assume that padding bytes
fall inside the same block, or that an entire block cannot be padding.

Fixes #2072
2020-05-03 11:46:40 +02:00
Shannon Booth
637ecdb415 Userland: Fix leak in keymap
Pretty harmless here, but eh
2020-05-03 11:42:32 +02:00
Linus Groh
25cf0da2fb LibJS: Set name of anonymous functions during assignment 2020-05-03 11:41:56 +02:00
Matthew Olsson
5e66f1900b LibJS: Add function default arguments
Adds the ability for function arguments to have default values. This
works for standard functions as well as arrow functions. Default values
are not printed in a <function>.toString() call, as nodes cannot print
their source string representation.
2020-05-03 00:44:57 +02:00
Linus Groh
751f813f6a WindowServer: Update desktop window rect on resolution change
Fixes #2073.
2020-05-03 00:41:35 +02:00
Michael Lelli
58a34fbe09
Kernel: Fix pledge syscall applying new pledges when it fails (#2076)
If the exec promises fail to apply, then the normal promises should
not apply either. Add a test for this fixed functionality.
2020-05-03 00:41:18 +02:00
Andreas Kling
37d1b0c875 WindowServer: Reset double-click timers for back/forward buttons
Thanks for movAX13H for pointing this out!
2020-05-03 00:29:57 +02:00
Andreas Kling
b8f778a430 Demos: Add a little "Mouse" demo for showing mouse button states
This was very helpful when adding support for 5-button mice! :^)
2020-05-02 22:13:54 +02:00
Andreas Kling
67b92a7d5f WindowServer+LibGUI: Support the 4th and 5th mouse buttons
We'll call the "Back" and "Forward" since that's what they are normally
mapped to in some other systems.
2020-05-02 22:07:43 +02:00
Andreas Kling
c5882d3a18 Kernel: Detect 5-button PS/2 mouse if present :^)
The detection works very similarly to how we detect a mouse wheel, just
another magical sequence of "set sample rate" requests to the mouse
followed by an ID check.
2020-05-02 22:06:17 +02:00
Andreas Kling
c00ff4ba62 LibJS: Fix build (GlobalObject::add_constructor not visible in LibWeb) 2020-05-02 20:43:44 +02:00
Linus Groh
99be27b4a1 LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
Linus Groh
d007e8d00f LibJS: Set correct "length" of Object constructor 2020-05-02 20:41:31 +02:00
Linus Groh
85582953c6 LibJS: Minor formatting changes in Function.cpp 2020-05-02 20:41:31 +02:00
Linus Groh
ae05dc8abc LibJS: Name functions created by "Function" "anonymous"
...as it is supposed to be.
2020-05-02 20:41:31 +02:00
Emilio Cobos Álvarez
e347d6bdb8 LibGUI: Properly remove auto-destroyed child windows from reified_windows.
I just spotted this while I saw you writing this code :-)
2020-05-02 20:27:07 +02:00
AnotherTest
a63e8c4a03 LibHTTP: Trim received data to Content-Length
Apparently servers will feel free to pad their response if they send one
that contains a content-length field.
We should not assume that the entirety of the response is valid data.
2020-05-02 20:23:15 +02:00
Linus Groh
ce0bed0482 js: Ignore property attributes for completion
Only being able to complete enumerable properties is annoying,
especially since we updated everything to use the correct attributes.

Most standard built-in objects are *not* enumerable.
2020-05-02 19:21:50 +02:00
Sergey Bugaev
628777f94a LibIPC: Abort on connection failure
...instead of looping for (effectively) ever.

Fixes https://github.com/SerenityOS/serenity/issues/1869
2020-05-02 15:59:37 +02:00
Sergey Bugaev
d5582596a9 SystemServer: Bump the default listening socket backlog to 16
We now have many clients that are trying to connect to the WindowServer
simultaneously on startup. We could make this configurable, but 16 should
be enough for anybody ™.
2020-05-02 15:59:37 +02:00
Andres Vieira
ad309d4eca Terminal: Write an empty string instead of (null) on Command key
This prevents a Terminal to create a configuration file with
 Command=(null)

That would make it try to execute the command "(null)" on the next run.
2020-05-02 15:41:27 +02:00
Shannon Booth
0e403a43a4 Terminal: Add config for startup command
This is useful when working on a program as you can put the command into
the config file, instead of having to type it up each time on boot.
2020-05-02 14:12:57 +02:00
Brendan Coles
548ecceb75 Screensaver: Add app-screensaver.png 16x16 icon 2020-05-02 14:12:45 +02:00
Ben Wiederhake
cfbc49b5fc LibGUI: FilePicker: Set initial sort to name instead of undefined
Well, technically the initial sort order is 'ascending inode'.
However, that is unpredictable for the user.
In the rare case it is desired, it can be re-enabled by revealing the
inode column, and then sorting by it, in the TableView.
2020-05-02 14:12:36 +02:00
Ben Wiederhake
b6bea3d25b LibGUI: Fix off-by-one in ScrollableWidget
This was most notable in the widgets TextBox and TextEditor (and
therefore also ComboBox and ColorInput), because there the cursor
regularly landed just one pixel outside the visible region when
going to the right.
2020-05-02 14:12:36 +02:00
Ben Wiederhake
5d3ac4ec9e DisplaySettings: Don't crash after 'pape'
Running 'pape' without arguments (or just editing the WindowServer.ini by hand)
can confuse DisplaySettings. Specifically, if the 'Wallpaper' is set to
'/res/wallpapers/', then DisplaySettings used to crash because 'name_parts'
wouldn't contain any trailing element.

It's hard to define desired behavior, but this is better than crashing
and confusing the user.
2020-05-02 14:12:36 +02:00
Ben Wiederhake
1b140d1b5b LibGUI: FilePicker: Make icon view button initially checked 2020-05-02 14:12:36 +02:00
Ben Wiederhake
ef433cb367 LibGUI: The UI calls it 'Icon view', fix the name in the code 2020-05-02 14:12:36 +02:00
Ben Wiederhake
8e01356b2f LibGUI: FilePicker: Populate location textbox 2020-05-02 14:12:36 +02:00
Ben Wiederhake
6a453370ad LibGUI: FilePicker: Fix position of location textbox 2020-05-02 14:12:36 +02:00
Ben Wiederhake
ebabce30bd LibGUI: Display hidden columns as hidden
Until now, hidden columns were displayed as visible in the context menu.
An easy way to reproduce this is:
- Open the TextEditor
- Ctrl-O to open the file selector
- Switch to table view
- Right-click the header

Expected behavior:
Hidden columns like 'Owner' and 'Group' should not have a checkmark,
because they are hidden.

Actual behavior: They did have a checkmark. Clicking on it to 'hide'
the already hidden column removed the checkmark, but was a no-op to the
table view.

This commit fixes this behavior, by correctly initializing the context menu,
and properly updating the context menu if external code calls
'set_column_hidden' later.
2020-05-02 14:12:36 +02:00