Commit graph

20617 commits

Author SHA1 Message Date
Ali Mohammad Pur
73cb566041 AK: Make vout() log to debug instead of VERIFY()'ing
In case the write was to stderr/stdout, and it just so happened to fail
because of an issue like "the pty is gone", VERIFY() would end up
calling vout() back to write to stderr, which would then fail forever
until the stack is exhausted.
"Fixes" the issue where the Shell would crash in horrible ways when the
terminal is closed.
2021-05-19 09:19:29 +02:00
DexesTTP
ed1800547e LibTLS: Enable the RSA_WITH_AES_256_GCM_SHA384 cipher
This is more of an example commit of how to add new ciphers to TLS.
2021-05-19 09:18:45 +02:00
DexesTTP
68f6796e72 LibTLS: Use RSA key exchange based on the cipher
After this, we aren't hardcoding RSA in everything we do anymore!
2021-05-19 09:18:45 +02:00
DexesTTP
9bb823a6ab LibTLS: Generate cipher variants based on the cipher
This is better than using the AEAD flag :^)
2021-05-19 09:18:45 +02:00
DexesTTP
2e9a4bb95c LibTLS: Replace cipher selection with a variant 2021-05-19 09:18:45 +02:00
DexesTTP
851e254e8f LibTLS: Rework method names and arrangement in cpp files
This commit only moves and renames methods. The code hasn't changed.
2021-05-19 09:18:45 +02:00
DexesTTP
6d190b299e LibTLS: Define cipher suite parameters and components in a macro
Instead of sprinkling the definition of the ciper suites all over the
TLS implementation, let's regroup it all once and for all in a single
place, and then add our new implementations there.
2021-05-19 09:18:45 +02:00
DexesTTP
17a1f51579 LibTLS: Move the asn certificate parser to Certificate.cpp 2021-05-19 09:18:45 +02:00
DexesTTP
45d55ecacc LibTLS: Move the cipher list to the CipherSuite.h header 2021-05-19 09:18:45 +02:00
DexesTTP
3d27550ab7 LibCrypto: Make GCM movable 2021-05-19 09:18:45 +02:00
DexesTTP
f11f629731 LibCrypto: Use AK::Variant in HashManager 2021-05-19 09:18:45 +02:00
DexesTTP
73f585ceb4 LibCrypto: Use AK::Variant in MultiHashDigestVariant 2021-05-19 09:18:45 +02:00
DexesTTP
2c1916dd8d LibCrypto: Add the SHA-384 hash algorithm
This is a truncated version of SHA-512, so it was fairly trivial.
2021-05-19 09:18:45 +02:00
brapru
b985eb1613 Utilities: Allow for white spaces in lsof name parsing
Previously lsof would crash by incorrectly parsing valid file names
that contain spaces.

For example, established TCP socket file descriptors would cause an
lsof crash:

	socket:127.0.0.1:33985 / 127.0.0.1:8080 (connected)

This commit fixes the issue by not parsing for white spaces to set the
file name.
2021-05-19 09:13:12 +02:00
Linus Groh
36e7733dec CrashDaemon: Fix CrashReporter argument order
For compressed coredumps, CrashReporter's argv were in this order:

    CrashReporter path --unlink

Core::ArgsParser doesn't like that at all and would immediately exit
from main(), causing the crash reporter to never display.
2021-05-18 23:42:02 +01:00
Marcus Nilsson
7aaef8fd4b Browser: Don't add multiple page reloads to history
When reloading a page multiple times, it was also added multiple
times to the history. This commit prohibits an url to be added
twice in a row.

Fixes #7264

Co-authored-by: Linus Groh <mail@linusgroh.de>
2021-05-18 23:14:37 +01:00
Gunnar Beutner
598d7f4127 AK: StringBuilder should prefer to use its inline capacity first
Previously StringBuilder would start allocating an external buffer
once the caller has used up more than half of the inline buffer's
capacity. Instead we should prefer to use the inline buffer until
it is full and only then start to allocate an external buffer.
2021-05-18 21:49:10 +02:00
Andreas Kling
076018b74b PDFViewer: Ignore wheel events when there is no document loaded 2021-05-18 21:25:35 +02:00
Max Wipfli
f808279769 LibWeb: Implement encoding sniffing algorithm
This patch implements the HTML specification's "encoding sniffing
algorithm", which is used when no encoding can be obtained from the
Content-Type header (either because it doesn't contain a charset=...)
value or the file has not been opened via HTTP (as with local files).

It also modifies the creator of the HTMLDocumentParser to use the new
HTMLDocumentParser::create_with_uncertain_encoding static method, which
runs the encoding sniffing algorithm before instantiating the parser.

This now allows us to load local HTML pages (or remote pages without a
charset specified in the 'Content-Type' header) with a non-UTF-8
encoding such as 'windows-1252'. This would previously crash the
browser. :^)
2021-05-18 21:02:07 +02:00
Max Wipfli
67a9ebc817 LibWeb: Change Document's m_encoding to Optional<String>
This modifies the Document class to use Optional<String> for the
encoding. If the encoding is unknown, the Optional will not have a
value. It also implements the has_encoding() and encoding_or_default()
instance methods, the latter of which will return "UTF-8" as a fallback
if no encoding is present.

The usage of Optional<String> instead of the null string is part of an
effort to explicitly indicate that a string could not have a value.

This also modifies the former callers of encoding() to use
encoding_or_default(). Furthermore, the encoding will now only be set if
it is actually known, rather than just guessed by earlier code.
2021-05-18 21:02:07 +02:00
Max Wipfli
a7681dbeea LibWeb: Change Resource's m_encoding to Optional<String>
This modifies the Resource class to use Optional<String> for the
encoding. If the encoding is unknown, the Optional will not have a
value (instead of using the null state of the String class). It also
implements a has_encoding() instance method and modifies the callers
of Resource::encoding() to use the new API.
2021-05-18 21:02:07 +02:00
Max Wipfli
ce6d6706a6 LibWeb: Use Optional<String> for encoding_from_content_type
This patch changes the encoding_from_content_type function to only
return an encoding if it actually finds one, and leave it up to the
caller to decided on a default to use.

It also modifies the caller to expect an Optional<String> (instead of
relying on the null state of the String class) as a return value and
separates the encoding and MIME type determination. This will be built
upon in a further commit.
2021-05-18 21:02:07 +02:00
Max Wipfli
d325403cb5 LibTextCodec: Use Optional<String> for get_standardized_encoding
This patch changes get_standardized_encoding to use an Optional<String>
return type instead of just returning the null string when unable to
match the provided encoding to one of the canonical encoding names.

This is part of an effort to move away from using null strings towards
explicitly using Optional<String> to indicate that the String may not
have a value.
2021-05-18 21:02:07 +02:00
Max Wipfli
f51b0729f5 AK: Implement StringBuilder::append_as_lowercase(char ch)
This patch adds a convenience method to AK::StringBuilder which converts
ASCII uppercase characters to lowercase before appending them.
2021-05-18 21:02:07 +02:00
Andreas Kling
df29d58e19 PDFViewer+Base: Display application title as "PDF Viewer"
This matches other applications in the system. :^)
2021-05-18 21:00:32 +02:00
Valtteri Koskivuori
eb9a0ace28 LibCore+Userland: Add two more detectable formats
Second batch of detectable formats, this time with verious offsets, as
enabled by the previous commit.
This adds tar, and the three signature variants for iso-9660 image
files.
2021-05-18 19:57:53 +01:00
Valtteri Koskivuori
241b378e4b LibCore: Add offsets to binary signature matching
Some file signatures are at an offset into the file, so we need to be
able to specify an offset to start matching bytes at.
2021-05-18 19:57:53 +01:00
Valtteri Koskivuori
105bbc457d LibCore+Userland: Add 5 more detectable filetypes
This adds gzip, sqlite, 7-Zip, flac and midi.
2021-05-18 19:57:53 +01:00
Jesse Buhagiar
2f49241296 Solitaire: Prevent player dragging entire stack to foundation
Currently, it is possible for the player to drag an entire stack
of cards to the foundation stack, provided the top card of the stack
(i.e the "root" card) can be dropped onto the foundation stack.
This causes an invalid state where, e.g, red cards end up in a
black foundation stack, or vice versa.
2021-05-18 20:05:10 +02:00
Andreas Kling
a743075b9f Browser: Move actions from Tab to BrowserWindow
Navigation actions (back/forward/home/reload) now live in BrowserWindow
instead of being duplicated in every new Tab instance.
2021-05-18 20:02:00 +02:00
Andreas Kling
aed695d4b2 Browser: Move menu management from Tab to BrowserWindow
It was very confusing for every Tab to have their own GUI::Menubar that
got dynamically swapped in/out when switching tabs.

This change moves us to a single menubar per window, and BrowserWindow
is the owner of its own menubar.
2021-05-18 20:02:00 +02:00
Marcus Nilsson
e5367c13d8 CatDog: Remove global menu and add context menu
There was no way to close catdog since it relied on global menus, this
adds a context menu for opening the about dialog and quitting.

Fixes #7252
2021-05-18 18:59:18 +01:00
Dmitrii Ubskii
9c963fa17b Pong: Make the game winnable
- Make the ball chill out a bit by reducing its x velocity by 1.
- Make the AI dumber. It now relaxes until the ball is coming towards it
  and is in its half of the court.
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
9a7aac1c6a Pong: Fix paddle movement across resets if keys are held
The game waited for the next key down event before moving the player
paddle. Now the state of the arrow keys is carried over between resets.
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
58131082f4 Pong: Improve mouse controls
Just because you're the player, doesn't mean you can cheat ;)

- Limit paddle speed when following mouse cursor.
- Unhide pointer -- can't grab it, can't see when it's about to leave
  the window otherwise.
- Add last pointer y position indication for the player paddle.
- Prevent the paddle from following the mouse when Up or Down is being
  held (avoid controls fighting).
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
bb76bcde57 Pong: Improve AI paddle movement
Begin and end triggers for AI paddle to start moving prevent it from
continually jerking around the ball's position. It still moves in steps
of paddle.speed though, but overall experience is smoother.
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
7c67c9b45f Pong: Fix score display
Player 1's score used to be score's width offset to the right. Now it's
score_margin away from the divider line, same as player 2's.

Also factored out score margin and increased it from 2px to 5px just
to make it look a little nicer.
2021-05-18 18:58:07 +01:00
Ali Mohammad Pur
d897abf4c2 LibWeb: Implement test-web in terms of LibTest/JavaScriptTestRunner
This deduplicates the test-js copy-ism :^)
2021-05-18 18:48:15 +01:00
Ali Mohammad Pur
f137c1bfaa LibJS+LibTest: Move out the test-js test runner into LibTest 2021-05-18 18:48:15 +01:00
Ali Mohammad Pur
b6e5c76427 AK: Add deduction guides to Tuple 2021-05-18 18:48:15 +01:00
Ali Mohammad Pur
5bf37d758c AK: Let HashMap export its key and value types 2021-05-18 18:48:15 +01:00
Timothy Flynn
547c7ba57f Solitaire: Display high score in status bar 2021-05-18 17:57:23 +02:00
Timothy Flynn
3d3a75f1b9 Solitaire: Track and persist high score 2021-05-18 17:57:23 +02:00
Timothy Flynn
7d062d0033 Solitaire: Persist game mode to config file 2021-05-18 17:57:23 +02:00
Hediadyoin1
5a8c220101 Kernel: Add a test for multi-region mprotect 2021-05-18 16:50:52 +02:00
Hendiadyoin1
ef425a02f7 Kernel: Implement mprotect for multiple Regions 2021-05-18 16:50:52 +02:00
Timothy Flynn
8afaa7f30e 2048: Display action status tips in status bar 2021-05-18 16:48:39 +02:00
Timothy Flynn
97cee35471 2048: Do not default to only temporarily applying settings changes
Also tweak its text in the settings window to be clearer on what this
check box is doing. Seemed a bit confusing that settings changes
required an extra action to persist.
2021-05-18 16:48:39 +02:00
Timothy Flynn
1a66f487a5 2048: Widen the settings window
It's currently too small to fit the text of some of the settings (in
particular, the "Target tile" text).
2021-05-18 16:48:39 +02:00
Timothy Flynn
f02a13c884 2048: Intialize settings window with current values
Currently, each time you open the settings window in 2048, it displays
the default values rather than the current values. This is confusing, so
display the current values instead.
2021-05-18 16:48:39 +02:00