Commit graph

39711 commits

Author SHA1 Message Date
Tim Schumacher 218e6d2f5e Ports/SDL2: Rename LibAudio connection to ConnectionToServer 2022-07-23 00:21:13 +01:00
Timothy Flynn ae2acc8cdf LibJS+LibUnicode: Generate a set of default DateTimeFormat patterns
This isn't called out in TR-35, but before ICU even looks at CLDR data,
it adds a hard-coded set of default patterns to each locale's calendar.
It has done this since 2006 when its DateTimeFormat feature was first
created. Several test262 tests depend on this, which under ECMA-402,
falls into "implementation defined" behavior. For compatibility, we
can do the same in LibUnicode.
2022-07-22 23:51:56 +01:00
Linus Groh 8150d71821 Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_' 2022-07-22 23:09:43 +01:00
Linus Groh 5a106b6401 Everywhere: Prefix 'TYPEDEF_DISTINCT_NUMERIC_GENERAL' with 'AK_' 2022-07-22 23:09:43 +01:00
Kenneth Myhra 9a1c27a163 LibWeb: Implement BufferSource support for XHR::send() 2022-07-22 23:08:28 +01:00
Kenneth Myhra e55bdd434a LibWeb: Add spec link for XMLHttpRequestBodyInit 2022-07-22 23:08:28 +01:00
Kenneth Myhra 5830ff5be9 LibWeb: Let XHR::extract_body() return ErrorOr
This is a minor refactor of XHR::extract_body() letting it return
ErrorOr<...> instead of just Fetch::Infrastructure::BodyWithType.

This also updates the one place extract_body() is used.
2022-07-22 23:08:28 +01:00
Kenneth Myhra 9fe12c1851 LibWeb: Let get_buffer_source_copy() return ErrorOr instead of Optional
This is a minor refactor of IDL::get_buffer_source_copy() letting it
return ErrorOr<ByteBuffer> instead of Optional<ByteBuffer>.

This also updates all places that use IDL::get_buffer_source_copy().
2022-07-22 23:08:28 +01:00
networkException 7a2bef7fe1 Help: Make history navigation work with man pages opened using help urls
This patch implements man pages opened using the help url protocol
properly getting added to the navigation history as well as enabling
the back and forward buttons in such cases.
2022-07-22 23:06:54 +01:00
networkException 7d177b7210 WorkspacePicker: Immediately update active workspace on click or scroll
This patch makes the picker applet react instantly to a click on a
workspace or scroll on the widget, instead of waiting for an event from
WindowServer and as such until the switching animation has ended. This
synchronises the switching with the overlay shown.

Note that WindowServer events will still get handled in case the
workspace were to be updated from somewhere else.
2022-07-22 21:54:20 +01:00
networkException b3f8734e22 WorkspacePicker: Use full words for some variable names
This patch updates the spelling of "col" to be "column" and
"v{col,row}s" to be spelled out as "workspace_{row,column}s".
2022-07-22 21:54:20 +01:00
Karol Kosek 81bedb5066 Base: Add Latin-1 Supplement to font Roman Regular 10
00A4, 00A6, 00AA-00AD, 00AF, 00B1-00B3, 00B5, 00B8-00BE, 00C0-00FF
https://www.unicode.org/charts/PDF/U0080.pdf
2022-07-22 19:36:43 +01:00
kleines Filmröllchen 3123753e6b Piano: Increase AudioPlayerLoop resilience against scheduling weirdness
This is a temporary fix until we move AudioPlayerLoop to direct buffer
enqueuing.
2022-07-22 19:35:41 +01:00
kleines Filmröllchen 4941cffdd0 Piano+LibDSP: Move Track to LibDSP
This is a tangly commit and it fixes all the bugs that a plain move
would have caused (i.e. we need to touch other logic which had wrong
assumptions).
2022-07-22 19:35:41 +01:00
kleines Filmröllchen 125122a9ab LibAudio: Prevent racy eternal deadlock of the audio enqueue thread
The audio enqueuer thread goes to sleep when there is no more audio data
present, and through normal Core::EventLoop events it can be woken up.
However, that waking up only happens when the thread is not currently
running, so that the wake-up events don't queue up and cause weirdness.
The atomic variable responsible for keeping track of whether the thread
is active can lead to a racy deadlock however, where the audio enqueuer
thread will never wake up again despite there being audio data to
enqueue. Consider this scenario:

- Main thread calls into async_enqueue. It detects that according to the
  atomic variable, the other thread is still running, skipping the event
  queue wake.
- Enqueuer thread has just finished playing the last chunk of audio and
  detects that there is no audio left. It enters the if block with the
  dbgln "Reached end of provided audio data..."
- Main thread enqueues audio, making the user sample queue non-empty.
- Enqueuer thread does not check this condition again, instead setting
  the atomic variable to indicate that it is not running. It exits into
  an event loop sleep.
- Main thread exits async_enqueue. The calling audio enqueuing system
  (see e.g. Piano, but all of them function similarly) will wait until
  the enqueuer thread has played enough samples before async_enqueue is
  called again. However, since the enqueuer thread will never play any
  audio, this condition is never fulfilled and audio playback deadlocks

This commit fixes that by allowing the event loop to not enqueue an
event that already exists, therefore overloading the audio enqueuer
event loop by at maximum one message in weird situations. We entirely
get rid of the atomic variable and the race condition is prevented.
2022-07-22 19:35:41 +01:00
kleines Filmröllchen 763cda227f LibAudio: Don't auto-start the convenience enqueuer thread
This will conflict with apps that don't use this thread and it also
creates unnecessary overhead for non-enqueuing clients like AudioApplet.
Use the new Thread is_started info to start the thread only if necessary
(on first call to async_enqueue).
2022-07-22 19:35:41 +01:00
kleines Filmröllchen 91913fba59 LibThreading: Add is_started state information to Thread
Users can now determine whether a thread has been started or not. A
started thread might also have already terminated.

Implementation note: We *could* detect this with pthread APIs maybe, but
this is much simpler.
2022-07-22 19:35:41 +01:00
kleines Filmröllchen 500dc83f32 AK: Add FixedArray::fill_with
This is a memset-like utility method.
2022-07-22 19:35:41 +01:00
kleines Filmröllchen 5b1345a4ff AK: Remove FixedArray::must_create_but_fixme_should_propagate_errors
Nobody was using this anymore.
2022-07-22 19:35:41 +01:00
Tim Schumacher 8ab1245e4a Tests: Add a test for pthread_cancel 2022-07-22 10:07:15 -07:00
Tim Schumacher c85f307e62 LibC: Mark a bunch of functions as cancellation points 2022-07-22 10:07:15 -07:00
Tim Schumacher 899fd74f8e LibC: Implement pthread_cancel 2022-07-22 10:07:15 -07:00
Tim Schumacher 1269ce0c35 Tests: Add tests for pthread_setcancel{state,type}
We likely won't be able to test `pthread_cancel` itself, but this at
least makes sure that we use the correct values by default and that we
correctly reject invalid values.
2022-07-22 10:07:15 -07:00
Tim Schumacher b4a926735a LibC: Implement pthread_setcancel{state,type} 2022-07-22 10:07:15 -07:00
Tim Schumacher e79f0e2ee9 Kernel+LibC: Don't hardcode the maximum signal number everywhere 2022-07-22 10:07:15 -07:00
Tim Schumacher a39a341e26 Ports: Update the CMake platform module from upstream
While we're at it, remove the `/bin/sh` patch that is no longer needed,
as we now build the port fully on the host.
2022-07-22 17:33:28 +01:00
Obinna Ikeh 9956d3d1e1 LibJS: Add tests for %TypedArray%.prototype.with 2022-07-22 17:17:15 +01:00
Obinna Ikeh 4a201e8854 LibJS: Add %TypedArray%.prototype.with 2022-07-22 17:17:15 +01:00
Luke Wilde 1e829c4ea8 LibJS: Check PlainMonthDay is in the ISO date time limits in creation
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/374305c
2022-07-22 17:10:03 +01:00
Luke Wilde 61847b3cef LibJS: Disallow negative day lengths in ZonedDateTime.protoype.round
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6f04074
2022-07-22 17:10:03 +01:00
Kenneth Myhra 114120852d LibWeb/IDL: Handle passing ArrayBuffer to an IDL union type
This fixes a bug where an ArrayBuffer passed to the Blob constructor
would just be stringified to: "[object ArrayBuffer]".
2022-07-22 10:18:53 +01:00
Timothy Flynn b8d4f8debf LibJS: Selectively display DateTimeFormat day periods as noon 2022-07-21 20:36:03 +01:00
Timothy Flynn 32c07bc6c3 LibUnicode: Generate per-locale data for the "noon" fixed day period
Note that not all locales have this day period.
2022-07-21 20:36:03 +01:00
Timothy Flynn 16b673eaa9 LibUnicode: Check whether a calendar symbol for a locale actually exists
In the generated unique string list, index 0 is the empty string, and is
used to indicate a value doesn't exist in the CLDR. Check for this
before returning an empty calendar symbol.

For example, an upcoming commit will add the fixed day period "noon",
which not all locales support.
2022-07-21 20:36:03 +01:00
Timothy Flynn 0f26ab89ae LibJS+LibUnicode: Handle flexible day periods on both sides of midnight
Commit ec7d535 only partially handled the case of flexible day periods
rolling over midnight, in that it only worked for hours after midnight.
For example, the en locale defines a day period range of [21:00, 06:00).
The previous method of adding 24 hours to the given hour would change
e.g. 23:00 to 47:00, which isn't valid.
2022-07-21 20:36:03 +01:00
Samuel Bowman fadd69263a PartitionEditor: Add size column 2022-07-21 20:13:44 +01:00
Samuel Bowman ba9f60785b PartitionEditor: Add total blocks column 2022-07-21 20:13:44 +01:00
Samuel Bowman 2f8c20816e LibPartition: Fix end block off by one error
Previously, end block was inconsistent. GUIDPartitionTable treated
end block as an inclusive bound, while MBRPartitionTable and
EBRPartitionTable treated end block as an exclusive bound.
Now all three treat end block as an inclusive upper bound.
2022-07-21 20:13:44 +01:00
Samuel Bowman fb4221ad52 PartitionEditor: Abort and show a dialog if not running as root 2022-07-21 20:13:44 +01:00
Samuel Bowman 7a8953a833 PartitionEditor: Add the beginnings of a partition editor :^)
This adds a new application PartitionEditor which will eventually be
used to create and edit partition tables. Since LibPartition does not
know how to write partition tables yet, it is currently read-only.

Devices are discovered by scanning /dev for block device files.
Since block devices are chmod 600, PartitionEditor be must run as root.

By default Serenity uses the entire disk for the ext2 filesystem
without a partition table. This isn't useful for testing as the
partition list for the default disk will be empty. To test properly,
I created a few disk images using various partitioning schemes
(MBR, EBR, and GPT) and attached them using the following command:

export SERENITY_EXTRA_QEMU_ARGS="
  -drive file=/path/to/mbr.img,format=raw,index=1,media=disk
  -drive file=/path/to/ebr.img,format=raw,index=2,media=disk
  -drive file=/path/to/gpt.img,format=raw,index=3,media=disk"
2022-07-21 20:13:44 +01:00
Samuel Bowman 7b8088c78d LibCore: Add File::is_{block,char}_device() helpers
The existing File::is_device() helpers don't distinguish between
block and char devices. This commit adds File::is_block_device() and
File::is_char_device() helpers which are more specific.
2022-07-21 20:13:44 +01:00
Samuel Bowman 380ce43afc LibPartition: Make GUIDPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman 11b4d51fc9 LibPartition: Make EBRPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman 7e45c3b687 LibPartition: Make MBRPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman 6a1c85aa61 LibPartition: Make PartitionTable kernel/userland agnostic
Previously, PartitionTable was constructed using a Kernel::StorageDevice
making it only usable in the kernel. This commit adds a new constructor
that takes a Core::File instead, making it usable in userland as well.

This also adds the m_block_size field which stores the block size of the
underlying device obtained by calling StorageDevice::block_size() in the
kernel or by using the STORAGE_DEVICE_GET_BLOCK_SIZE ioctl in userland.
This avoids the need for an #ifdef every time block size is needed.
2022-07-21 20:13:44 +01:00
Samuel Bowman f6ab636d31 Kernel: Move DiskPartition up into Kernel/Storage
Everything in Kernel/Storage/Partition but DiskPartition has been moved
into LibPartiton. This makes the Partition directory unnecessary so
DiskPartition is moved up into Kernel/Storage.
2022-07-21 20:13:44 +01:00
Samuel Bowman 25de9de7dc Kernel+LibPartition: Move GUIDPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman 9053d86b82 Kernel+LibPartition: Move EBRPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman 1a6ef03e4a Kernel+LibPartition: Move MBRPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman 940dde9947 Kernel+LibPartition: Move PartitionTable into LibPartition 2022-07-21 20:13:44 +01:00