Commit Graph

25962 Commits

Author SHA1 Message Date
Andreas Kling
c410f08c2b Kernel: Add ListedRefCounted<T> template class
This class implements the emerging "ref-counted object that participates
in a lock-protected list that requires safe removal on unref()" pattern
as a base class that can be inherited in place of RefCounted<T>.
2021-08-17 01:21:47 +02:00
Andreas Kling
641083f3b8 Kernel: Customize File::unref() and make it virtual
Make File inherit from RefCountedBase and provide a custom unref()
implementation. This will allow subclasses that participate in lists to
remove themselves in a safe way when being destroyed.
2021-08-17 01:21:47 +02:00
Andreas Kling
fc0cd8317a Kernel/DevPtsFS: Add tightly typed DevPtsFSInode::fs() 2021-08-17 01:21:47 +02:00
kleines Filmröllchen
65c8fa9f91 AudioApplet: Persist settings and respect audio server settings
The audio applet uses the user configuration file "AudioApplet.ini" to
persist its settings, currently only whether the audio percentage should
be shown.

Since the audio server now may have specific settings when it starts,
the audio applet respects them by reading these same settings once when
it starts. Therefore, the audio server settings are not immediately
overridden by the audio applet defaults, as was the case before this
change.

A minor change was done to the way that the audio volume is calculated;
doubles are now used.
2021-08-17 01:21:17 +02:00
kleines Filmröllchen
d1b0143ba5 AudioServer: Persist audio settings with a config file
AudioServer loads its settings, currently volume and mute state, from a
user config file "Audio.ini". Additionally, the current settings are
stored every ten seconds, if necessary. This allows for persistent audio
settings in between boots.
2021-08-17 01:21:17 +02:00
davidot
47bc72bcf6 LibJS: Correctly handle Unicode characters in JS source text
Also recognize additional white space characters.
2021-08-16 23:20:04 +01:00
davidot
4d6502de42 LibJS: Disallow standalone super expression 2021-08-16 23:20:04 +01:00
davidot
a8b25d6c36 LibJS: Handle '++' and '--' more correctly within expression 2021-08-16 23:20:04 +01:00
davidot
5f344f7ca3 LibJS: Check that 'let' is followed by declaration before matching it
Since 'let' is a valid variable name (in non-strict mode) let may not be
the start of a declaration but just an identifier.
2021-08-16 23:20:04 +01:00
davidot
179c48e1a4 LibJS: Add optional extra strict checks in parse_binding_pattern 2021-08-16 23:20:04 +01:00
davidot
f1f338edcd LibJS: Tighten default values in formal parameter parsing
Disallow default parameter for rest parameters.
Disallow yield expressions as default values.
2021-08-16 23:20:04 +01:00
davidot
4989e79c45 LibJS: Allow yielding a class 2021-08-16 23:20:04 +01:00
davidot
19582ccad8 LibJS: Treat yield as an identifier in more non-generator contexts
And disallow some cases where we are in a generator context.
2021-08-16 23:20:04 +01:00
davidot
26177b1826 LibJS: Add more duplicated declarations detection
This is a small step in the right direction although the amount of
different checks is becoming unsustainable. In the future we probably
want to have the current_scope handle all declarations.
2021-08-16 23:20:04 +01:00
davidot
085c7df895 LibJS: Be more strict about the lhs of a for in/of loop
This is not entirely correct as really Object- and ArrayExpressions are
not allowed but that requires a bigger refactoring of for statement
parsing.
2021-08-16 23:20:04 +01:00
davidot
106f9e30d7 LibJS: Force the lexer to parse a regex when expecting a statement 2021-08-16 23:20:04 +01:00
davidot
05444103e3 LibJS: Treat arrow expression as function and stop parsing after 2021-08-16 23:20:04 +01:00
davidot
e31b715808 LibJS: Make functions reset break and continue context 2021-08-16 23:20:04 +01:00
davidot
be3b4a68d2 LibJS: Allow class methods named "get", "set" or "static" 2021-08-16 23:20:04 +01:00
davidot
b16c02d6b4 LibJS: Allow labelled functions in certain contexts
Also disallow duplicated labels.
2021-08-16 23:20:04 +01:00
davidot
4cc95ae39d LibJS: Fix that a windows-style new line was not escaped properly 2021-08-16 23:20:04 +01:00
kleines Filmröllchen
ba622cffe4 LibAudio: Fix overflow on 24-bit FLAC LPC data
When computing sample values from a linear predictor, the repeated
multiplication and addition can lead to very large values that may
overflow a 32-bit integer. This was never discovered with 16-bit FLAC
test files used to create and validate the first version of the FLAC
loader. However, 24-bit audio, especially with large LPC shifts, will
regularly exceed and overflow i32. Therefore, we now use 64 bits
temporarily. If the resulting value is too large for 32 bits, something
else has gone wrong :^)

This fixes playback noise on 24-bit FLACs.
2021-08-17 00:16:00 +02:00
kleines Filmröllchen
c974be91ab LibAudio: Rescale integer samples correctly in FLAC loader
The FLAC samples are signed, so we need to rescale them not by their bit
depth, but by half of the bit depth. For example, a 24-bit sample
extends from -2^23 to 2^23-1, and therefore needs to be rescaled by 2^23
to conform to the [-1, 1] double sample range.
2021-08-17 00:16:00 +02:00
kleines Filmröllchen
442aa48a61 LibAudio: Use size_t in loops
This is more idiomatic :^)
2021-08-17 00:16:00 +02:00
Itamar
f3aa87c436 Kernel: Make makedev()/minor()/major() static
This was originally done in 7274037 and for some reason reverted in
740140a.

This avoids "multiple definitions" link errors and fixes the libuv port.
2021-08-16 23:26:52 +02:00
Sam Atkins
0fba71a655 LibWeb: Replace is_inherited_property() with generated code
We already include the inheritance for each property in Properties.json,
so made sense to use that instead of a list in StyleResolver.

Added `inherited: true` to a couple of properties to match the previous
code's behavior. One of those had a FIXME which I've moved to the JSON
file, which is hacky, but it works.
2021-08-16 23:26:16 +02:00
Tetsui Ohkubo
ea2b02186c Base: Associate obj files with 3DFileViewer
With this change, a user can open .obj files from FileManager.
2021-08-16 22:13:20 +02:00
Linus Groh
cbe7015c0c LibJS: Add missing spec link to YearMonthFromFields 2021-08-16 20:40:21 +01:00
Linus Groh
795e077eb8 LibJS: Implement Temporal.PlainDate.prototype.toPlainMonthDay() 2021-08-16 20:40:21 +01:00
Linus Groh
31f65b8c50 LibJS: Implement Temporal.Calendar.prototype.monthDayFromFields() 2021-08-16 20:40:21 +01:00
pyunbiwi
68d07320cf Userland: Add as-user execution to the pls utility
Commands may be executed as a specific user by passing the user's UID to
the '-u' flag in pls.
2021-08-16 21:16:30 +02:00
Ali Mohammad Pur
64bc5f668d Kernel: Avoid enumerating all the fds to find a specific one in procfs 2021-08-16 21:16:14 +02:00
Ali Mohammad Pur
e9feced041 Kernel: Add a Process::FileDescriptions::get_if_valid(index) API
Note that this is not the same as ::at(index), which has a different
precondition ("allocated" vs "valid").
2021-08-16 21:16:14 +02:00
Linus Groh
c1ffc17134 LibJS: Implement Temporal.Calendar.prototype.fields() 2021-08-16 20:02:02 +01:00
Timothy Flynn
7d23d9d557 CI: Remove NO_FUZZ Lagom builds from GitHub Actions 2021-08-16 18:04:33 +01:00
Timothy Flynn
27804a6e67 CI: Build and test Lagom (non-fuzzer) on Azure 2021-08-16 18:04:33 +01:00
Linus Groh
6709c915aa LibJS: Implement Temporal.PlainDate.prototype.toPlainYearMonth() 2021-08-16 14:10:41 +01:00
Linus Groh
ed9d37bd40 LibJS: Implement Temporal.Calendar.prototype.yearMonthFromFields() 2021-08-16 14:10:41 +01:00
Andreas Kling
c1c12497b5 Kernel: Don't hold thread list lock while invoking ~Thread()
There is no need for this, and it can cause deadlocks if ~Thread()
ends up doing something else that requires a lock (e.g ~Process())
2021-08-16 02:22:42 +02:00
Andreas Kling
29a58459ab Kernel: Use ProtectedValue for VirtualFileSystem::m_mounts
This is what VirtualFileSystem::m_lock was actually guarding, and
wrapping it in a ProtectedValue makes it so much more obvious how it
all works. :^)
2021-08-16 01:41:26 +02:00
Samuel Bowman
7089135a07 LibTLS: Add DHE_RSA AES GCM cipher suites
This adds the following cipher suites:
  * DHE_RSA_WITH_AES_128_GCM_SHA256
  * DHE_RSA_WITH_AES_256_GCM_SHA384
2021-08-16 03:50:53 +04:30
Samuel Bowman
b288016bbc LibTLS: Implement the DHE_RSA key exchange algorithm
This adds two methods, handle_dhe_rsa_server_key_exchange and
build_dhe_rsa_pre_master_secret, to TLSv12 and a struct,
server_diffie_hellman_params, to Context, which are used to implement
the DHE_RSA key exchange algorithm. This grants us the benefits of
forward secrecy and access to sites which support DHE_RSA.

It is worth noting that the signature of the server provided
Diffie-Hellman parameters is not currently validated. This will need to
be addressed to prevent man-in-the-middle attacks.
2021-08-16 03:50:53 +04:30
davidot
020bfc9d93 LibJS: Parse and partially execute import and export statements
We produce the import and export entries as per the spec. However we do
not yet verify that named things that are exported are declared
somewhere.
2021-08-15 23:51:47 +01:00
davidot
7613c22b06 LibJS: Add a mode to parse JS as a module
In a module strict mode should be enabled at the start of parsing and we
allow import and export statements.
2021-08-15 23:51:47 +01:00
Andreas Kling
d6d7d11590 Kernel: Cache Custody objects (weakly) to avoid expensive reconstruction
This patch adds a (spinlock-protected) custody cache. It's a simple
intrusive list containing all currently live custody objects.

This allows us to re-use existing custodies instead of creating them
again and again.

This gives a pretty decent performance improvement on "find /" :^)
2021-08-15 23:30:52 +02:00
Andreas Kling
a412fd2ed8 Kernel/ProcFS: Avoid two unnecessary number-to-string conversions
We don't need to create a new string from a number in order to compare
an existing string to that number. Converting the existing string to a
number is much cheaper, since it does not require any heap allocations.

Ran into this while profiling "find /" :^)
2021-08-15 23:30:52 +02:00
Andreas Kling
9c373b646b Kernel/SysFS: Don't compute exact size of PCI files
There's no need for generated files in SysFS to tell you their precise
file size when you stat() them.

I noticed when profiling "find /" that we were spending a chunk of time
generating and throwing away SysFS content just so we could tell you
exactly how large it would be. :^)
2021-08-15 23:30:52 +02:00
brapru
f633ef2af7 Kernel: Move ARP debug information to ARP_DEBUG
Previously when trying to debug the system's routing, the ARP
information would clutter the output and make it difficult to focus on
the routing decisions. It would be better to specify these
debug messages under ARP_DEBUG.
2021-08-15 21:53:29 +02:00
Idan Horowitz
6602ab27e1 CI: Disable variable substitution on input to the twitter script
This prevents command injection through backticks in commit messages.
2021-08-15 23:21:20 +04:30
Nico Weber
788472f91a Ports: Add libsixel
This contains `img2sixel`.
2021-08-15 19:48:11 +01:00