Commit graph

20084 commits

Author SHA1 Message Date
sin-ack
2de11b0dc8 AK: Add LexicalPath::append and LexicalPath::join
This patch adds two new methods to LexicalPath.  LexicalPath::append
appends a new path component to a LexicalPath, and LexicalPath::join
constructs a new LexicalPath from one or more components.

Co-authored-by: Gunnar Beutner <gunnar@beutner.name>
2021-05-12 22:38:20 +02:00
Tom
3f9927b0c3 Kernel: Fix issues supporting HPETs with 32-bit-only main counter
If the HPET main counter does not support full 64 bits, we should
not expect the upper 32 bit to work. This is a problem when writing
to the upper 32 bit of the comparator value, which requires the
TimerConfiguration::ValueSet bit to be set, but if it's not 64 bit
capable then the bit will not be cleared and leave it in a bad state.

Fixes #6990
2021-05-12 21:44:16 +02:00
Andreas Kling
a6a57830d0 FileManager: Reorganize main toolbar a little bit
Re-group things so they match the menus better.
2021-05-12 21:37:37 +02:00
Andreas Kling
bed2356b11 FileManager: Reorganize menus a little bit
Move the common editing actions (cut/copy/paste/select-all) into a new
"Edit" menu. And move the "Open Terminal Here" action to the "Go" menu.
2021-05-12 21:32:54 +02:00
Andreas Kling
bc0146932e LibGUI: Never resolve Key_Invalid to a GUI::Action
Fixes #7047.
2021-05-12 20:59:07 +02:00
Andreas Kling
8c7bce818d LibGUI: Move action-from-key-event code to a separate function
The logic that figures out which (if any) action should be activated
by a keydown event was getting a bit unwieldy. This patch moves it to
a separate helper function.
2021-05-12 20:51:45 +02:00
Linus Groh
91eda22208 Everywhere: Add Alt shortcuts to remaining top-level menus
Not sure why some menus did have one and others didn't, even in the
same application - now they all do. :^)
I added character shortcuts to some menu actions as well.
2021-05-12 18:09:42 +01:00
Linus Groh
f2154bca17 Browser: Use URL for window title if tab title is empty
Seeing " - Browser" for loading pages is annoying, so let's do something
more sensible instead for empty tab document titles: "<URL> - Browser".
Also consolidate the two places where this code is used into a lambda to
make any future changes easier.
2021-05-12 17:55:48 +01:00
Linus Groh
c8738bbd7e SystemMonitor: Spell process window title as "System Monitor"
This is what we use for the main window and elsewhere.
2021-05-12 17:52:56 +01:00
Linus Groh
ff1d3f53c4 Everywhere: Rename app_menu to file_menu, continued
These were missed in 4b0098e.
2021-05-12 17:50:48 +01:00
Gunnar Beutner
790d68ac5e Kernel: Route packets destined for us through the loopback adapter
Without this patch we'd send packets through the physical adapter
and they'd incorrectly end up on the network.
2021-05-12 16:31:29 +02:00
Gunnar Beutner
2b6aa571d1 Kernel: Outbound packets should use the source address from the socket
Previously we'd use the adapter's address as the source address
when sending packets. Instead we should use the socket's bound local
address.
2021-05-12 16:31:29 +02:00
Gunnar Beutner
532db9f768 Kernel: Treat 0.0.0.0 as a loopback address
This matches what other operating systems like Linux do:

$ ip route get 0.0.0.0
local 0.0.0.0 dev lo src 127.0.0.1 uid 1000
    cache <local>

$ ssh 0.0.0.0
gunnar@0.0.0.0's password:

$ ss -na | grep :22 | grep ESTAB
tcp   ESTAB      0      0   127.0.0.1:43118   127.0.0.1:22
tcp   ESTAB      0      0   127.0.0.1:22      127.0.0.1:43118
2021-05-12 13:47:07 +02:00
Gunnar Beutner
af59f64bc0 Kernel: Coalesce TCP ACKs
Previously we'd send a TCP ACK for each TCP packet we received. This
changes NetworkTask so that we send fewer TCP ACKs.
2021-05-12 13:47:07 +02:00
Gunnar Beutner
ffc6b714b0 Kernel: Trigger TCP fast retransmission when we encounter lost packets
When we receive a TCP packet with a sequence number that is not what
we expected we have lost one or more packets. We can signal this to
the sender by sending a TCP ACK with the previous ack number so that
they can resend the missing TCP fragments.
2021-05-12 13:47:07 +02:00
Gunnar Beutner
7272127927 Kernel: Don't process TCP packets out of order
Previously we'd process TCP packets in whatever order we received
them in. In the case where packets arrived out of order we'd end
up passing garbage to the userspace process.

This was most evident for TLS connections:

courage:~ $ git clone https://github.com/SerenityOS/serenity
Cloning into 'serenity'...
remote: Enumerating objects: 178826, done.
remote: Counting objects: 100% (1880/1880), done.
remote: Compressing objects: 100% (907/907), done.
error: RPC failed; curl 56 OpenSSL SSL_read: error:1408F119:SSL
routines:SSL3_GET_RECORD:decryption failed or bad record mac, errno 0
error: 1918 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
2021-05-12 13:47:07 +02:00
Gunnar Beutner
aff4d22de9 Kernel: Set MSS option for outbound TCP SYN packets
When the MSS option header is missing the default maximum segment
size is 536 which results in lots of very small TCP packets that
NetworkTask has to handle.

This adds the MSS option header to outbound TCP SYN packets and
sets it to an appropriate value depending on the interface's MTU.

Note that we do not currently do path MTU discovery so this could
cause problems when hops don't fragment packets properly.
2021-05-12 13:47:07 +02:00
Gunnar Beutner
5feeb62843 Kernel: Avoid allocating KBuffers for TCP packets
This avoids allocating a KBuffer for each incoming TCP packet.
2021-05-12 13:47:07 +02:00
Gunnar Beutner
c0800ab898 Kernel: Increase the default TCP window size
This increases the default TCP window size to a more reasonable
value of 64k. This allows TCP peers to send us more packets before
waiting for corresponding ACKs.
2021-05-12 13:47:07 +02:00
Gunnar Beutner
b83a110174 Kernel: Increase IPv4 buffer size to 256kB
This increases the buffer size for connection-oriented sockets
to 256kB. In combination with the other patches in this series
I was able to receive TCP packets at a rate of about 120Mbps.
2021-05-12 13:47:07 +02:00
Mart G
b00cdf8ed8 Kernel+LibC: Make get_dir_entries syscall retriable
The get_dir_entries syscall failed if the serialized form of all the
directory entries together was too large to fit in its temporary buffer.

Now the kernel uses a fixed size buffer, that is flushed to an output
buffer when it is full. If this flushing operation fails because there
is not enough space available, the syscall will return -EINVAL. That
error code is then used in userspace as a signal to allocate a larger
buffer and retry the syscall.
2021-05-12 12:50:23 +02:00
Ali Mohammad Pur
c7b60164ed LibCore: Don't use has_flag() with multiple flags (OpenMode::ReadWrite)
Fixes boot, regressed in a91a49337c.
2021-05-12 12:49:31 +02:00
Ali Mohammad Pur
1ae8775a1b LibCore+Everywhere: Move SeekMode out of IODevice 2021-05-12 11:00:45 +01:00
Ali Mohammad Pur
a91a49337c LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
2021-05-12 11:00:45 +01:00
DolphinChips
422ef7904e Build: Add extlinux-image target to CMake 2021-05-12 09:25:03 +01:00
DolphinChips
5d4f521c9d Meta: Add script to build image with EXTLINUX bootloader 2021-05-12 09:25:03 +01:00
DolphinChips
c1775a908c Meta: Add EXTLINUX config 2021-05-12 09:25:03 +01:00
Tobias Christiansen
e7498bb918 LibWeb: Position the ListItemMarkers according to their width
Previously they were positioned with a fixed offset. However this lead
to wider markers with more than one character to collide with the
element itself.
Now the ListItemMarkerBox generates and stores the appropriate String
in its constructor and sets its own width according to that.
The ListItemBox then lays out the Marker taking this width into
account.
This also made the painting a lot easier since we don't generate the
needed Strings every time we repaint, just once.
2021-05-12 08:53:18 +01:00
Tobias Christiansen
a51cee748f LibWeb: Remove unused alphabet constants from ListItemMarkerBox
Why exactly the linter didn't whine about this is a mystery. These
constants aren't needed anymore since the functionality moved to
AK/String a while ago.
2021-05-12 08:53:18 +01:00
Timothy Flynn
1ec23f38ed LibWeb: Move clearing boxes below preceding floating boxes
When computing the y-position of a clearing element, use the height of
the border box of the associated floating elements.

This also extracts this block of code to a helper lambda since it is
used twice.
2021-05-12 08:50:20 +01:00
Gunnar Beutner
e9a8646d3e Ports: Add missing dependencies for openttd 2021-05-12 08:37:07 +01:00
Gunnar Beutner
83c78971e2 Ports: Fix building the libicu port
If you're on the new toolchain with std support already
you'd be unable to build libicu because <cmath> #undefs
some of the defines from <math.h> (e.g. isfinite).
2021-05-12 08:37:07 +01:00
Ali Mohammad Pur
8419ddb4d8 RequestServer: Only attempt to flush() on a timer
...instead of doing so immediately.
This makes RequestServer not spin as much when its client isn't fast
enough to empty the download pipe.
It also has the nice benefit of allowing multiple downloads to happen
at the same time without one blocking the other too much.
2021-05-12 08:36:58 +01:00
Ali Mohammad Pur
afa98fcb55 LibTLS: Always send the signature_algorithms extension
At some point since Sep 2018, OpenSSL added a ~~bug~~ feature that makes
the default set of signature algorithms defined in TLSv1.2 unusable
without reducing what they call the "security level", which caused
communication with servers using more recent versions of openssl to
fail with "internal error".
This commit makes LibTLS always send its supported sigalgs, making the
server not default to the insecure defaults, and thus enabling us to
talk to such servers.
2021-05-12 08:35:02 +01:00
Jagger De Leo
0ed46103ed Documentation: Add Alpine Linux build instructions 2021-05-12 08:30:02 +01:00
Linus Groh
0a329d2d70 LibJS: Make super() in catch block work
The TryStatement handler execution creates a new LexicalEnvironment
without a current function set, which we were not accounting for when
trying to get the super constructor while executing a SuperExpression.
This makes it work but isn't pretty - this needs some refactoring to be
close to the spec for that to happen.

Fixes #7045.
2021-05-11 23:31:30 +01:00
Linus Groh
d85b9fd5a0 LibJS: Bring back runtime validation of RegExp flags
This is a partial revert of commit 60064e2, which removed the validation
of RegExp flags during runtime and expected the parser to do that
exclusively - however this was not taking into account the RegExp()
constructor, which was subsequently crashing on invalid flags.

Also adds test for these constructor error cases, which were obviously
missing before.

Fixes #7042.
2021-05-11 22:47:14 +01:00
Linus Groh
431782bcd6 LibJS/Tests: Add details for toThrowWithMessage() expectation error 2021-05-11 22:41:35 +01:00
Idan Horowitz
ce86026ac6 LibWeb: Add a maximum redirects limit to FrameLoader
This prevents the browser from crashing when trying to load an infinite
redirects loop. The chosen limit is based on the fetch specification:
"If request's redirect count is twenty, return a network error."
2021-05-11 21:41:48 +01:00
miere43
84800a5b4f Base: Add :nth-last-child test document 2021-05-11 21:17:16 +01:00
miere43
c4bd4cbd76 LibWeb: Implement :nth-last-child pseudo-class 2021-05-11 21:17:16 +01:00
Vladislav Vorobev
e87eaa3991 Documentation: Fix broken link to Meta/Lagom/ReadMe.md 2021-05-11 20:35:17 +01:00
Luke
c5c9494f48 LibJS: Use u64 instead of u32 in NumberPrototype::to_string
Update to #7033
Partial fix for #7034 (just ups the range to about 2 ** 54 before
losing precision)
2021-05-11 18:29:55 +01:00
Luke
2ff03ecfa8 LibJS: Make number parts unsigned in NumberPrototype::to_string
Fixes #3931
2021-05-11 17:29:37 +01:00
sin-ack
ecbe17fb11 LibLine+Shell: Add dirty history flag and use it
This patch adds a new flag called history_dirty to Line::Editor that is
set when history is added to but written.  Applications can leverage
this flag to write history only when it changes.  This patch adds an
example usage of this functionality to Shell, which will now only save
the history when it is dirty.
2021-05-11 17:26:30 +01:00
Timothy Flynn
227ccfc61a LibWeb: Paint an element's foreground before painting its children
The current implementation is missing the emphasized text of the
following rule in the painting order spec:

    7. Otherwise: *first for the element*, then for all its in-flow,
       non-positioned, block-level descendants in tree order...

This ensures the foreground is painted for the current element before
descending into its children.
2021-05-11 18:03:21 +02:00
Linus Groh
ecdb6a11b7 Base: Add Magnifier.af 2021-05-11 18:01:55 +02:00
Linus Groh
8afcd22900 Magnifier: Make window resizable
Instead of having the window non-resizable, it now defaults to a frame
size of 200 x 200 pixels but is user-resizable. The shown screenshot
updates its size accordingly. :^)
Sometimes we might need a larger view, or a non-square shape.
2021-05-11 18:01:55 +02:00
Luke
1c1b106f6c LibWeb: Make Element::tag_name return the HTML uppercased qualified name
I forgot to change tag_name when this was added.
Also makes html_uppercased_qualified_name return a const reference.
2021-05-11 18:01:36 +02:00
Luke
56d7d28d41 LibWeb: Expose Element.{prefix,localName} 2021-05-11 18:01:36 +02:00